@hot-updater/react-native 1.0.0-rc.40 → 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/lib/commonjs/appReady.js +25 -31
- package/lib/commonjs/appReady.js.map +1 -1
- package/lib/commonjs/checkForUpdate.js +9 -9
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/error.js +1 -1
- package/lib/commonjs/httpClient.js +1 -1
- package/lib/commonjs/index.js +304 -326
- 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 +3 -3
- package/lib/commonjs/pluginHost.js +11 -15
- package/lib/commonjs/pluginHost.js.map +1 -1
- package/lib/commonjs/sdkVersion.js +1 -1
- package/lib/commonjs/wrap.js +7 -16
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/module/appReady.js +23 -28
- package/lib/module/appReady.js.map +1 -1
- package/lib/module/checkForUpdate.js +10 -10
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/clientPlugin.js.map +1 -1
- package/lib/module/error.js +1 -1
- package/lib/module/httpClient.js +1 -1
- package/lib/module/index.js +299 -329
- 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 +3 -3
- package/lib/module/pluginHost.js +9 -9
- package/lib/module/pluginHost.js.map +1 -1
- package/lib/module/sdkVersion.js +1 -1
- package/lib/module/wrap.js +7 -15
- package/lib/module/wrap.js.map +1 -1
- package/lib/typescript/commonjs/appReady.d.ts +18 -9
- package/lib/typescript/commonjs/appReady.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkForUpdate.d.ts +5 -3
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/commonjs/clientPlugin.d.ts +1 -1
- package/lib/typescript/commonjs/clientPlugin.d.ts.map +1 -1
- package/lib/typescript/commonjs/error.d.ts +1 -1
- package/lib/typescript/commonjs/httpClient.d.ts +1 -1
- package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +122 -110
- 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 +3 -3
- package/lib/typescript/commonjs/pluginHost.d.ts +7 -3
- package/lib/typescript/commonjs/pluginHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
- 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 -40
- package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
- package/lib/typescript/module/appReady.d.ts +18 -9
- package/lib/typescript/module/appReady.d.ts.map +1 -1
- package/lib/typescript/module/checkForUpdate.d.ts +5 -3
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/module/clientPlugin.d.ts +1 -1
- package/lib/typescript/module/clientPlugin.d.ts.map +1 -1
- package/lib/typescript/module/error.d.ts +1 -1
- package/lib/typescript/module/httpClient.d.ts +1 -1
- package/lib/typescript/module/httpClient.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +122 -110
- 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 +3 -3
- package/lib/typescript/module/pluginHost.d.ts +7 -3
- package/lib/typescript/module/pluginHost.d.ts.map +1 -1
- package/lib/typescript/module/sdkVersion.d.ts +1 -1
- 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 -40
- package/lib/typescript/module/wrap.types.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/appReady.ts +43 -37
- package/src/checkForUpdate.ts +19 -11
- package/src/clientPlugin.ts +3 -0
- package/src/error.ts +1 -1
- package/src/httpClient.ts +1 -1
- package/src/index.ts +344 -422
- package/src/init.types.ts +24 -0
- package/src/native.ts +3 -3
- package/src/pluginHost.ts +16 -11
- package/src/sdkVersion.ts +1 -1
- package/src/wrap.tsx +6 -20
- package/src/wrap.types.ts +18 -45
|
@@ -1,67 +1,26 @@
|
|
|
1
|
+
import { type LaunchReporter } from "./appReady";
|
|
1
2
|
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
3
|
+
import type { ClientPluginApis, HotUpdaterClientPlugin } from "./clientPlugin";
|
|
4
|
+
import { type HotUpdaterHttpClient } from "./httpClient";
|
|
5
|
+
import type { HotUpdaterInitOptions } from "./init.types";
|
|
2
6
|
import { addListener, clearCrashHistory, getAppVersion, getUpdateId, getChannel, getCohort, getCrashHistory, getDefaultChannel, getFingerprintHash, getInstallId, getManifest, getMinBundleId, isChannelSwitched, notifyAppReady, reload, setCohort, setReloadBehavior, type UpdateParams } from "./native";
|
|
3
|
-
import { 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";
|
|
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";
|
|
6
11
|
export type { CustomReloadHandler, HotUpdaterEvent, HotUpdaterProgressArtifactType, HotUpdaterProgressEvent, Manifest, ManifestAsset, NotifyAppReadyResult, ActiveUpdateState, ReloadBehavior, ReloadBehaviorSetting, } from "./native";
|
|
7
12
|
export * from "./store";
|
|
8
13
|
export { extractSignatureFailure, type HotUpdaterBaseURL, isSignatureVerificationError, type SignatureVerificationFailure, } from "./types";
|
|
9
|
-
export type {
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Creates a HotUpdater client instance with all update management methods.
|
|
16
|
-
* This function is called once on module initialization to create a singleton instance.
|
|
17
|
-
*/
|
|
18
|
-
declare function createHotUpdaterClient(): {
|
|
19
|
-
/**
|
|
20
|
-
* `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.
|
|
21
|
-
*
|
|
22
|
-
* @param {object} options - Configuration options
|
|
23
|
-
* @param {string} options.source - Update server URL
|
|
24
|
-
* @param {object} [options.requestHeaders] - Request headers
|
|
25
|
-
* @param {React.ComponentType} [options.fallbackComponent] - Component to display during updates
|
|
26
|
-
* @param {boolean} [options.reloadOnForceUpdate=true] - Whether to automatically reload the app on force updates
|
|
27
|
-
* @param {Function} [options.onUpdateProcessCompleted] - Callback after update process completes
|
|
28
|
-
* @param {Function} [options.onProgress] - Callback to track bundle download progress
|
|
29
|
-
* @returns {Function} Higher-order component that wraps the app component
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* export default HotUpdater.wrap({
|
|
34
|
-
* baseURL: "<your-update-server-url>",
|
|
35
|
-
* updateStrategy: "appVersion",
|
|
36
|
-
* requestHeaders: {
|
|
37
|
-
* "x-api-key": "<your-api-key>",
|
|
38
|
-
* },
|
|
39
|
-
* })(App);
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
wrap: (options: HotUpdaterOptions) => <P extends object>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
43
|
-
/**
|
|
44
|
-
* Initializes HotUpdater without wrapping a React component.
|
|
45
|
-
*
|
|
46
|
-
* Use this for manual update flows in runtimes where a root component HOC
|
|
47
|
-
* is not convenient. Use this instead of wrapping the root component.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* HotUpdater.init({
|
|
52
|
-
* baseURL: "<your-update-server-url>",
|
|
53
|
-
* });
|
|
54
|
-
*
|
|
55
|
-
* export default App;
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
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: {
|
|
59
18
|
/**
|
|
60
19
|
* Reloads the app.
|
|
61
20
|
*/
|
|
62
21
|
reload: typeof reload;
|
|
63
22
|
/**
|
|
64
|
-
* Configures how `
|
|
23
|
+
* Configures how `hotUpdater.reload()` behaves.
|
|
65
24
|
*
|
|
66
25
|
* This can be called unconditionally on both platforms.
|
|
67
26
|
* The default is `processRestart`.
|
|
@@ -74,7 +33,7 @@ declare function createHotUpdaterClient(): {
|
|
|
74
33
|
/**
|
|
75
34
|
* Returns whether an update has finished downloading in this app session.
|
|
76
35
|
*
|
|
77
|
-
* When it returns true, calling `
|
|
36
|
+
* When it returns true, calling `hotUpdater.reload()` (or restarting the app)
|
|
78
37
|
* will apply the downloaded update bundle.
|
|
79
38
|
*
|
|
80
39
|
* - Derived from `progress` reaching 1.0
|
|
@@ -83,8 +42,8 @@ declare function createHotUpdaterClient(): {
|
|
|
83
42
|
* @returns {boolean} True if a downloaded update is ready to apply
|
|
84
43
|
* @example
|
|
85
44
|
* ```ts
|
|
86
|
-
* if (
|
|
87
|
-
* await
|
|
45
|
+
* if (hotUpdater.isUpdateDownloaded()) {
|
|
46
|
+
* await hotUpdater.reload();
|
|
88
47
|
* }
|
|
89
48
|
* ```
|
|
90
49
|
*/
|
|
@@ -115,7 +74,7 @@ declare function createHotUpdaterClient(): {
|
|
|
115
74
|
* @default "production"
|
|
116
75
|
* @example
|
|
117
76
|
* ```ts
|
|
118
|
-
* const channel =
|
|
77
|
+
* const channel = hotUpdater.getChannel();
|
|
119
78
|
* console.log(`Current channel: ${channel}`);
|
|
120
79
|
* ```
|
|
121
80
|
*/
|
|
@@ -128,7 +87,7 @@ declare function createHotUpdaterClient(): {
|
|
|
128
87
|
* @returns {string} The default release channel embedded in the app
|
|
129
88
|
* @example
|
|
130
89
|
* ```ts
|
|
131
|
-
* const defaultChannel =
|
|
90
|
+
* const defaultChannel = hotUpdater.getDefaultChannel();
|
|
132
91
|
* console.log(`Default channel: ${defaultChannel}`);
|
|
133
92
|
* ```
|
|
134
93
|
*/
|
|
@@ -157,7 +116,7 @@ declare function createHotUpdaterClient(): {
|
|
|
157
116
|
*
|
|
158
117
|
* @example
|
|
159
118
|
* ```ts
|
|
160
|
-
* const unsubscribe =
|
|
119
|
+
* const unsubscribe = hotUpdater.addListener("onProgress", ({ progress }) => {
|
|
161
120
|
* console.log(`Update progress: ${progress * 100}%`);
|
|
162
121
|
* });
|
|
163
122
|
*
|
|
@@ -167,7 +126,71 @@ declare function createHotUpdaterClient(): {
|
|
|
167
126
|
*/
|
|
168
127
|
addListener: typeof addListener;
|
|
169
128
|
/**
|
|
170
|
-
*
|
|
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.
|
|
171
194
|
*
|
|
172
195
|
* @param {Object} config - Update check configuration
|
|
173
196
|
* @param {string} [config.channel] - Optional channel override for this update check
|
|
@@ -177,7 +200,7 @@ declare function createHotUpdaterClient(): {
|
|
|
177
200
|
*
|
|
178
201
|
* @example
|
|
179
202
|
* ```ts
|
|
180
|
-
* const updateInfo = await
|
|
203
|
+
* const updateInfo = await hotUpdater.checkForUpdate({
|
|
181
204
|
* updateStrategy: "appVersion",
|
|
182
205
|
* requestHeaders: {
|
|
183
206
|
* "x-api-key": "<your-api-key>",
|
|
@@ -191,11 +214,11 @@ declare function createHotUpdaterClient(): {
|
|
|
191
214
|
*
|
|
192
215
|
* await updateInfo.updateBundle();
|
|
193
216
|
* if (updateInfo.shouldForceUpdate) {
|
|
194
|
-
* await
|
|
217
|
+
* await hotUpdater.reload();
|
|
195
218
|
* }
|
|
196
219
|
* ```
|
|
197
220
|
*/
|
|
198
|
-
checkForUpdate: (
|
|
221
|
+
checkForUpdate: (options: CheckForUpdateOptions) => Promise<import("./checkForUpdate").CheckForUpdateResult | null>;
|
|
199
222
|
/**
|
|
200
223
|
* Updates the bundle of the app.
|
|
201
224
|
*
|
|
@@ -205,7 +228,7 @@ declare function createHotUpdaterClient(): {
|
|
|
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,66 +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
|
-
|
|
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: {
|
|
254
275
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
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.
|
|
257
280
|
*
|
|
258
|
-
*
|
|
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()`.
|
|
259
284
|
*
|
|
260
285
|
* @example
|
|
261
|
-
* ```
|
|
262
|
-
* const
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
|
|
266
|
-
getCrashHistory: typeof getCrashHistory;
|
|
267
|
-
/**
|
|
268
|
-
* Clears the crashed bundle history, allowing previously crashed bundles
|
|
269
|
-
* to be installed again.
|
|
270
|
-
*
|
|
271
|
-
* @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
|
+
* });
|
|
272
291
|
*
|
|
273
|
-
*
|
|
274
|
-
* ```ts
|
|
275
|
-
* // Clear crash history to allow retrying a previously failed bundle
|
|
276
|
-
* HotUpdater.clearCrashHistory();
|
|
292
|
+
* hotUpdater.remoteConfig.getString("welcome_message");
|
|
277
293
|
* ```
|
|
278
294
|
*/
|
|
279
|
-
|
|
280
|
-
};
|
|
281
|
-
type HotUpdaterClient = Omit<ReturnType<typeof createHotUpdaterClient>, "wrap"> & {
|
|
282
|
-
wrap: HotUpdaterWrap;
|
|
295
|
+
init: <const TPlugins extends readonly HotUpdaterClientPlugin[] = readonly []>(options: HotUpdaterInitOptions<TPlugins>) => HotUpdaterInstance<TPlugins>;
|
|
283
296
|
};
|
|
284
|
-
export declare const HotUpdater: HotUpdaterClient;
|
|
285
297
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":"AAAA,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,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,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AAC,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"}
|
|
@@ -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`.
|
|
@@ -171,7 +171,7 @@ export declare const getAppVersion: () => string | null;
|
|
|
171
171
|
*/
|
|
172
172
|
export declare const reload: () => Promise<void>;
|
|
173
173
|
/**
|
|
174
|
-
* Configures how `
|
|
174
|
+
* Configures how `hotUpdater.reload()` should behave.
|
|
175
175
|
*
|
|
176
176
|
* This API is available on both Android and iOS so app code can stay symmetric.
|
|
177
177
|
* By default, HotUpdater uses `processRestart`.
|
|
@@ -281,7 +281,7 @@ export declare const readNotifyAppReady: () => {
|
|
|
281
281
|
*
|
|
282
282
|
* @example
|
|
283
283
|
* ```ts
|
|
284
|
-
* const result =
|
|
284
|
+
* const result = hotUpdater.notifyAppReady();
|
|
285
285
|
*
|
|
286
286
|
* if (result.status === "RECOVERED") {
|
|
287
287
|
* console.log(result.fromBundleId, result.toBundleId);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
4
8
|
//# sourceMappingURL=pluginHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginHost.d.ts","sourceRoot":"","sources":["../../../src/pluginHost.ts"],"names":[],"mappings":"
|
|
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,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.41";
|
|
2
2
|
//# sourceMappingURL=sdkVersion.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
export type {
|
|
4
|
-
export declare function init(options: InternalInitOptions): void;
|
|
2
|
+
import type { InternalWrapOptions } from "./wrap.types";
|
|
3
|
+
export type { HotUpdaterFallbackComponentProps, HotUpdaterWrapOptions, InternalWrapOptions, RunUpdateProcessResponse, } from "./wrap.types";
|
|
5
4
|
export declare function wrap(options: InternalWrapOptions): <P extends object>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
6
5
|
//# sourceMappingURL=wrap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,gCAAgC,EAChC,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,IAAI,CAClB,OAAO,EAAE,mBAAmB,GAC3B,CAAC,CAAC,SAAS,MAAM,EAClB,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KACrC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAiJ1B"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { HotUpdaterError } from "./error";
|
|
4
|
-
import type { HotUpdaterHttpClient } from "./httpClient";
|
|
5
|
-
import type { NotifyAppReadyResult } from "./native";
|
|
2
|
+
import type { CheckForUpdateOptions, CheckForUpdateResult } from "./checkForUpdate";
|
|
6
3
|
import type { HotUpdaterState } from "./store";
|
|
7
|
-
import type { HotUpdaterBaseURL } from "./types";
|
|
8
4
|
export interface RunUpdateProcessResponse {
|
|
9
5
|
status: "ROLLBACK" | "UPDATE" | "UP_TO_DATE";
|
|
10
6
|
shouldForceUpdate: boolean;
|
|
@@ -19,45 +15,22 @@ export type HotUpdaterFallbackComponentProps = {
|
|
|
19
15
|
artifactType: HotUpdaterState["artifactType"];
|
|
20
16
|
details: HotUpdaterState["details"];
|
|
21
17
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* update failures. Plugin ids must be unique.
|
|
28
|
-
*/
|
|
29
|
-
plugins?: readonly HotUpdaterClientPlugin[];
|
|
30
|
-
/** Base URL of a server exposing the Hot Updater v1 client HTTP protocol. */
|
|
31
|
-
baseURL: HotUpdaterBaseURL;
|
|
32
|
-
requestHeaders?: Record<string, string>;
|
|
33
|
-
requestTimeout?: number;
|
|
34
|
-
onNotifyAppReady?: (result: NotifyAppReadyResult) => void;
|
|
35
|
-
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
36
|
-
}
|
|
37
|
-
export type AutoUpdateOptions = CommonHotUpdaterOptions & {
|
|
38
|
-
updateStrategy: "fingerprint" | "appVersion";
|
|
39
|
-
fallbackComponent?: React.FC<HotUpdaterFallbackComponentProps>;
|
|
40
|
-
onProgress?: (progress: number) => void;
|
|
41
|
-
reloadOnForceUpdate?: boolean;
|
|
42
|
-
onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
|
|
43
|
-
};
|
|
44
|
-
export type HotUpdaterInitOptions = CommonHotUpdaterOptions;
|
|
45
|
-
export type HotUpdaterOptions = AutoUpdateOptions;
|
|
46
|
-
type InternalCommonOptions = {
|
|
47
|
-
client: HotUpdaterHttpClient;
|
|
48
|
-
requestHeaders?: Record<string, string>;
|
|
49
|
-
requestTimeout?: number;
|
|
50
|
-
onNotifyAppReady?: (result: NotifyAppReadyResult) => void;
|
|
51
|
-
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
52
|
-
};
|
|
53
|
-
type InternalAutoUpdateOptions = InternalCommonOptions & {
|
|
18
|
+
/**
|
|
19
|
+
* The update flow `hotUpdater.wrap` runs when the wrapped root mounts. The
|
|
20
|
+
* server, request settings, and plugins come from `HotUpdater.init`.
|
|
21
|
+
*/
|
|
22
|
+
export interface HotUpdaterWrapOptions {
|
|
54
23
|
updateStrategy: "fingerprint" | "appVersion";
|
|
55
24
|
fallbackComponent?: React.FC<HotUpdaterFallbackComponentProps>;
|
|
56
25
|
onProgress?: (progress: number) => void;
|
|
57
26
|
reloadOnForceUpdate?: boolean;
|
|
58
27
|
onUpdateProcessCompleted?: (response: RunUpdateProcessResponse) => void;
|
|
28
|
+
}
|
|
29
|
+
export type InternalWrapOptions = HotUpdaterWrapOptions & {
|
|
30
|
+
/** The instance's check, over the configuration of `HotUpdater.init`. */
|
|
31
|
+
checkForUpdate: (options: Pick<CheckForUpdateOptions, "updateStrategy">) => Promise<CheckForUpdateResult | null>;
|
|
32
|
+
/** Settles once `HotUpdater.init` has read this launch. */
|
|
33
|
+
appReady: () => Promise<unknown>;
|
|
34
|
+
onError: (error: unknown) => void;
|
|
59
35
|
};
|
|
60
|
-
export type InternalInitOptions = InternalCommonOptions;
|
|
61
|
-
export type InternalWrapOptions = InternalAutoUpdateOptions;
|
|
62
|
-
export {};
|
|
63
36
|
//# sourceMappingURL=wrap.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.types.d.ts","sourceRoot":"","sources":["../../../src/wrap.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wrap.types.d.ts","sourceRoot":"","sources":["../../../src/wrap.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,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AAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HotUpdaterError } from "./error";
|
|
2
2
|
import { type NotifyAppReadyResult } from "./native";
|
|
3
|
-
import {
|
|
3
|
+
import type { PluginHost } from "./pluginHost";
|
|
4
4
|
export type NotifyAppReadyOptions = {
|
|
5
5
|
onNotifyAppReady?: (result: NotifyAppReadyResult) => void;
|
|
6
6
|
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
@@ -10,12 +10,21 @@ export type NotifyAppReadyOptions = {
|
|
|
10
10
|
* selection that names it on the current channel.
|
|
11
11
|
*/
|
|
12
12
|
export declare const getRunningReleaseId: (bundleId: string, channel: string) => string | null;
|
|
13
|
-
/**
|
|
14
|
-
export
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
/** An instance's launch: read once, and reported to the instance's plugins. */
|
|
14
|
+
export interface LaunchReporter {
|
|
15
|
+
/**
|
|
16
|
+
* Reads this launch once native finalizes it and reports it to the
|
|
17
|
+
* plugins, once. It rejects only if `onError` throws.
|
|
18
|
+
*/
|
|
19
|
+
read(options: NotifyAppReadyOptions): Promise<NotifyAppReadyResult | undefined>;
|
|
20
|
+
/** Settles once the launch was read, whether it was reported or failed. */
|
|
21
|
+
readonly appReady: Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Calls a plugin hook after the instance's `onAppReady`, so plugins see the
|
|
24
|
+
* launch before anything that followed it. The event is built now, from the
|
|
25
|
+
* state it describes, and only when a plugin listens.
|
|
26
|
+
*/
|
|
27
|
+
emit: PluginHost["emitPluginHook"];
|
|
28
|
+
}
|
|
29
|
+
export declare const createLaunchReporter: (host: PluginHost) => LaunchReporter;
|
|
21
30
|
//# sourceMappingURL=appReady.d.ts.map
|
|
@@ -1 +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,
|
|
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,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,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;AAoBF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aACpB,MAAM,WACP,MAAM,KACd,MAAM,GAAG,IAQX,CAAC;AAyDF,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,IAAI,CACF,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC;;;;OAIG;IACH,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,oBAAoB,SAAU,UAAU,KAAG,cAoBvD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LaunchReporter } from "./appReady";
|
|
1
2
|
import type { ReleaseTransitionKind, UpdateErrorResource, UpdateErrorStage } from "./clientPlugin";
|
|
2
3
|
import type { HotUpdaterHttpClient } from "./httpClient";
|
|
3
4
|
export type { ReleaseTransitionKind };
|
|
@@ -6,7 +7,6 @@ export interface CheckForUpdateOptions {
|
|
|
6
7
|
* Update strategy
|
|
7
8
|
* - "fingerprint": Use fingerprint hash to check for updates
|
|
8
9
|
* - "appVersion": Use app version to check for updates
|
|
9
|
-
* - Can override the strategy set in HotUpdater.wrap()
|
|
10
10
|
*/
|
|
11
11
|
updateStrategy: "appVersion" | "fingerprint";
|
|
12
12
|
/**
|
|
@@ -33,12 +33,14 @@ export type CheckForUpdateResult = {
|
|
|
33
33
|
readonly transitionKind?: ReleaseTransitionKind;
|
|
34
34
|
/**
|
|
35
35
|
* Updates the bundle.
|
|
36
|
-
* This method is equivalent to `
|
|
36
|
+
* This method is equivalent to `hotUpdater.updateBundle()` but with all required arguments pre-filled.
|
|
37
37
|
*/
|
|
38
38
|
updateBundle: () => Promise<boolean>;
|
|
39
39
|
};
|
|
40
40
|
export interface InternalCheckForUpdateOptions extends CheckForUpdateOptions {
|
|
41
41
|
client: HotUpdaterHttpClient;
|
|
42
|
+
/** Calls the checking instance's plugin hooks. */
|
|
43
|
+
emit: LaunchReporter["emit"];
|
|
42
44
|
}
|
|
43
45
|
/** The running bundle, the channel checked, and the update's target. */
|
|
44
46
|
type UpdateErrorScope = {
|
|
@@ -52,6 +54,6 @@ type UpdateErrorScope = {
|
|
|
52
54
|
* Tells plugins why an update failed, when it failed as an update. An error
|
|
53
55
|
* the SDK's JavaScript raised happened in `stage`, fetching `resource`.
|
|
54
56
|
*/
|
|
55
|
-
export declare const reportUpdateError: (error: unknown, stage: UpdateErrorStage, resource: UpdateErrorResource | undefined, scope: UpdateErrorScope) => void;
|
|
57
|
+
export declare const reportUpdateError: (emit: LaunchReporter["emit"], error: unknown, stage: UpdateErrorStage, resource: UpdateErrorResource | undefined, scope: UpdateErrorScope) => void;
|
|
56
58
|
export declare function checkForUpdate(options: InternalCheckForUpdateOptions): Promise<CheckForUpdateResult | null>;
|
|
57
59
|
//# 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":"AAaA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACtE,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;;;;OAIG;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;IAC7B,kDAAkD;IAClD,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,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,SACtB,cAAc,CAAC,MAAM,CAAC,SACrB,OAAO,SACP,gBAAgB,YACb,mBAAmB,GAAG,SAAS,SAClC,gBAAgB,KACtB,IAmBF,CAAC;AA6RF,wBAAsB,cAAc,CAClC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA2EtC"}
|
|
@@ -1,2 +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";
|
|
1
|
+
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 UpdateErrorResource, type UpdateErrorStage, type UpdateErrorTransport, type UpdateHttpResponse, type UpdateStrategy, } from "@hot-updater/protocol";
|
|
2
2
|
//# sourceMappingURL=clientPlugin.d.ts.map
|