@hot-updater/react-native 0.1.5 → 0.2.0
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/dist/ensureBundles.d.ts +2 -0
- package/dist/error.d.ts +3 -0
- package/dist/index.d.ts +8 -62
- package/dist/index.js +3160 -2357
- package/dist/index.js.LICENSE.txt +19 -0
- package/dist/index.mjs +3129 -2353
- package/dist/index.mjs.LICENSE.txt +19 -0
- package/dist/init.d.ts +10 -0
- package/dist/native.d.ts +29 -0
- package/dist/store.d.ts +9 -0
- package/package.json +5 -4
- package/src/ensureBundles.ts +19 -4
- package/src/index.ts +3 -3
- package/src/init.tsx +30 -11
- package/src/native.ts +1 -1
- package/LICENSE +0 -21
- package/dist/index.d.mts +0 -71
- package/src/const.ts +0 -1
package/dist/error.d.ts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,71 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
progress: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
declare const addListener: <T extends keyof HotUpdaterEvent>(eventName: T, listener: (event: HotUpdaterEvent[T]) => void) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Fetches the current bundle version id.
|
|
12
|
-
*
|
|
13
|
-
* @async
|
|
14
|
-
* @returns {Promise<string>} Resolves with the current version id or null if not available.
|
|
15
|
-
*/
|
|
16
|
-
declare const getBundleId: () => string;
|
|
17
|
-
/**
|
|
18
|
-
* Downloads files from given URLs.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} bundleId - identifier for the bundle version.
|
|
21
|
-
* @param {string | null} zipUrl - zip file URL.
|
|
22
|
-
* @returns {Promise<boolean>} Resolves with true if download was successful, otherwise rejects with an error.
|
|
23
|
-
*/
|
|
24
|
-
declare const updateBundle: (bundleId: string, zipUrl: string | null) => Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Fetches the current app version.
|
|
27
|
-
*/
|
|
28
|
-
declare const getAppVersion: () => Promise<string | null>;
|
|
29
|
-
/**
|
|
30
|
-
* Reloads the app.
|
|
31
|
-
*/
|
|
32
|
-
declare const reload: () => void;
|
|
33
|
-
|
|
34
|
-
declare class HotUpdaterError extends Error {
|
|
35
|
-
constructor(message: string);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type HotUpdaterStatus = "INSTALLING_UPDATE" | "UP_TO_DATE";
|
|
39
|
-
interface HotUpdaterInitConfig {
|
|
40
|
-
source: BundleArg;
|
|
41
|
-
onSuccess?: (status: HotUpdaterStatus) => void;
|
|
42
|
-
onError?: (error: HotUpdaterError) => void;
|
|
43
|
-
}
|
|
44
|
-
declare const init: (config: HotUpdaterInitConfig) => Promise<void>;
|
|
45
|
-
|
|
46
|
-
type HotUpdaterState = {
|
|
47
|
-
progress: number;
|
|
48
|
-
};
|
|
49
|
-
declare const hotUpdaterStore: {
|
|
50
|
-
getState: () => HotUpdaterState;
|
|
51
|
-
setState: (newState: Partial<HotUpdaterState>) => void;
|
|
52
|
-
subscribe: (listener: () => void) => () => boolean;
|
|
53
|
-
};
|
|
54
|
-
declare const useHotUpdaterStore: () => HotUpdaterState;
|
|
55
|
-
|
|
56
|
-
declare const HotUpdater: {
|
|
57
|
-
init: (config: HotUpdaterInitConfig) => Promise<void>;
|
|
1
|
+
export type * from "./init";
|
|
2
|
+
export type * from "./native";
|
|
3
|
+
export * from "./store";
|
|
4
|
+
export declare const HotUpdater: {
|
|
5
|
+
init: (config: import("./init").HotUpdaterInitConfig) => Promise<void>;
|
|
58
6
|
reload: () => void;
|
|
59
7
|
getAppVersion: () => Promise<string | null>;
|
|
60
8
|
getBundleId: () => string;
|
|
61
|
-
addListener: <T extends keyof HotUpdaterEvent>(eventName: T, listener: (event: HotUpdaterEvent[T]) => void) => void;
|
|
62
|
-
ensureBundles: (bundle:
|
|
9
|
+
addListener: <T extends keyof import("./native").HotUpdaterEvent>(eventName: T, listener: (event: import("./native").HotUpdaterEvent[T]) => void) => void;
|
|
10
|
+
ensureBundles: (bundle: import("@hot-updater/core").BundleArg, { appVersion, bundleId, platform }: import("@hot-updater/core").GetBundlesArgs, requestHeaders?: Record<string, string>) => Promise<import("@hot-updater/core").Bundle[] | import("@hot-updater/core").UpdateInfo>;
|
|
63
11
|
updateBundle: (bundleId: string, zipUrl: string | null) => Promise<boolean>;
|
|
64
|
-
|
|
12
|
+
getUpdateInfo: (bundles: import("@hot-updater/core").Bundle[], { platform, bundleId, appVersion }: import("@hot-updater/core").GetBundlesArgs) => Promise<import("@hot-updater/core").UpdateInfo | null>;
|
|
65
13
|
/**
|
|
66
14
|
* In production environment, this value will be replaced with a uuidv7.
|
|
67
15
|
*/
|
|
68
16
|
HOT_UPDATER_BUNDLE_ID: string;
|
|
69
17
|
};
|
|
70
|
-
|
|
71
|
-
export { HotUpdater, type HotUpdaterEvent, type HotUpdaterInitConfig, type HotUpdaterState, type HotUpdaterStatus, addListener, getAppVersion, getBundleId, hotUpdaterStore, init, reload, updateBundle, useHotUpdaterStore };
|