@hot-updater/react-native 0.6.5 → 0.6.6

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/index.d.ts CHANGED
@@ -10,6 +10,38 @@ export declare const HotUpdater: {
10
10
  getBundleId: () => string;
11
11
  addListener: <T extends keyof import("./native").HotUpdaterEvent>(eventName: T, listener: (event: import("./native").HotUpdaterEvent[T]) => void) => () => void;
12
12
  checkForUpdate: typeof checkForUpdate;
13
+ /**
14
+ * Manually checks and applies updates for the application.
15
+ *
16
+ * @param {RunUpdateProcessConfig} config - Update process configuration
17
+ * @param {string} config.source - Update server URL
18
+ * @param {Record<string, string>} [config.requestHeaders] - Request headers
19
+ * @param {boolean} [config.reloadOnForceUpdate=false] - Whether to automatically reload on force update
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * // Auto reload on force update
24
+ * const result = await HotUpdater.runUpdateProcess({
25
+ * source: "<your-update-server-url>",
26
+ * requestHeaders: {
27
+ * // Add necessary headers
28
+ * },
29
+ * reloadOnForceUpdate: true
30
+ * });
31
+ *
32
+ * // Manually handle reload on force update
33
+ * const result = await HotUpdater.runUpdateProcess({
34
+ * source: "<your-update-server-url>",
35
+ * reloadOnForceUpdate: false
36
+ * });
37
+ *
38
+ * if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
39
+ * HotUpdater.reload();
40
+ * }
41
+ * ```
42
+ *
43
+ * @returns {Promise<RunUpdateProcessResponse>} The result of the update process
44
+ */
13
45
  runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateConfig }: import("./runUpdateProcess").RunUpdateProcessConfig) => Promise<import("./runUpdateProcess").RunUpdateProcessResponse>;
14
46
  updateBundle: (bundleId: string, zipUrl: string | null) => Promise<boolean>;
15
47
  };
@@ -14,4 +14,36 @@ export interface RunUpdateProcessConfig extends CheckForUpdateConfig {
14
14
  */
15
15
  reloadOnForceUpdate?: boolean;
16
16
  }
17
+ /**
18
+ * Manually checks and applies updates for the application.
19
+ *
20
+ * @param {RunUpdateProcessConfig} config - Update process configuration
21
+ * @param {string} config.source - Update server URL
22
+ * @param {Record<string, string>} [config.requestHeaders] - Request headers
23
+ * @param {boolean} [config.reloadOnForceUpdate=false] - Whether to automatically reload on force update
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // Auto reload on force update
28
+ * const result = await HotUpdater.runUpdateProcess({
29
+ * source: "<your-update-server-url>",
30
+ * requestHeaders: {
31
+ * // Add necessary headers
32
+ * },
33
+ * reloadOnForceUpdate: true
34
+ * });
35
+ *
36
+ * // Manually handle reload on force update
37
+ * const result = await HotUpdater.runUpdateProcess({
38
+ * source: "<your-update-server-url>",
39
+ * reloadOnForceUpdate: false
40
+ * });
41
+ *
42
+ * if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
43
+ * HotUpdater.reload();
44
+ * }
45
+ * ```
46
+ *
47
+ * @returns {Promise<RunUpdateProcessResponse>} The result of the update process
48
+ */
17
49
  export declare const runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateConfig }: RunUpdateProcessConfig) => Promise<RunUpdateProcessResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -78,8 +78,8 @@
78
78
  "react-native-builder-bob": "^0.33.1"
79
79
  },
80
80
  "dependencies": {
81
- "@hot-updater/js": "0.6.5",
82
- "@hot-updater/core": "0.6.5"
81
+ "@hot-updater/js": "0.6.6",
82
+ "@hot-updater/core": "0.6.6"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "rslib build",
package/src/index.ts CHANGED
@@ -28,6 +28,38 @@ export const HotUpdater = {
28
28
  addListener,
29
29
 
30
30
  checkForUpdate,
31
+ /**
32
+ * Manually checks and applies updates for the application.
33
+ *
34
+ * @param {RunUpdateProcessConfig} config - Update process configuration
35
+ * @param {string} config.source - Update server URL
36
+ * @param {Record<string, string>} [config.requestHeaders] - Request headers
37
+ * @param {boolean} [config.reloadOnForceUpdate=false] - Whether to automatically reload on force update
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * // Auto reload on force update
42
+ * const result = await HotUpdater.runUpdateProcess({
43
+ * source: "<your-update-server-url>",
44
+ * requestHeaders: {
45
+ * // Add necessary headers
46
+ * },
47
+ * reloadOnForceUpdate: true
48
+ * });
49
+ *
50
+ * // Manually handle reload on force update
51
+ * const result = await HotUpdater.runUpdateProcess({
52
+ * source: "<your-update-server-url>",
53
+ * reloadOnForceUpdate: false
54
+ * });
55
+ *
56
+ * if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
57
+ * HotUpdater.reload();
58
+ * }
59
+ * ```
60
+ *
61
+ * @returns {Promise<RunUpdateProcessResponse>} The result of the update process
62
+ */
31
63
  runUpdateProcess,
32
64
  updateBundle,
33
65
  };
@@ -20,6 +20,38 @@ export interface RunUpdateProcessConfig extends CheckForUpdateConfig {
20
20
  reloadOnForceUpdate?: boolean;
21
21
  }
22
22
 
23
+ /**
24
+ * Manually checks and applies updates for the application.
25
+ *
26
+ * @param {RunUpdateProcessConfig} config - Update process configuration
27
+ * @param {string} config.source - Update server URL
28
+ * @param {Record<string, string>} [config.requestHeaders] - Request headers
29
+ * @param {boolean} [config.reloadOnForceUpdate=false] - Whether to automatically reload on force update
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Auto reload on force update
34
+ * const result = await HotUpdater.runUpdateProcess({
35
+ * source: "<your-update-server-url>",
36
+ * requestHeaders: {
37
+ * // Add necessary headers
38
+ * },
39
+ * reloadOnForceUpdate: true
40
+ * });
41
+ *
42
+ * // Manually handle reload on force update
43
+ * const result = await HotUpdater.runUpdateProcess({
44
+ * source: "<your-update-server-url>",
45
+ * reloadOnForceUpdate: false
46
+ * });
47
+ *
48
+ * if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
49
+ * HotUpdater.reload();
50
+ * }
51
+ * ```
52
+ *
53
+ * @returns {Promise<RunUpdateProcessResponse>} The result of the update process
54
+ */
23
55
  export const runUpdateProcess = async ({
24
56
  reloadOnForceUpdate = false,
25
57
  ...checkForUpdateConfig