@hot-updater/react-native 0.1.6-0 → 0.3.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.
@@ -0,0 +1,2 @@
1
+ import type { Bundle, BundleArg, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
2
+ export declare const ensureUpdateInfo: (source: BundleArg, { appVersion, bundleId, platform }: GetBundlesArgs, requestHeaders?: Record<string, string>) => Promise<Bundle[] | UpdateInfo>;
@@ -0,0 +1,3 @@
1
+ export declare class HotUpdaterError extends Error {
2
+ constructor(message: string);
3
+ }
package/dist/index.d.ts CHANGED
@@ -1,71 +1,14 @@
1
- import * as _hot_updater_core from '@hot-updater/core';
2
- import { BundleArg } from '@hot-updater/core';
3
-
4
- type HotUpdaterEvent = {
5
- onProgress: {
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
+ import { wrap } from "./wrap";
2
+ export type * from "./wrap";
3
+ export type * from "./native";
4
+ export * from "./store";
5
+ export declare const HotUpdater: {
6
+ wrap: typeof wrap;
58
7
  reload: () => void;
59
8
  getAppVersion: () => Promise<string | null>;
60
9
  getBundleId: () => string;
61
- addListener: <T extends keyof HotUpdaterEvent>(eventName: T, listener: (event: HotUpdaterEvent[T]) => void) => void;
62
- ensureBundles: (bundle: _hot_updater_core.BundleArg) => Promise<_hot_updater_core.Bundle[]>;
10
+ addListener: <T extends keyof import("./native").HotUpdaterEvent>(eventName: T, listener: (event: import("./native").HotUpdaterEvent[T]) => void) => void;
11
+ ensureUpdateInfo: (source: 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
12
  updateBundle: (bundleId: string, zipUrl: string | null) => Promise<boolean>;
64
- getUpdateInfo: (bundles: _hot_updater_core.Bundle[], { platform, bundleId, appVersion }: _hot_updater_core.GetBundlesArgs) => Promise<_hot_updater_core.UpdateInfo | null>;
65
- /**
66
- * In production environment, this value will be replaced with a uuidv7.
67
- */
68
- HOT_UPDATER_BUNDLE_ID: string;
13
+ getUpdateInfo: (bundles: import("@hot-updater/core").Bundle[], { platform, bundleId, appVersion }: import("@hot-updater/core").GetBundlesArgs) => Promise<import("@hot-updater/core").UpdateInfo | null>;
69
14
  };
70
-
71
- export { HotUpdater, type HotUpdaterEvent, type HotUpdaterInitConfig, type HotUpdaterState, type HotUpdaterStatus, addListener, getAppVersion, getBundleId, hotUpdaterStore, init, reload, updateBundle, useHotUpdaterStore };