@otakit/capacitor-updater 2.0.1 → 2.1.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/{UpdatekitUpdater.podspec → OtaKitUpdater.podspec} +1 -1
- package/README.md +165 -130
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/BundleInfo.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/BundleStatus.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/BundleStore.java +38 -9
- package/android/src/main/java/com/{updatekit → otakit}/updater/DateUtils.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/DeviceEventClient.java +3 -4
- package/android/src/main/java/com/{updatekit → otakit}/updater/HashUtils.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/HostedManifestKeys.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/ManifestClient.java +32 -15
- package/android/src/main/java/com/{updatekit → otakit}/updater/ManifestVerifier.java +1 -1
- package/android/src/main/java/com/otakit/updater/UpdaterCoordinator.java +726 -0
- package/android/src/main/java/com/otakit/updater/UpdaterPlugin.java +1191 -0
- package/android/src/main/java/com/{updatekit → otakit}/updater/ZipUtils.java +1 -1
- package/dist/esm/definitions.d.ts +48 -105
- package/dist/esm/definitions.d.ts.map +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -60
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +7 -11
- package/dist/esm/web.d.ts.map +1 -1
- package/dist/esm/web.js +8 -14
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +14 -74
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +14 -74
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/UpdaterPlugin/BundleStore.swift +28 -6
- package/ios/Sources/UpdaterPlugin/Downloader.swift +1 -1
- package/ios/Sources/UpdaterPlugin/ManifestClient.swift +8 -4
- package/ios/Sources/UpdaterPlugin/UpdaterCoordinator.swift +635 -0
- package/ios/Sources/UpdaterPlugin/UpdaterPlugin.m +3 -5
- package/ios/Sources/UpdaterPlugin/UpdaterPlugin.swift +506 -551
- package/package.json +2 -2
- package/android/src/main/java/com/updatekit/updater/UpdaterPlugin.java +0 -1191
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
1
|
/**
|
|
3
2
|
* Bundle status enum.
|
|
4
3
|
*/
|
|
@@ -43,27 +42,40 @@ export interface LatestVersion {
|
|
|
43
42
|
sha256: string;
|
|
44
43
|
/** Bundle size in bytes */
|
|
45
44
|
size: number;
|
|
46
|
-
/** True when this exact update is already staged locally. */
|
|
47
|
-
downloaded?: boolean;
|
|
48
45
|
/** Release history ID associated with this manifest */
|
|
49
46
|
releaseId: string;
|
|
50
47
|
}
|
|
51
|
-
export interface BundleListResult {
|
|
52
|
-
bundles: BundleInfo[];
|
|
53
|
-
}
|
|
54
48
|
export interface OtaKitState {
|
|
55
49
|
current: BundleInfo;
|
|
50
|
+
fallback: BundleInfo;
|
|
56
51
|
staged: BundleInfo | null;
|
|
57
52
|
builtinVersion: string;
|
|
58
53
|
}
|
|
59
|
-
export
|
|
60
|
-
fallback: BundleInfo;
|
|
61
|
-
}
|
|
62
|
-
export type OtaKitUpdateMode = 'manual' | 'next-launch' | 'next-resume' | 'immediate';
|
|
54
|
+
export type OtaKitPolicy = 'off' | 'shadow' | 'apply-staged' | 'immediate';
|
|
63
55
|
export interface OtaKitManifestKey {
|
|
64
56
|
kid: string;
|
|
65
57
|
key: string;
|
|
66
58
|
}
|
|
59
|
+
export interface CheckNoUpdateResult {
|
|
60
|
+
kind: 'no_update';
|
|
61
|
+
}
|
|
62
|
+
export interface CheckAlreadyStagedResult {
|
|
63
|
+
kind: 'already_staged';
|
|
64
|
+
latest: LatestVersion;
|
|
65
|
+
}
|
|
66
|
+
export interface CheckUpdateAvailableResult {
|
|
67
|
+
kind: 'update_available';
|
|
68
|
+
latest: LatestVersion;
|
|
69
|
+
}
|
|
70
|
+
export type CheckResult = CheckNoUpdateResult | CheckAlreadyStagedResult | CheckUpdateAvailableResult;
|
|
71
|
+
export interface DownloadNoUpdateResult {
|
|
72
|
+
kind: 'no_update';
|
|
73
|
+
}
|
|
74
|
+
export interface DownloadStagedResult {
|
|
75
|
+
kind: 'staged';
|
|
76
|
+
bundle: BundleInfo;
|
|
77
|
+
}
|
|
78
|
+
export type DownloadResult = DownloadNoUpdateResult | DownloadStagedResult;
|
|
67
79
|
/**
|
|
68
80
|
* Plugin configuration for capacitor.config.ts.
|
|
69
81
|
*/
|
|
@@ -74,12 +86,17 @@ export interface OtaKitConfig {
|
|
|
74
86
|
channel?: string;
|
|
75
87
|
/** Optional native compatibility lane. Set this when a new store build should start a new OTA line. */
|
|
76
88
|
runtimeVersion?: string;
|
|
77
|
-
/**
|
|
78
|
-
|
|
89
|
+
/** Cold-start policy after runtime has already been resolved. Defaults to apply-staged. */
|
|
90
|
+
launchPolicy?: OtaKitPolicy;
|
|
91
|
+
/** Foreground resume policy. Defaults to shadow. */
|
|
92
|
+
resumePolicy?: OtaKitPolicy;
|
|
93
|
+
/** Cold-start policy when runtimeVersion changes or resolves for the first time. Defaults to immediate. */
|
|
94
|
+
runtimePolicy?: OtaKitPolicy;
|
|
79
95
|
/**
|
|
80
|
-
* Minimum milliseconds between automatic
|
|
81
|
-
* Applies only to
|
|
82
|
-
*
|
|
96
|
+
* Minimum milliseconds between automatic background resume checks.
|
|
97
|
+
* Applies only to `resumePolicy: "shadow"` and `resumePolicy: "apply-staged"`
|
|
98
|
+
* when no staged bundle is already waiting. Defaults to 600000 (10 min).
|
|
99
|
+
* Set to 0 or a negative value to disable resume throttling.
|
|
83
100
|
*/
|
|
84
101
|
checkInterval?: number;
|
|
85
102
|
/** Milliseconds to wait for notifyAppReady(). Defaults to 10000. */
|
|
@@ -95,129 +112,55 @@ export interface OtaKitConfig {
|
|
|
95
112
|
/** Allow HTTP only for localhost development. Defaults to false. */
|
|
96
113
|
allowInsecureUrls?: boolean;
|
|
97
114
|
}
|
|
98
|
-
export interface OtaKitDebugApi {
|
|
99
|
-
/**
|
|
100
|
-
* Reset to the builtin bundle and reload the WebView.
|
|
101
|
-
*
|
|
102
|
-
* **WARNING: TERMINAL OPERATION**
|
|
103
|
-
* Code after this call may not execute. The WebView will reload.
|
|
104
|
-
*/
|
|
105
|
-
reset(): Promise<void>;
|
|
106
|
-
/**
|
|
107
|
-
* List downloaded OTA bundles stored on the device.
|
|
108
|
-
*/
|
|
109
|
-
listBundles(): Promise<BundleListResult>;
|
|
110
|
-
/**
|
|
111
|
-
* Delete a downloaded bundle that is not active or protected by rollback.
|
|
112
|
-
*/
|
|
113
|
-
deleteBundle(options: {
|
|
114
|
-
bundleId: string;
|
|
115
|
-
}): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Get the most recent failed update information for diagnostics.
|
|
118
|
-
*/
|
|
119
|
-
getLastFailure(): Promise<BundleInfo | null>;
|
|
120
|
-
}
|
|
121
|
-
export type OtaKitEvent = 'downloadStarted' | 'downloadComplete' | 'downloadFailed' | 'updateAvailable' | 'noUpdateAvailable' | 'appReady' | 'rollback';
|
|
122
115
|
export interface OtaKitPlugin {
|
|
123
116
|
/**
|
|
124
|
-
* Inspect the current updater state
|
|
117
|
+
* Inspect the current updater state.
|
|
125
118
|
*/
|
|
126
119
|
getState(): Promise<OtaKitState>;
|
|
127
120
|
/**
|
|
128
121
|
* Check the configured channel for a newer version without downloading it.
|
|
129
|
-
* When `downloaded` is true, the latest update is already staged locally.
|
|
130
122
|
*/
|
|
131
|
-
check(): Promise<
|
|
123
|
+
check(): Promise<CheckResult>;
|
|
132
124
|
/**
|
|
133
|
-
* Check the configured channel and
|
|
134
|
-
* The latest bundle is staged for later activation. If it is already staged,
|
|
135
|
-
* the existing staged bundle is returned without re-downloading it.
|
|
125
|
+
* Check the configured channel and ensure the latest bundle is staged locally.
|
|
136
126
|
*/
|
|
137
|
-
download(): Promise<
|
|
127
|
+
download(): Promise<DownloadResult>;
|
|
138
128
|
/**
|
|
139
129
|
* Activate the currently staged bundle and reload the WebView.
|
|
140
130
|
*
|
|
141
131
|
* **WARNING: TERMINAL OPERATION**
|
|
132
|
+
* On success this call does not resolve back into the old JS context.
|
|
142
133
|
* Code after this call may not execute. The WebView will reload.
|
|
143
134
|
*/
|
|
144
135
|
apply(): Promise<void>;
|
|
145
136
|
/**
|
|
146
137
|
* Friendly manual-mode helper.
|
|
147
|
-
* Bring the app to the newest available update now
|
|
148
|
-
*
|
|
149
|
-
* Otherwise download it and apply it.
|
|
138
|
+
* Bring the app to the newest available update now using one native
|
|
139
|
+
* immediate-flow operation.
|
|
150
140
|
*
|
|
151
141
|
* **WARNING: TERMINAL OPERATION**
|
|
142
|
+
* If an update is applied, this call does not resolve back into the old JS context.
|
|
152
143
|
* Code after this call may not execute if an update is applied.
|
|
153
144
|
*/
|
|
154
145
|
update(): Promise<void>;
|
|
155
146
|
/**
|
|
156
147
|
* **CRITICAL**: Call this when your app has successfully started.
|
|
157
148
|
* Must be called within appReadyTimeout (default 10s) or rollback occurs.
|
|
158
|
-
*
|
|
159
|
-
* This confirms the current bundle is working and:
|
|
160
|
-
* - Marks the bundle as SUCCESS
|
|
161
|
-
* - Updates the fallback bundle pointer
|
|
162
|
-
* - Removes the older fallback bundle once the new bundle proves healthy
|
|
163
149
|
*/
|
|
164
150
|
notifyAppReady(): Promise<void>;
|
|
165
151
|
/**
|
|
166
|
-
*
|
|
167
|
-
|
|
168
|
-
debug: OtaKitDebugApi;
|
|
169
|
-
/**
|
|
170
|
-
* Add listener for update events
|
|
171
|
-
*/
|
|
172
|
-
addListener(event: 'downloadStarted', callback: (data: {
|
|
173
|
-
version: string;
|
|
174
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
175
|
-
addListener(event: 'downloadComplete', callback: (data: BundleInfo) => void): Promise<PluginListenerHandle>;
|
|
176
|
-
addListener(event: 'downloadFailed', callback: (data: {
|
|
177
|
-
version: string;
|
|
178
|
-
error: string;
|
|
179
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
180
|
-
addListener(event: 'updateAvailable', callback: (data: LatestVersion) => void): Promise<PluginListenerHandle>;
|
|
181
|
-
addListener(event: 'noUpdateAvailable', callback: () => void): Promise<PluginListenerHandle>;
|
|
182
|
-
addListener(event: 'appReady', callback: (data: BundleInfo) => void): Promise<PluginListenerHandle>;
|
|
183
|
-
addListener(event: 'rollback', callback: (data: {
|
|
184
|
-
from: BundleInfo;
|
|
185
|
-
to: BundleInfo;
|
|
186
|
-
reason?: string;
|
|
187
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
188
|
-
/**
|
|
189
|
-
* Remove all listeners for this plugin
|
|
152
|
+
* Get the most recent failed update information for diagnostics.
|
|
153
|
+
* Returns null if no failure has occurred.
|
|
190
154
|
*/
|
|
191
|
-
|
|
155
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
192
156
|
}
|
|
193
157
|
export interface OtaKitBridgePlugin {
|
|
194
|
-
|
|
195
|
-
|
|
158
|
+
getState(): Promise<OtaKitState>;
|
|
159
|
+
check(): Promise<CheckResult>;
|
|
160
|
+
download(): Promise<DownloadResult>;
|
|
196
161
|
apply(): Promise<void>;
|
|
162
|
+
update(): Promise<void>;
|
|
197
163
|
notifyAppReady(): Promise<void>;
|
|
198
|
-
|
|
199
|
-
debugReset(): Promise<void>;
|
|
200
|
-
debugListBundles(): Promise<BundleListResult>;
|
|
201
|
-
debugDeleteBundle(options: {
|
|
202
|
-
bundleId: string;
|
|
203
|
-
}): Promise<void>;
|
|
204
|
-
debugGetLastFailure(): Promise<BundleInfo | null>;
|
|
205
|
-
addListener(event: 'downloadStarted', callback: (data: {
|
|
206
|
-
version: string;
|
|
207
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
208
|
-
addListener(event: 'downloadComplete', callback: (data: BundleInfo) => void): Promise<PluginListenerHandle>;
|
|
209
|
-
addListener(event: 'downloadFailed', callback: (data: {
|
|
210
|
-
version: string;
|
|
211
|
-
error: string;
|
|
212
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
213
|
-
addListener(event: 'updateAvailable', callback: (data: LatestVersion) => void): Promise<PluginListenerHandle>;
|
|
214
|
-
addListener(event: 'noUpdateAvailable', callback: () => void): Promise<PluginListenerHandle>;
|
|
215
|
-
addListener(event: 'appReady', callback: (data: BundleInfo) => void): Promise<PluginListenerHandle>;
|
|
216
|
-
addListener(event: 'rollback', callback: (data: {
|
|
217
|
-
from: BundleInfo;
|
|
218
|
-
to: BundleInfo;
|
|
219
|
-
reason?: string;
|
|
220
|
-
}) => void): Promise<PluginListenerHandle>;
|
|
221
|
-
removeAllListeners(): Promise<void>;
|
|
164
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
222
165
|
}
|
|
223
166
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IACtB,+BAA+B;IAC/B,OAAO,YAAY;IACnB,iDAAiD;IACjD,OAAO,YAAY;IACnB,mCAAmC;IACnC,KAAK,UAAU;IACf,wBAAwB;IACxB,OAAO,YAAY;IACnB,yDAAyD;IACzD,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACt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H,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACjC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,YAWX;AAXD,WAAY,YAAY;IACtB,+BAA+B;IAC/B,mCAAmB,CAAA;IACnB,iDAAiD;IACjD,mCAAmB,CAAA;IACnB,mCAAmC;IACnC,+BAAe,CAAA;IACf,wBAAwB;IACxB,mCAAmB,CAAA;IACnB,yDAAyD;IACzD,+BAAe,CAAA;AACjB,CAAC,EAXW,YAAY,KAAZ,YAAY,QAWvB"}
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,YAAY,EAAc,MAAM,eAAe,CAAC;AAqBlF,QAAA,MAAM,MAAM,EAAE,YASb,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -15,68 +15,14 @@ function isEmptyObject(obj) {
|
|
|
15
15
|
function normalizeNullable(value) {
|
|
16
16
|
return isEmptyObject(value) ? null : value;
|
|
17
17
|
}
|
|
18
|
-
function toPublicState(value) {
|
|
19
|
-
return {
|
|
20
|
-
current: value.current,
|
|
21
|
-
staged: value.staged,
|
|
22
|
-
builtinVersion: value.builtinVersion,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
async function getState() {
|
|
26
|
-
return toPublicState(await NativeOtaKit.debugGetState());
|
|
27
|
-
}
|
|
28
|
-
async function check() {
|
|
29
|
-
return normalizeNullable(await NativeOtaKit.check());
|
|
30
|
-
}
|
|
31
|
-
async function download() {
|
|
32
|
-
return normalizeNullable(await NativeOtaKit.download());
|
|
33
|
-
}
|
|
34
|
-
function apply() {
|
|
35
|
-
return NativeOtaKit.apply();
|
|
36
|
-
}
|
|
37
|
-
async function update() {
|
|
38
|
-
const state = await getState();
|
|
39
|
-
let latest;
|
|
40
|
-
try {
|
|
41
|
-
latest = await check();
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
if (state.staged) {
|
|
45
|
-
await apply();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
if (latest) {
|
|
51
|
-
if (latest.downloaded) {
|
|
52
|
-
await apply();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const bundle = await download();
|
|
56
|
-
if (bundle) {
|
|
57
|
-
await apply();
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (state.staged) {
|
|
62
|
-
await apply();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
18
|
const OtaKit = {
|
|
66
|
-
getState,
|
|
67
|
-
check,
|
|
68
|
-
download,
|
|
69
|
-
apply,
|
|
70
|
-
update,
|
|
19
|
+
getState: () => NativeOtaKit.getState(),
|
|
20
|
+
check: () => NativeOtaKit.check(),
|
|
21
|
+
download: () => NativeOtaKit.download(),
|
|
22
|
+
apply: () => NativeOtaKit.apply(),
|
|
23
|
+
update: () => NativeOtaKit.update(),
|
|
71
24
|
notifyAppReady: () => NativeOtaKit.notifyAppReady(),
|
|
72
|
-
|
|
73
|
-
reset: () => NativeOtaKit.debugReset(),
|
|
74
|
-
listBundles: () => NativeOtaKit.debugListBundles(),
|
|
75
|
-
deleteBundle: (options) => NativeOtaKit.debugDeleteBundle(options),
|
|
76
|
-
getLastFailure: async () => normalizeNullable(await NativeOtaKit.debugGetLastFailure()),
|
|
77
|
-
},
|
|
78
|
-
addListener: NativeOtaKit.addListener.bind(NativeOtaKit),
|
|
79
|
-
removeAllListeners: () => NativeOtaKit.removeAllListeners(),
|
|
25
|
+
getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),
|
|
80
26
|
};
|
|
81
27
|
export * from './definitions';
|
|
82
28
|
export { OtaKit };
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,YAAY,GAAG,cAAc,CAAqB,QAAQ,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;CAC1D,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,aAAa,CAAC,GAAY;IACjC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAI,KAAQ;IACpC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,MAAM,MAAM,GAAiB;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE;IACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE;IACnC,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE;IACnD,cAAc,EAAE,KAAK,IAAgC,EAAE,CACrD,iBAAiB,CAAC,MAAM,YAAY,CAAC,cAAc,EAAE,CAAC;CACzD,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { OtaKitBridgePlugin, BundleInfo,
|
|
2
|
+
import type { OtaKitBridgePlugin, BundleInfo, CheckResult, DownloadResult, OtaKitState } from './definitions';
|
|
3
3
|
/**
|
|
4
4
|
* Web implementation of the native bridge.
|
|
5
|
-
* Most methods are no-ops since OTA updates don't apply to web
|
|
5
|
+
* Most methods are no-ops since OTA updates don't apply to web.
|
|
6
6
|
*/
|
|
7
7
|
export declare class OtaKitWeb extends WebPlugin implements OtaKitBridgePlugin {
|
|
8
8
|
private readonly BUILTIN_BUNDLE;
|
|
9
|
-
|
|
10
|
-
check(): Promise<
|
|
11
|
-
download(): Promise<
|
|
9
|
+
getState(): Promise<OtaKitState>;
|
|
10
|
+
check(): Promise<CheckResult>;
|
|
11
|
+
download(): Promise<DownloadResult>;
|
|
12
12
|
apply(): Promise<void>;
|
|
13
|
+
update(): Promise<void>;
|
|
13
14
|
notifyAppReady(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
debugListBundles(): Promise<BundleListResult>;
|
|
16
|
-
debugDeleteBundle(_options: {
|
|
17
|
-
bundleId: string;
|
|
18
|
-
}): Promise<void>;
|
|
19
|
-
debugGetLastFailure(): Promise<BundleInfo | null>;
|
|
15
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
20
16
|
}
|
|
21
17
|
//# sourceMappingURL=web.d.ts.map
|
package/dist/esm/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EAEV,WAAW,EACX,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,qBAAa,SAAU,SAAQ,SAAU,YAAW,kBAAkB;IACpE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAI7B;IAEI,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAShC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAK7B,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAKnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAGnD"}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
/**
|
|
3
3
|
* Web implementation of the native bridge.
|
|
4
|
-
* Most methods are no-ops since OTA updates don't apply to web
|
|
4
|
+
* Most methods are no-ops since OTA updates don't apply to web.
|
|
5
5
|
*/
|
|
6
6
|
export class OtaKitWeb extends WebPlugin {
|
|
7
7
|
BUILTIN_BUNDLE = {
|
|
@@ -9,7 +9,7 @@ export class OtaKitWeb extends WebPlugin {
|
|
|
9
9
|
version: '0.0.0',
|
|
10
10
|
status: 'builtin',
|
|
11
11
|
};
|
|
12
|
-
async
|
|
12
|
+
async getState() {
|
|
13
13
|
return {
|
|
14
14
|
current: this.BUILTIN_BUNDLE,
|
|
15
15
|
fallback: this.BUILTIN_BUNDLE,
|
|
@@ -19,29 +19,23 @@ export class OtaKitWeb extends WebPlugin {
|
|
|
19
19
|
}
|
|
20
20
|
async check() {
|
|
21
21
|
console.warn('OtaKit.check() is not supported on web');
|
|
22
|
-
return
|
|
22
|
+
return { kind: 'no_update' };
|
|
23
23
|
}
|
|
24
24
|
async download() {
|
|
25
25
|
console.warn('OtaKit.download() is not supported on web');
|
|
26
|
-
return
|
|
26
|
+
return { kind: 'no_update' };
|
|
27
27
|
}
|
|
28
28
|
async apply() {
|
|
29
29
|
console.warn('OtaKit.apply() is not supported on web');
|
|
30
30
|
throw new Error('OtaKit.apply() is not supported on web');
|
|
31
31
|
}
|
|
32
|
+
async update() {
|
|
33
|
+
await this.download();
|
|
34
|
+
}
|
|
32
35
|
async notifyAppReady() {
|
|
33
36
|
// No-op on web, but don't warn - apps should call this unconditionally
|
|
34
37
|
}
|
|
35
|
-
async
|
|
36
|
-
console.warn('OtaKit.debug.reset() is not supported on web');
|
|
37
|
-
}
|
|
38
|
-
async debugListBundles() {
|
|
39
|
-
return { bundles: [] };
|
|
40
|
-
}
|
|
41
|
-
async debugDeleteBundle(_options) {
|
|
42
|
-
console.warn('OtaKit.debug.deleteBundle() is not supported on web');
|
|
43
|
-
}
|
|
44
|
-
async debugGetLastFailure() {
|
|
38
|
+
async getLastFailure() {
|
|
45
39
|
return null;
|
|
46
40
|
}
|
|
47
41
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACrB,cAAc,GAAe;QAC5C,EAAE,EAAE,SAAS;QACb,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,SAAyB;KAClC,CAAC;IAEF,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACrB,cAAc,GAAe;QAC5C,EAAE,EAAE,SAAS;QACb,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,SAAyB;KAClC,CAAC;IAEF,KAAK,CAAC,QAAQ;QACZ,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,cAAc;YAC5B,QAAQ,EAAE,IAAI,CAAC,cAAc;YAC7B,MAAM,EAAE,IAAI;YACZ,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO;SAC5C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,uEAAuE;IACzE,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -35,73 +35,19 @@ function isEmptyObject(obj) {
|
|
|
35
35
|
function normalizeNullable(value) {
|
|
36
36
|
return isEmptyObject(value) ? null : value;
|
|
37
37
|
}
|
|
38
|
-
function toPublicState(value) {
|
|
39
|
-
return {
|
|
40
|
-
current: value.current,
|
|
41
|
-
staged: value.staged,
|
|
42
|
-
builtinVersion: value.builtinVersion,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async function getState() {
|
|
46
|
-
return toPublicState(await NativeOtaKit.debugGetState());
|
|
47
|
-
}
|
|
48
|
-
async function check() {
|
|
49
|
-
return normalizeNullable(await NativeOtaKit.check());
|
|
50
|
-
}
|
|
51
|
-
async function download() {
|
|
52
|
-
return normalizeNullable(await NativeOtaKit.download());
|
|
53
|
-
}
|
|
54
|
-
function apply() {
|
|
55
|
-
return NativeOtaKit.apply();
|
|
56
|
-
}
|
|
57
|
-
async function update() {
|
|
58
|
-
const state = await getState();
|
|
59
|
-
let latest;
|
|
60
|
-
try {
|
|
61
|
-
latest = await check();
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
if (state.staged) {
|
|
65
|
-
await apply();
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
if (latest) {
|
|
71
|
-
if (latest.downloaded) {
|
|
72
|
-
await apply();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const bundle = await download();
|
|
76
|
-
if (bundle) {
|
|
77
|
-
await apply();
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (state.staged) {
|
|
82
|
-
await apply();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
38
|
const OtaKit = {
|
|
86
|
-
getState,
|
|
87
|
-
check,
|
|
88
|
-
download,
|
|
89
|
-
apply,
|
|
90
|
-
update,
|
|
39
|
+
getState: () => NativeOtaKit.getState(),
|
|
40
|
+
check: () => NativeOtaKit.check(),
|
|
41
|
+
download: () => NativeOtaKit.download(),
|
|
42
|
+
apply: () => NativeOtaKit.apply(),
|
|
43
|
+
update: () => NativeOtaKit.update(),
|
|
91
44
|
notifyAppReady: () => NativeOtaKit.notifyAppReady(),
|
|
92
|
-
|
|
93
|
-
reset: () => NativeOtaKit.debugReset(),
|
|
94
|
-
listBundles: () => NativeOtaKit.debugListBundles(),
|
|
95
|
-
deleteBundle: (options) => NativeOtaKit.debugDeleteBundle(options),
|
|
96
|
-
getLastFailure: async () => normalizeNullable(await NativeOtaKit.debugGetLastFailure()),
|
|
97
|
-
},
|
|
98
|
-
addListener: NativeOtaKit.addListener.bind(NativeOtaKit),
|
|
99
|
-
removeAllListeners: () => NativeOtaKit.removeAllListeners(),
|
|
45
|
+
getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),
|
|
100
46
|
};
|
|
101
47
|
|
|
102
48
|
/**
|
|
103
49
|
* Web implementation of the native bridge.
|
|
104
|
-
* Most methods are no-ops since OTA updates don't apply to web
|
|
50
|
+
* Most methods are no-ops since OTA updates don't apply to web.
|
|
105
51
|
*/
|
|
106
52
|
class OtaKitWeb extends core.WebPlugin {
|
|
107
53
|
BUILTIN_BUNDLE = {
|
|
@@ -109,7 +55,7 @@ class OtaKitWeb extends core.WebPlugin {
|
|
|
109
55
|
version: '0.0.0',
|
|
110
56
|
status: 'builtin',
|
|
111
57
|
};
|
|
112
|
-
async
|
|
58
|
+
async getState() {
|
|
113
59
|
return {
|
|
114
60
|
current: this.BUILTIN_BUNDLE,
|
|
115
61
|
fallback: this.BUILTIN_BUNDLE,
|
|
@@ -119,29 +65,23 @@ class OtaKitWeb extends core.WebPlugin {
|
|
|
119
65
|
}
|
|
120
66
|
async check() {
|
|
121
67
|
console.warn('OtaKit.check() is not supported on web');
|
|
122
|
-
return
|
|
68
|
+
return { kind: 'no_update' };
|
|
123
69
|
}
|
|
124
70
|
async download() {
|
|
125
71
|
console.warn('OtaKit.download() is not supported on web');
|
|
126
|
-
return
|
|
72
|
+
return { kind: 'no_update' };
|
|
127
73
|
}
|
|
128
74
|
async apply() {
|
|
129
75
|
console.warn('OtaKit.apply() is not supported on web');
|
|
130
76
|
throw new Error('OtaKit.apply() is not supported on web');
|
|
131
77
|
}
|
|
78
|
+
async update() {
|
|
79
|
+
await this.download();
|
|
80
|
+
}
|
|
132
81
|
async notifyAppReady() {
|
|
133
82
|
// No-op on web, but don't warn - apps should call this unconditionally
|
|
134
83
|
}
|
|
135
|
-
async
|
|
136
|
-
console.warn('OtaKit.debug.reset() is not supported on web');
|
|
137
|
-
}
|
|
138
|
-
async debugListBundles() {
|
|
139
|
-
return { bundles: [] };
|
|
140
|
-
}
|
|
141
|
-
async debugDeleteBundle(_options) {
|
|
142
|
-
console.warn('OtaKit.debug.deleteBundle() is not supported on web');
|
|
143
|
-
}
|
|
144
|
-
async debugGetLastFailure() {
|
|
84
|
+
async getLastFailure() {
|
|
145
85
|
return null;
|
|
146
86
|
}
|
|
147
87
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Bundle status enum.\n */\nexport var BundleStatus;\n(function (BundleStatus) {\n /** Factory-installed bundle */\n BundleStatus[\"BUILTIN\"] = \"builtin\";\n /** Downloaded and staged, awaiting activation */\n BundleStatus[\"PENDING\"] = \"pending\";\n /** Active but not yet confirmed */\n BundleStatus[\"TRIAL\"] = \"trial\";\n /** Confirmed working */\n BundleStatus[\"SUCCESS\"] = \"success\";\n /** Failed (hash mismatch, extraction error, rollback) */\n BundleStatus[\"ERROR\"] = \"error\";\n})(BundleStatus || (BundleStatus = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeOtaKit = registerPlugin('OtaKit', {\n web: () => import('./web').then((m) => new m.OtaKitWeb()),\n});\n/**\n * Check if result is an empty object (iOS returns {} instead of null)\n */\nfunction isEmptyObject(obj) {\n return obj !== null && typeof obj === 'object' && Object.keys(obj).length === 0;\n}\n/**\n * Wrapped plugin that normalizes null returns from native code.\n * iOS call.resolve() without arguments returns {} instead of null.\n */\nfunction normalizeNullable(value) {\n return isEmptyObject(value) ? null : value;\n}\
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Bundle status enum.\n */\nexport var BundleStatus;\n(function (BundleStatus) {\n /** Factory-installed bundle */\n BundleStatus[\"BUILTIN\"] = \"builtin\";\n /** Downloaded and staged, awaiting activation */\n BundleStatus[\"PENDING\"] = \"pending\";\n /** Active but not yet confirmed */\n BundleStatus[\"TRIAL\"] = \"trial\";\n /** Confirmed working */\n BundleStatus[\"SUCCESS\"] = \"success\";\n /** Failed (hash mismatch, extraction error, rollback) */\n BundleStatus[\"ERROR\"] = \"error\";\n})(BundleStatus || (BundleStatus = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativeOtaKit = registerPlugin('OtaKit', {\n web: () => import('./web').then((m) => new m.OtaKitWeb()),\n});\n/**\n * Check if result is an empty object (iOS returns {} instead of null)\n */\nfunction isEmptyObject(obj) {\n return obj !== null && typeof obj === 'object' && Object.keys(obj).length === 0;\n}\n/**\n * Wrapped plugin that normalizes null returns from native code.\n * iOS call.resolve() without arguments returns {} instead of null.\n */\nfunction normalizeNullable(value) {\n return isEmptyObject(value) ? null : value;\n}\nconst OtaKit = {\n getState: () => NativeOtaKit.getState(),\n check: () => NativeOtaKit.check(),\n download: () => NativeOtaKit.download(),\n apply: () => NativeOtaKit.apply(),\n update: () => NativeOtaKit.update(),\n notifyAppReady: () => NativeOtaKit.notifyAppReady(),\n getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),\n};\nexport * from './definitions';\nexport { OtaKit };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation of the native bridge.\n * Most methods are no-ops since OTA updates don't apply to web.\n */\nexport class OtaKitWeb extends WebPlugin {\n BUILTIN_BUNDLE = {\n id: 'builtin',\n version: '0.0.0',\n status: 'builtin',\n };\n async getState() {\n return {\n current: this.BUILTIN_BUNDLE,\n fallback: this.BUILTIN_BUNDLE,\n staged: null,\n builtinVersion: this.BUILTIN_BUNDLE.version,\n };\n }\n async check() {\n console.warn('OtaKit.check() is not supported on web');\n return { kind: 'no_update' };\n }\n async download() {\n console.warn('OtaKit.download() is not supported on web');\n return { kind: 'no_update' };\n }\n async apply() {\n console.warn('OtaKit.apply() is not supported on web');\n throw new Error('OtaKit.apply() is not supported on web');\n }\n async update() {\n await this.download();\n }\n async notifyAppReady() {\n // No-op on web, but don't warn - apps should call this unconditionally\n }\n async getLastFailure() {\n return null;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BundleStatus","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACWA;AACX,CAAC,UAAU,YAAY,EAAE;AACzB;AACA,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS;AACvC;AACA,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS;A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