@hot-updater/react-native 0.6.4 → 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
@@ -1,7 +1,7 @@
1
1
  import { checkForUpdate } from "./checkUpdate";
2
2
  import { wrap } from "./wrap";
3
- export type * from "./wrap";
4
- export type * from "./native";
3
+ export type { HotUpdaterConfig } from "./wrap";
4
+ export type { HotUpdaterEvent } from "./native";
5
5
  export * from "./store";
6
6
  export declare const HotUpdater: {
7
7
  wrap: typeof wrap;
@@ -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
  };
package/dist/index.js CHANGED
@@ -1664,9 +1664,9 @@ var __webpack_exports__ = {};
1664
1664
  this.name = "HotUpdaterError";
1665
1665
  }
1666
1666
  }
1667
- const core_namespaceObject = require("@hot-updater/core");
1667
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
1668
1668
  const HotUpdater = {
1669
- HOT_UPDATER_BUNDLE_ID: core_namespaceObject.NIL_UUID
1669
+ HOT_UPDATER_BUNDLE_ID: NIL_UUID
1670
1670
  };
1671
1671
  const LINKING_ERROR = `The package '@hot-updater/react-native' doesn't seem to be linked. Make sure: \n\n` + external_react_native_.Platform.select({
1672
1672
  ios: "- You have run 'pod install'\n",
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  /*! For license information please see index.mjs.LICENSE.txt */
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_native_4af9217e__ from "react-native";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__hot_updater_js_db235456__ from "@hot-updater/js";
4
- import * as __WEBPACK_EXTERNAL_MODULE__hot_updater_core_132f924c__ from "@hot-updater/core";
5
4
  var __webpack_modules__ = {
6
5
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js": function(module, exports, __webpack_require__) {
7
6
  module = __webpack_require__.nmd(module);
@@ -1634,8 +1633,9 @@ class HotUpdaterError extends Error {
1634
1633
  this.name = "HotUpdaterError";
1635
1634
  }
1636
1635
  }
1636
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
1637
1637
  const HotUpdater = {
1638
- HOT_UPDATER_BUNDLE_ID: __WEBPACK_EXTERNAL_MODULE__hot_updater_core_132f924c__.NIL_UUID
1638
+ HOT_UPDATER_BUNDLE_ID: NIL_UUID
1639
1639
  };
1640
1640
  const LINKING_ERROR = `The package '@hot-updater/react-native' doesn't seem to be linked. Make sure: \n\n` + external_react_native_.Platform.select({
1641
1641
  ios: "- You have run 'pod install'\n",
@@ -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.4",
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.4",
82
- "@hot-updater/core": "0.6.4"
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
@@ -10,8 +10,8 @@ import { runUpdateProcess } from "./runUpdateProcess";
10
10
  import { hotUpdaterStore } from "./store";
11
11
  import { wrap } from "./wrap";
12
12
 
13
- export type * from "./wrap";
14
- export type * from "./native";
13
+ export type { HotUpdaterConfig } from "./wrap";
14
+ export type { HotUpdaterEvent } from "./native";
15
15
 
16
16
  export * from "./store";
17
17
 
@@ -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
  };
package/src/native.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { NIL_UUID } from "@hot-updater/core";
2
1
  import { NativeEventEmitter, NativeModules, Platform } from "react-native";
3
2
 
3
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
4
+
4
5
  const HotUpdater = {
5
6
  HOT_UPDATER_BUNDLE_ID: NIL_UUID,
6
7
  };
@@ -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