@hot-updater/react-native 0.23.1 → 0.24.1
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/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +393 -49
- package/android/src/main/java/com/hotupdater/BundleMetadata.kt +204 -0
- package/android/src/main/java/com/hotupdater/HotUpdater.kt +48 -36
- package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +134 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +168 -95
- package/android/src/main/java/com/hotupdater/OkHttpDownloadService.kt +15 -3
- package/android/src/main/java/com/hotupdater/SignatureVerifier.kt +17 -12
- package/android/src/newarch/HotUpdaterModule.kt +88 -23
- package/android/src/oldarch/HotUpdaterModule.kt +89 -22
- package/android/src/oldarch/HotUpdaterSpec.kt +6 -0
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +401 -77
- package/ios/HotUpdater/Internal/BundleMetadata.swift +177 -0
- package/ios/HotUpdater/Internal/HotUpdater.mm +213 -47
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +96 -25
- package/ios/HotUpdater/Internal/SignatureVerifier.swift +35 -29
- package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +2 -2
- package/ios/HotUpdater/Public/HotUpdater.h +8 -2
- package/lib/commonjs/DefaultResolver.js +38 -0
- package/lib/commonjs/DefaultResolver.js.map +1 -0
- package/lib/commonjs/checkForUpdate.js +33 -45
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/error.js +45 -1
- package/lib/commonjs/error.js.map +1 -1
- package/lib/commonjs/fetchUpdateInfo.js +7 -45
- package/lib/commonjs/fetchUpdateInfo.js.map +1 -1
- package/lib/commonjs/index.js +249 -208
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native.js +103 -3
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
- package/lib/commonjs/types.js +12 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/wrap.js +70 -1
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/module/DefaultResolver.js +34 -0
- package/lib/module/DefaultResolver.js.map +1 -0
- package/lib/module/checkForUpdate.js +34 -43
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/error.js +45 -0
- package/lib/module/error.js.map +1 -1
- package/lib/module/fetchUpdateInfo.js +7 -45
- package/lib/module/fetchUpdateInfo.js.map +1 -1
- package/lib/module/index.js +250 -203
- package/lib/module/index.js.map +1 -1
- package/lib/module/native.js +87 -2
- package/lib/module/native.js.map +1 -1
- package/lib/module/specs/NativeHotUpdater.js.map +1 -1
- package/lib/module/types.js +12 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/wrap.js +71 -2
- package/lib/module/wrap.js.map +1 -1
- package/lib/typescript/commonjs/DefaultResolver.d.ts +10 -0
- package/lib/typescript/commonjs/DefaultResolver.d.ts.map +1 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts +12 -13
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/commonjs/error.d.ts +120 -0
- package/lib/typescript/commonjs/error.d.ts.map +1 -1
- package/lib/typescript/commonjs/fetchUpdateInfo.d.ts +3 -5
- package/lib/typescript/commonjs/fetchUpdateInfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +38 -44
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/native.d.ts +58 -2
- package/lib/typescript/commonjs/native.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +62 -0
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +115 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/wrap.d.ts +132 -7
- package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
- package/lib/typescript/module/DefaultResolver.d.ts +10 -0
- package/lib/typescript/module/DefaultResolver.d.ts.map +1 -0
- package/lib/typescript/module/checkForUpdate.d.ts +12 -13
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/module/error.d.ts +120 -0
- package/lib/typescript/module/error.d.ts.map +1 -1
- package/lib/typescript/module/fetchUpdateInfo.d.ts +3 -5
- package/lib/typescript/module/fetchUpdateInfo.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +38 -44
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/native.d.ts +58 -2
- package/lib/typescript/module/native.d.ts.map +1 -1
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +62 -0
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +115 -0
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/wrap.d.ts +132 -7
- package/lib/typescript/module/wrap.d.ts.map +1 -1
- package/package.json +6 -6
- package/plugin/build/withHotUpdater.js +3 -3
- package/src/DefaultResolver.ts +36 -0
- package/src/checkForUpdate.ts +51 -56
- package/src/error.ts +153 -0
- package/src/fetchUpdateInfo.ts +10 -58
- package/src/index.ts +315 -206
- package/src/native.ts +88 -2
- package/src/specs/NativeHotUpdater.ts +63 -0
- package/src/types.ts +135 -0
- package/src/wrap.tsx +245 -34
- package/android/src/main/java/com/hotupdater/HotUpdaterFactory.kt +0 -52
- package/ios/HotUpdater/Internal/HotUpdaterFactory.swift +0 -24
- package/lib/commonjs/runUpdateProcess.js +0 -69
- package/lib/commonjs/runUpdateProcess.js.map +0 -1
- package/lib/module/runUpdateProcess.js +0 -64
- package/lib/module/runUpdateProcess.js.map +0 -1
- package/lib/typescript/commonjs/runUpdateProcess.d.ts +0 -49
- package/lib/typescript/commonjs/runUpdateProcess.d.ts.map +0 -1
- package/lib/typescript/module/runUpdateProcess.d.ts +0 -49
- package/lib/typescript/module/runUpdateProcess.d.ts.map +0 -1
- package/src/runUpdateProcess.ts +0 -80
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { checkForUpdate } from "./checkForUpdate.js";
|
|
4
|
-
import { getBundleId, reload } from "./native.js";
|
|
5
|
-
/**
|
|
6
|
-
* Manually checks and applies updates for the application.
|
|
7
|
-
*
|
|
8
|
-
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
9
|
-
* @param {string} config.source - Update server URL
|
|
10
|
-
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
11
|
-
* @param {boolean} [config.reloadOnForceUpdate=true] - Whether to automatically reload on force update
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* // Auto reload on force update
|
|
16
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
17
|
-
* source: "<your-update-server-url>",
|
|
18
|
-
* requestHeaders: {
|
|
19
|
-
* // Add necessary headers
|
|
20
|
-
* },
|
|
21
|
-
* reloadOnForceUpdate: true
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* // Manually handle reload on force update
|
|
25
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
26
|
-
* source: "<your-update-server-url>",
|
|
27
|
-
* reloadOnForceUpdate: false
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
31
|
-
* await HotUpdater.reload();
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
36
|
-
*/
|
|
37
|
-
export const runUpdateProcess = async ({
|
|
38
|
-
reloadOnForceUpdate = true,
|
|
39
|
-
...checkForUpdateOptions
|
|
40
|
-
}) => {
|
|
41
|
-
const updateInfo = await checkForUpdate(checkForUpdateOptions);
|
|
42
|
-
if (!updateInfo) {
|
|
43
|
-
return {
|
|
44
|
-
status: "UP_TO_DATE",
|
|
45
|
-
shouldForceUpdate: false,
|
|
46
|
-
message: null,
|
|
47
|
-
id: getBundleId()
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
const isUpdated = await updateInfo.updateBundle();
|
|
51
|
-
if (isUpdated && updateInfo.shouldForceUpdate && reloadOnForceUpdate) {
|
|
52
|
-
await reload();
|
|
53
|
-
}
|
|
54
|
-
if (!isUpdated) {
|
|
55
|
-
throw new Error("New update was found but failed to download the bundle.");
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
status: updateInfo.status,
|
|
59
|
-
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
60
|
-
id: updateInfo.id,
|
|
61
|
-
message: updateInfo.message
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=runUpdateProcess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["checkForUpdate","getBundleId","reload","runUpdateProcess","reloadOnForceUpdate","checkForUpdateOptions","updateInfo","status","shouldForceUpdate","message","id","isUpdated","updateBundle","Error"],"sourceRoot":"../../src","sources":["runUpdateProcess.ts"],"mappings":";;AAAA,SAAqCA,cAAc,QAAQ,qBAAkB;AAC7E,SAASC,WAAW,EAAEC,MAAM,QAAQ,aAAU;AAkB9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAO;EACrCC,mBAAmB,GAAG,IAAI;EAC1B,GAAGC;AACoB,CAAC,KAAwC;EAChE,MAAMC,UAAU,GAAG,MAAMN,cAAc,CAACK,qBAAqB,CAAC;EAC9D,IAAI,CAACC,UAAU,EAAE;IACf,OAAO;MACLC,MAAM,EAAE,YAAY;MACpBC,iBAAiB,EAAE,KAAK;MACxBC,OAAO,EAAE,IAAI;MACbC,EAAE,EAAET,WAAW,CAAC;IAClB,CAAC;EACH;EAEA,MAAMU,SAAS,GAAG,MAAML,UAAU,CAACM,YAAY,CAAC,CAAC;EACjD,IAAID,SAAS,IAAIL,UAAU,CAACE,iBAAiB,IAAIJ,mBAAmB,EAAE;IACpE,MAAMF,MAAM,CAAC,CAAC;EAChB;EAEA,IAAI,CAACS,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAAC,yDAAyD,CAAC;EAC5E;EACA,OAAO;IACLN,MAAM,EAAED,UAAU,CAACC,MAAM;IACzBC,iBAAiB,EAAEF,UAAU,CAACE,iBAAiB;IAC/CE,EAAE,EAAEJ,UAAU,CAACI,EAAE;IACjBD,OAAO,EAAEH,UAAU,CAACG;EACtB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
2
|
-
export interface RunUpdateProcessResponse {
|
|
3
|
-
status: "ROLLBACK" | "UPDATE" | "UP_TO_DATE";
|
|
4
|
-
shouldForceUpdate: boolean;
|
|
5
|
-
message: string | null;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
export interface RunUpdateProcessOptions extends CheckForUpdateOptions {
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
11
|
-
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
12
|
-
* @default true
|
|
13
|
-
*/
|
|
14
|
-
reloadOnForceUpdate?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Manually checks and applies updates for the application.
|
|
18
|
-
*
|
|
19
|
-
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
20
|
-
* @param {string} config.source - Update server URL
|
|
21
|
-
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
22
|
-
* @param {boolean} [config.reloadOnForceUpdate=true] - Whether to automatically reload on force update
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* // Auto reload on force update
|
|
27
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
28
|
-
* source: "<your-update-server-url>",
|
|
29
|
-
* requestHeaders: {
|
|
30
|
-
* // Add necessary headers
|
|
31
|
-
* },
|
|
32
|
-
* reloadOnForceUpdate: true
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // Manually handle reload on force update
|
|
36
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
37
|
-
* source: "<your-update-server-url>",
|
|
38
|
-
* reloadOnForceUpdate: false
|
|
39
|
-
* });
|
|
40
|
-
*
|
|
41
|
-
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
42
|
-
* await HotUpdater.reload();
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
47
|
-
*/
|
|
48
|
-
export declare const runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateOptions }: RunUpdateProcessOptions) => Promise<RunUpdateProcessResponse>;
|
|
49
|
-
//# sourceMappingURL=runUpdateProcess.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runUpdateProcess.d.ts","sourceRoot":"","sources":["../../../src/runUpdateProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,GAAU,mDAGpC,uBAAuB,KAAG,OAAO,CAAC,wBAAwB,CAyB5D,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
2
|
-
export interface RunUpdateProcessResponse {
|
|
3
|
-
status: "ROLLBACK" | "UPDATE" | "UP_TO_DATE";
|
|
4
|
-
shouldForceUpdate: boolean;
|
|
5
|
-
message: string | null;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
export interface RunUpdateProcessOptions extends CheckForUpdateOptions {
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
11
|
-
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
12
|
-
* @default true
|
|
13
|
-
*/
|
|
14
|
-
reloadOnForceUpdate?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Manually checks and applies updates for the application.
|
|
18
|
-
*
|
|
19
|
-
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
20
|
-
* @param {string} config.source - Update server URL
|
|
21
|
-
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
22
|
-
* @param {boolean} [config.reloadOnForceUpdate=true] - Whether to automatically reload on force update
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* // Auto reload on force update
|
|
27
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
28
|
-
* source: "<your-update-server-url>",
|
|
29
|
-
* requestHeaders: {
|
|
30
|
-
* // Add necessary headers
|
|
31
|
-
* },
|
|
32
|
-
* reloadOnForceUpdate: true
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // Manually handle reload on force update
|
|
36
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
37
|
-
* source: "<your-update-server-url>",
|
|
38
|
-
* reloadOnForceUpdate: false
|
|
39
|
-
* });
|
|
40
|
-
*
|
|
41
|
-
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
42
|
-
* await HotUpdater.reload();
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
47
|
-
*/
|
|
48
|
-
export declare const runUpdateProcess: ({ reloadOnForceUpdate, ...checkForUpdateOptions }: RunUpdateProcessOptions) => Promise<RunUpdateProcessResponse>;
|
|
49
|
-
//# sourceMappingURL=runUpdateProcess.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runUpdateProcess.d.ts","sourceRoot":"","sources":["../../../src/runUpdateProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC7C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,GAAU,mDAGpC,uBAAuB,KAAG,OAAO,CAAC,wBAAwB,CAyB5D,CAAC"}
|
package/src/runUpdateProcess.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { type CheckForUpdateOptions, checkForUpdate } from "./checkForUpdate";
|
|
2
|
-
import { getBundleId, reload } from "./native";
|
|
3
|
-
|
|
4
|
-
export interface RunUpdateProcessResponse {
|
|
5
|
-
status: "ROLLBACK" | "UPDATE" | "UP_TO_DATE";
|
|
6
|
-
shouldForceUpdate: boolean;
|
|
7
|
-
message: string | null;
|
|
8
|
-
id: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RunUpdateProcessOptions extends CheckForUpdateOptions {
|
|
12
|
-
/**
|
|
13
|
-
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
14
|
-
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
15
|
-
* @default true
|
|
16
|
-
*/
|
|
17
|
-
reloadOnForceUpdate?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Manually checks and applies updates for the application.
|
|
22
|
-
*
|
|
23
|
-
* @param {RunUpdateProcessConfig} config - Update process configuration
|
|
24
|
-
* @param {string} config.source - Update server URL
|
|
25
|
-
* @param {Record<string, string>} [config.requestHeaders] - Request headers
|
|
26
|
-
* @param {boolean} [config.reloadOnForceUpdate=true] - Whether to automatically reload on force update
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* // Auto reload on force update
|
|
31
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
32
|
-
* source: "<your-update-server-url>",
|
|
33
|
-
* requestHeaders: {
|
|
34
|
-
* // Add necessary headers
|
|
35
|
-
* },
|
|
36
|
-
* reloadOnForceUpdate: true
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* // Manually handle reload on force update
|
|
40
|
-
* const result = await HotUpdater.runUpdateProcess({
|
|
41
|
-
* source: "<your-update-server-url>",
|
|
42
|
-
* reloadOnForceUpdate: false
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* if(result.status !== "UP_TO_DATE" && result.shouldForceUpdate) {
|
|
46
|
-
* await HotUpdater.reload();
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @returns {Promise<RunUpdateProcessResponse>} The result of the update process
|
|
51
|
-
*/
|
|
52
|
-
export const runUpdateProcess = async ({
|
|
53
|
-
reloadOnForceUpdate = true,
|
|
54
|
-
...checkForUpdateOptions
|
|
55
|
-
}: RunUpdateProcessOptions): Promise<RunUpdateProcessResponse> => {
|
|
56
|
-
const updateInfo = await checkForUpdate(checkForUpdateOptions);
|
|
57
|
-
if (!updateInfo) {
|
|
58
|
-
return {
|
|
59
|
-
status: "UP_TO_DATE",
|
|
60
|
-
shouldForceUpdate: false,
|
|
61
|
-
message: null,
|
|
62
|
-
id: getBundleId(),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const isUpdated = await updateInfo.updateBundle();
|
|
67
|
-
if (isUpdated && updateInfo.shouldForceUpdate && reloadOnForceUpdate) {
|
|
68
|
-
await reload();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!isUpdated) {
|
|
72
|
-
throw new Error("New update was found but failed to download the bundle.");
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
status: updateInfo.status,
|
|
76
|
-
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
77
|
-
id: updateInfo.id,
|
|
78
|
-
message: updateInfo.message,
|
|
79
|
-
};
|
|
80
|
-
};
|