@otakit/capacitor-updater 2.0.1 → 2.1.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.
- package/{UpdatekitUpdater.podspec → OtaKitUpdater.podspec} +1 -1
- package/README.md +1 -2
- 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 +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/DateUtils.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/DeviceEventClient.java +1 -1
- 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 +12 -8
- package/android/src/main/java/com/{updatekit → otakit}/updater/ManifestVerifier.java +1 -1
- package/android/src/main/java/com/{updatekit → otakit}/updater/UpdaterPlugin.java +10 -68
- package/android/src/main/java/com/{updatekit → otakit}/updater/ZipUtils.java +1 -1
- package/dist/esm/definitions.d.ts +7 -39
- package/dist/esm/definitions.d.ts.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +4 -9
- package/dist/esm/web.d.ts.map +1 -1
- package/dist/esm/web.js +3 -12
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -26
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -26
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/UpdaterPlugin/Downloader.swift +1 -1
- package/ios/Sources/UpdaterPlugin/ManifestClient.swift +1 -1
- package/ios/Sources/UpdaterPlugin/UpdaterPlugin.m +2 -5
- package/ios/Sources/UpdaterPlugin/UpdaterPlugin.swift +10 -64
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = '
|
|
6
|
+
s.name = 'OtaKitUpdater'
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.license = package['license']
|
package/README.md
CHANGED
|
@@ -210,7 +210,6 @@ always live, and `immediate` mode ignores the interval entirely.
|
|
|
210
210
|
- the builtin, current, fallback, and staged bundles are protected
|
|
211
211
|
- superseded staged bundles are deleted automatically
|
|
212
212
|
- failed trial bundles are deleted during rollback
|
|
213
|
-
- `debug.deleteBundle()` only works for downloaded bundles outside runtime state
|
|
214
213
|
|
|
215
214
|
## Source areas
|
|
216
215
|
|
|
@@ -218,7 +217,7 @@ always live, and `immediate` mode ignores the interval entirely.
|
|
|
218
217
|
- `src/index.ts`: Capacitor registration and JS wrapper
|
|
219
218
|
- `src/web.ts`: web fallback implementation
|
|
220
219
|
- `ios/Sources/UpdaterPlugin/*`: iOS implementation
|
|
221
|
-
- `android/src/main/java/com/
|
|
220
|
+
- `android/src/main/java/com/otakit/updater/*`: Android implementation
|
|
222
221
|
|
|
223
222
|
## Build locally
|
|
224
223
|
|
package/android/build.gradle
CHANGED
|
@@ -17,7 +17,7 @@ buildscript {
|
|
|
17
17
|
apply plugin: 'com.android.library'
|
|
18
18
|
|
|
19
19
|
android {
|
|
20
|
-
namespace "com.
|
|
20
|
+
namespace "com.otakit.updater"
|
|
21
21
|
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
22
22
|
defaultConfig {
|
|
23
23
|
minSdk project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.otakit.updater;
|
|
2
2
|
|
|
3
3
|
import java.io.ByteArrayOutputStream;
|
|
4
4
|
import java.io.InputStream;
|
|
@@ -136,7 +136,7 @@ final class ManifestClient {
|
|
|
136
136
|
|
|
137
137
|
if (manifestKeys == null || manifestKeys.isEmpty()) {
|
|
138
138
|
android.util.Log.w(
|
|
139
|
-
"
|
|
139
|
+
"OtaKit",
|
|
140
140
|
"No manifest signing keys configured — signature verification is disabled for this request."
|
|
141
141
|
);
|
|
142
142
|
}
|
|
@@ -194,11 +194,15 @@ final class ManifestClient {
|
|
|
194
194
|
if (!sigObj.has("kid") || !sigObj.has("sig") || !sigObj.has("iat") || !sigObj.has("exp")) {
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
try {
|
|
198
|
+
return new ManifestSignature(
|
|
199
|
+
sigObj.getString("kid"),
|
|
200
|
+
sigObj.getString("sig"),
|
|
201
|
+
sigObj.getInt("iat"),
|
|
202
|
+
sigObj.getInt("exp")
|
|
203
|
+
);
|
|
204
|
+
} catch (org.json.JSONException e) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
203
207
|
}
|
|
204
208
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.otakit.updater;
|
|
2
2
|
|
|
3
3
|
import android.content.pm.PackageInfo;
|
|
4
4
|
import android.content.pm.PackageManager;
|
|
@@ -107,7 +107,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
107
107
|
}
|
|
108
108
|
if (manifestKeys.isEmpty()) {
|
|
109
109
|
android.util.Log.e(
|
|
110
|
-
"
|
|
110
|
+
"OtaKit",
|
|
111
111
|
"manifestKeys configured but all entries are invalid. Manifest verification will reject all updates."
|
|
112
112
|
);
|
|
113
113
|
manifestKeys.add(new ManifestVerifier.KeyEntry("_invalid_", new byte[0]));
|
|
@@ -115,7 +115,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
115
115
|
}
|
|
116
116
|
} catch (Exception e) {
|
|
117
117
|
android.util.Log.e(
|
|
118
|
-
"
|
|
118
|
+
"OtaKit",
|
|
119
119
|
"Failed to parse manifestKeys. Manifest verification will reject all updates.",
|
|
120
120
|
e
|
|
121
121
|
);
|
|
@@ -273,7 +273,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
@PluginMethod
|
|
276
|
-
public void
|
|
276
|
+
public void getState(PluginCall call) {
|
|
277
277
|
JSObject result = new JSObject();
|
|
278
278
|
result.put("current", store.getCurrentBundle().toJSObject());
|
|
279
279
|
result.put("fallback", store.getFallbackBundle().toJSObject());
|
|
@@ -421,65 +421,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
@PluginMethod
|
|
424
|
-
public void
|
|
425
|
-
cancelTrialTimeout();
|
|
426
|
-
store.setCurrentBundleId(null);
|
|
427
|
-
store.setStagedBundleId(null);
|
|
428
|
-
store.setFallbackBundleId(null);
|
|
429
|
-
store.setFailedBundle(null);
|
|
430
|
-
applyServerBasePath(null);
|
|
431
|
-
call.resolve();
|
|
432
|
-
reloadWebView();
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
@PluginMethod
|
|
436
|
-
public void debugListBundles(PluginCall call) {
|
|
437
|
-
JSObject result = new JSObject();
|
|
438
|
-
JSArray bundles = store.listDownloadedBundles();
|
|
439
|
-
result.put("bundles", bundles);
|
|
440
|
-
call.resolve(result);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
@PluginMethod
|
|
444
|
-
public void debugDeleteBundle(PluginCall call) {
|
|
445
|
-
String bundleId = call.getString("bundleId");
|
|
446
|
-
if (bundleId == null) {
|
|
447
|
-
call.reject("Missing bundleId");
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (!store.bundleExists(bundleId)) {
|
|
451
|
-
call.reject("Bundle not found");
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
BundleInfo current = store.getCurrentBundle();
|
|
456
|
-
if (bundleId.equals(current.id)) {
|
|
457
|
-
call.reject("Cannot delete current bundle");
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
BundleInfo fallback = store.getFallbackBundle();
|
|
462
|
-
if (bundleId.equals(fallback.id)) {
|
|
463
|
-
call.reject("Cannot delete fallback bundle");
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
String stagedId = store.getStagedBundleId();
|
|
468
|
-
if (bundleId.equals(stagedId)) {
|
|
469
|
-
call.reject("Cannot delete staged bundle");
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
try {
|
|
474
|
-
store.deleteBundle(bundleId);
|
|
475
|
-
call.resolve();
|
|
476
|
-
} catch (Exception e) {
|
|
477
|
-
call.reject("Delete failed: " + e.getMessage());
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
@PluginMethod
|
|
482
|
-
public void debugGetLastFailure(PluginCall call) {
|
|
424
|
+
public void getLastFailure(PluginCall call) {
|
|
483
425
|
BundleInfo failed = store.getFailedBundle();
|
|
484
426
|
if (failed == null) {
|
|
485
427
|
call.resolve((JSObject) null);
|
|
@@ -622,7 +564,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
622
564
|
|
|
623
565
|
extractedDirectory = new File(
|
|
624
566
|
getContext().getCacheDir(),
|
|
625
|
-
"
|
|
567
|
+
"otakit-extract-" + System.currentTimeMillis()
|
|
626
568
|
);
|
|
627
569
|
if (!extractedDirectory.exists() && !extractedDirectory.mkdirs()) {
|
|
628
570
|
throw new IllegalStateException("Cannot create temporary extraction directory");
|
|
@@ -690,7 +632,7 @@ public class UpdaterPlugin extends Plugin {
|
|
|
690
632
|
throw new IllegalStateException("Download failed with HTTP " + status);
|
|
691
633
|
}
|
|
692
634
|
|
|
693
|
-
File destination = File.createTempFile("
|
|
635
|
+
File destination = File.createTempFile("otakit-", ".zip", getContext().getCacheDir());
|
|
694
636
|
|
|
695
637
|
try (
|
|
696
638
|
InputStream input = connection.getInputStream();
|
|
@@ -1128,17 +1070,17 @@ public class UpdaterPlugin extends Plugin {
|
|
|
1128
1070
|
}
|
|
1129
1071
|
String normalizedBundleVersion = trimToNull(bundleVersion);
|
|
1130
1072
|
if (normalizedBundleVersion == null) {
|
|
1131
|
-
android.util.Log.w("
|
|
1073
|
+
android.util.Log.w("OtaKit", "Skipping device event without bundleVersion");
|
|
1132
1074
|
return;
|
|
1133
1075
|
}
|
|
1134
1076
|
String normalizedReleaseId = trimToNull(releaseId);
|
|
1135
1077
|
if (normalizedReleaseId == null) {
|
|
1136
|
-
android.util.Log.w("
|
|
1078
|
+
android.util.Log.w("OtaKit", "Skipping device event without releaseId");
|
|
1137
1079
|
return;
|
|
1138
1080
|
}
|
|
1139
1081
|
String nativeBuild = trimToNull(store.getNativeBuild());
|
|
1140
1082
|
if (nativeBuild == null) {
|
|
1141
|
-
android.util.Log.w("
|
|
1083
|
+
android.util.Log.w("OtaKit", "Skipping device event without nativeBuild");
|
|
1142
1084
|
return;
|
|
1143
1085
|
}
|
|
1144
1086
|
DeviceEventClient.send(
|
|
@@ -48,17 +48,12 @@ export interface LatestVersion {
|
|
|
48
48
|
/** Release history ID associated with this manifest */
|
|
49
49
|
releaseId: string;
|
|
50
50
|
}
|
|
51
|
-
export interface BundleListResult {
|
|
52
|
-
bundles: BundleInfo[];
|
|
53
|
-
}
|
|
54
51
|
export interface OtaKitState {
|
|
55
52
|
current: BundleInfo;
|
|
53
|
+
fallback: BundleInfo;
|
|
56
54
|
staged: BundleInfo | null;
|
|
57
55
|
builtinVersion: string;
|
|
58
56
|
}
|
|
59
|
-
export interface OtaKitDebugState extends OtaKitState {
|
|
60
|
-
fallback: BundleInfo;
|
|
61
|
-
}
|
|
62
57
|
export type OtaKitUpdateMode = 'manual' | 'next-launch' | 'next-resume' | 'immediate';
|
|
63
58
|
export interface OtaKitManifestKey {
|
|
64
59
|
kid: string;
|
|
@@ -95,33 +90,10 @@ export interface OtaKitConfig {
|
|
|
95
90
|
/** Allow HTTP only for localhost development. Defaults to false. */
|
|
96
91
|
allowInsecureUrls?: boolean;
|
|
97
92
|
}
|
|
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
93
|
export type OtaKitEvent = 'downloadStarted' | 'downloadComplete' | 'downloadFailed' | 'updateAvailable' | 'noUpdateAvailable' | 'appReady' | 'rollback';
|
|
122
94
|
export interface OtaKitPlugin {
|
|
123
95
|
/**
|
|
124
|
-
* Inspect the current updater state
|
|
96
|
+
* Inspect the current updater state.
|
|
125
97
|
*/
|
|
126
98
|
getState(): Promise<OtaKitState>;
|
|
127
99
|
/**
|
|
@@ -163,9 +135,10 @@ export interface OtaKitPlugin {
|
|
|
163
135
|
*/
|
|
164
136
|
notifyAppReady(): Promise<void>;
|
|
165
137
|
/**
|
|
166
|
-
*
|
|
138
|
+
* Get the most recent failed update information for diagnostics.
|
|
139
|
+
* Returns null if no failure has occurred.
|
|
167
140
|
*/
|
|
168
|
-
|
|
141
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
169
142
|
/**
|
|
170
143
|
* Add listener for update events
|
|
171
144
|
*/
|
|
@@ -191,17 +164,12 @@ export interface OtaKitPlugin {
|
|
|
191
164
|
removeAllListeners(): Promise<void>;
|
|
192
165
|
}
|
|
193
166
|
export interface OtaKitBridgePlugin {
|
|
167
|
+
getState(): Promise<OtaKitState>;
|
|
194
168
|
check(): Promise<LatestVersion | null>;
|
|
195
169
|
download(): Promise<BundleInfo | null>;
|
|
196
170
|
apply(): Promise<void>;
|
|
197
171
|
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>;
|
|
172
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
205
173
|
addListener(event: 'downloadStarted', callback: (data: {
|
|
206
174
|
version: string;
|
|
207
175
|
}) => void): Promise<PluginListenerHandle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;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;IACtB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;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;IACtB,iCAAiC;IACjC,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,CAAA;KAAE,KAAK,IAAI,GAC5C,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CACT,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CACT,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAC3D,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CACT,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,GACtC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC7F,WAAW,CACT,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,WAAW,CACT,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,EAAE,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAC9E,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
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,EAEV,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,YAAY,EAIb,MAAM,eAAe,CAAC;AAqEvB,QAAA,MAAM,MAAM,EAAE,YAWb,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -15,15 +15,8 @@ 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
18
|
async function getState() {
|
|
26
|
-
return
|
|
19
|
+
return NativeOtaKit.getState();
|
|
27
20
|
}
|
|
28
21
|
async function check() {
|
|
29
22
|
return normalizeNullable(await NativeOtaKit.check());
|
|
@@ -69,12 +62,7 @@ const OtaKit = {
|
|
|
69
62
|
apply,
|
|
70
63
|
update,
|
|
71
64
|
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
|
-
},
|
|
65
|
+
getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),
|
|
78
66
|
addListener: NativeOtaKit.addListener.bind(NativeOtaKit),
|
|
79
67
|
removeAllListeners: () => NativeOtaKit.removeAllListeners(),
|
|
80
68
|
};
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],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,KAAK,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,MAAM,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;QAChC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,KAAK,EAAE,CAAC;QAChB,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,KAAK,EAAE,CAAC;IAChB,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAiB;IAC3B,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE;IACnD,cAAc,EAAE,KAAK,IAAgC,EAAE,CACrD,iBAAiB,CAAC,MAAM,YAAY,CAAC,cAAc,EAAE,CAAC;IACxD,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAgC;IACvF,kBAAkB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE;CAC5D,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { OtaKitBridgePlugin, BundleInfo,
|
|
2
|
+
import type { OtaKitBridgePlugin, BundleInfo, LatestVersion, 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
|
-
|
|
9
|
+
getState(): Promise<OtaKitState>;
|
|
10
10
|
check(): Promise<LatestVersion | null>;
|
|
11
11
|
download(): Promise<BundleInfo | null>;
|
|
12
12
|
apply(): Promise<void>;
|
|
13
13
|
notifyAppReady(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
debugListBundles(): Promise<BundleListResult>;
|
|
16
|
-
debugDeleteBundle(_options: {
|
|
17
|
-
bundleId: string;
|
|
18
|
-
}): Promise<void>;
|
|
19
|
-
debugGetLastFailure(): Promise<BundleInfo | null>;
|
|
14
|
+
getLastFailure(): Promise<BundleInfo | null>;
|
|
20
15
|
}
|
|
21
16
|
//# 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,EACV,
|
|
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,EACV,aAAa,EAEb,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,aAAa,GAAG,IAAI,CAAC;IAKtC,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAKtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,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,
|
|
@@ -32,16 +32,7 @@ export class OtaKitWeb extends WebPlugin {
|
|
|
32
32
|
async notifyAppReady() {
|
|
33
33
|
// No-op on web, but don't warn - apps should call this unconditionally
|
|
34
34
|
}
|
|
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() {
|
|
35
|
+
async getLastFailure() {
|
|
45
36
|
return null;
|
|
46
37
|
}
|
|
47
38
|
}
|
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;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C;;;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,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,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,cAAc;QAClB,uEAAuE;IACzE,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -35,15 +35,8 @@ 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
38
|
async function getState() {
|
|
46
|
-
return
|
|
39
|
+
return NativeOtaKit.getState();
|
|
47
40
|
}
|
|
48
41
|
async function check() {
|
|
49
42
|
return normalizeNullable(await NativeOtaKit.check());
|
|
@@ -89,19 +82,14 @@ const OtaKit = {
|
|
|
89
82
|
apply,
|
|
90
83
|
update,
|
|
91
84
|
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
|
-
},
|
|
85
|
+
getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),
|
|
98
86
|
addListener: NativeOtaKit.addListener.bind(NativeOtaKit),
|
|
99
87
|
removeAllListeners: () => NativeOtaKit.removeAllListeners(),
|
|
100
88
|
};
|
|
101
89
|
|
|
102
90
|
/**
|
|
103
91
|
* Web implementation of the native bridge.
|
|
104
|
-
* Most methods are no-ops since OTA updates don't apply to web
|
|
92
|
+
* Most methods are no-ops since OTA updates don't apply to web.
|
|
105
93
|
*/
|
|
106
94
|
class OtaKitWeb extends core.WebPlugin {
|
|
107
95
|
BUILTIN_BUNDLE = {
|
|
@@ -109,7 +97,7 @@ class OtaKitWeb extends core.WebPlugin {
|
|
|
109
97
|
version: '0.0.0',
|
|
110
98
|
status: 'builtin',
|
|
111
99
|
};
|
|
112
|
-
async
|
|
100
|
+
async getState() {
|
|
113
101
|
return {
|
|
114
102
|
current: this.BUILTIN_BUNDLE,
|
|
115
103
|
fallback: this.BUILTIN_BUNDLE,
|
|
@@ -132,16 +120,7 @@ class OtaKitWeb extends core.WebPlugin {
|
|
|
132
120
|
async notifyAppReady() {
|
|
133
121
|
// No-op on web, but don't warn - apps should call this unconditionally
|
|
134
122
|
}
|
|
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() {
|
|
123
|
+
async getLastFailure() {
|
|
145
124
|
return null;
|
|
146
125
|
}
|
|
147
126
|
}
|
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}\nasync function getState() {\n return NativeOtaKit.getState();\n}\nasync function check() {\n return normalizeNullable(await NativeOtaKit.check());\n}\nasync function download() {\n return normalizeNullable(await NativeOtaKit.download());\n}\nfunction apply() {\n return NativeOtaKit.apply();\n}\nasync function update() {\n const state = await getState();\n let latest;\n try {\n latest = await check();\n }\n catch (error) {\n if (state.staged) {\n await apply();\n return;\n }\n throw error;\n }\n if (latest) {\n if (latest.downloaded) {\n await apply();\n return;\n }\n const bundle = await download();\n if (bundle) {\n await apply();\n }\n return;\n }\n if (state.staged) {\n await apply();\n }\n}\nconst OtaKit = {\n getState,\n check,\n download,\n apply,\n update,\n notifyAppReady: () => NativeOtaKit.notifyAppReady(),\n getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),\n addListener: NativeOtaKit.addListener.bind(NativeOtaKit),\n removeAllListeners: () => NativeOtaKit.removeAllListeners(),\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 null;\n }\n async download() {\n console.warn('OtaKit.download() is not supported on web');\n return null;\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 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;AACvC;AACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;AACnC;AACA,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,SAAS;AACvC;AACA,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,OAAO;AACnC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;;ACdvC,MAAM,YAAY,GAAGC,mBAAc,CAAC,QAAQ,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC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O,IAAI;AACnB,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC;AAC9D,QAAQ,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC;AACjE,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG;AAC3B;AACA,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -34,15 +34,8 @@ var capacitorUpdater = (function (exports, core) {
|
|
|
34
34
|
function normalizeNullable(value) {
|
|
35
35
|
return isEmptyObject(value) ? null : value;
|
|
36
36
|
}
|
|
37
|
-
function toPublicState(value) {
|
|
38
|
-
return {
|
|
39
|
-
current: value.current,
|
|
40
|
-
staged: value.staged,
|
|
41
|
-
builtinVersion: value.builtinVersion,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
37
|
async function getState() {
|
|
45
|
-
return
|
|
38
|
+
return NativeOtaKit.getState();
|
|
46
39
|
}
|
|
47
40
|
async function check() {
|
|
48
41
|
return normalizeNullable(await NativeOtaKit.check());
|
|
@@ -88,19 +81,14 @@ var capacitorUpdater = (function (exports, core) {
|
|
|
88
81
|
apply,
|
|
89
82
|
update,
|
|
90
83
|
notifyAppReady: () => NativeOtaKit.notifyAppReady(),
|
|
91
|
-
|
|
92
|
-
reset: () => NativeOtaKit.debugReset(),
|
|
93
|
-
listBundles: () => NativeOtaKit.debugListBundles(),
|
|
94
|
-
deleteBundle: (options) => NativeOtaKit.debugDeleteBundle(options),
|
|
95
|
-
getLastFailure: async () => normalizeNullable(await NativeOtaKit.debugGetLastFailure()),
|
|
96
|
-
},
|
|
84
|
+
getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),
|
|
97
85
|
addListener: NativeOtaKit.addListener.bind(NativeOtaKit),
|
|
98
86
|
removeAllListeners: () => NativeOtaKit.removeAllListeners(),
|
|
99
87
|
};
|
|
100
88
|
|
|
101
89
|
/**
|
|
102
90
|
* Web implementation of the native bridge.
|
|
103
|
-
* Most methods are no-ops since OTA updates don't apply to web
|
|
91
|
+
* Most methods are no-ops since OTA updates don't apply to web.
|
|
104
92
|
*/
|
|
105
93
|
class OtaKitWeb extends core.WebPlugin {
|
|
106
94
|
BUILTIN_BUNDLE = {
|
|
@@ -108,7 +96,7 @@ var capacitorUpdater = (function (exports, core) {
|
|
|
108
96
|
version: '0.0.0',
|
|
109
97
|
status: 'builtin',
|
|
110
98
|
};
|
|
111
|
-
async
|
|
99
|
+
async getState() {
|
|
112
100
|
return {
|
|
113
101
|
current: this.BUILTIN_BUNDLE,
|
|
114
102
|
fallback: this.BUILTIN_BUNDLE,
|
|
@@ -131,16 +119,7 @@ var capacitorUpdater = (function (exports, core) {
|
|
|
131
119
|
async notifyAppReady() {
|
|
132
120
|
// No-op on web, but don't warn - apps should call this unconditionally
|
|
133
121
|
}
|
|
134
|
-
async
|
|
135
|
-
console.warn('OtaKit.debug.reset() is not supported on web');
|
|
136
|
-
}
|
|
137
|
-
async debugListBundles() {
|
|
138
|
-
return { bundles: [] };
|
|
139
|
-
}
|
|
140
|
-
async debugDeleteBundle(_options) {
|
|
141
|
-
console.warn('OtaKit.debug.deleteBundle() is not supported on web');
|
|
142
|
-
}
|
|
143
|
-
async debugGetLastFailure() {
|
|
122
|
+
async getLastFailure() {
|
|
144
123
|
return null;
|
|
145
124
|
}
|
|
146
125
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.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.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}\nasync function getState() {\n return NativeOtaKit.getState();\n}\nasync function check() {\n return normalizeNullable(await NativeOtaKit.check());\n}\nasync function download() {\n return normalizeNullable(await NativeOtaKit.download());\n}\nfunction apply() {\n return NativeOtaKit.apply();\n}\nasync function update() {\n const state = await getState();\n let latest;\n try {\n latest = await check();\n }\n catch (error) {\n if (state.staged) {\n await apply();\n return;\n }\n throw error;\n }\n if (latest) {\n if (latest.downloaded) {\n await apply();\n return;\n }\n const bundle = await download();\n if (bundle) {\n await apply();\n }\n return;\n }\n if (state.staged) {\n await apply();\n }\n}\nconst OtaKit = {\n getState,\n check,\n download,\n apply,\n update,\n notifyAppReady: () => NativeOtaKit.notifyAppReady(),\n getLastFailure: async () => normalizeNullable(await NativeOtaKit.getLastFailure()),\n addListener: NativeOtaKit.addListener.bind(NativeOtaKit),\n removeAllListeners: () => NativeOtaKit.removeAllListeners(),\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 null;\n }\n async download() {\n console.warn('OtaKit.download() is not supported on web');\n return null;\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 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":";;;IAAA;IACA;IACA;AACWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA,IAAI,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AG;IACrB,QAAQ,OAAO;IACf,YAAY,OAAO,EAAE,IAAI,CAAC,cAAc;IACxC,YAAY,QAAQ,EAAE,IAAI,CAAC,cAAc;IACzC,YAAY,MAAM,EAAE,IAAI;IACxB,YAAY,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO;IACvD,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC;IAC9D,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC;IACjE,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC;IAC9D,QAAQ,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC;IACjE,IAAI;IACJ,IAAI,MAAM,cAAc,GAAG;IAC3B;IACA,IAAI;IACJ,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -78,7 +78,7 @@ private final class DownloadDelegate: NSObject, URLSessionDownloadDelegate {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
let temporaryZip = FileManager.default.temporaryDirectory
|
|
81
|
-
.appendingPathComponent("
|
|
81
|
+
.appendingPathComponent("otakit-\(UUID().uuidString).zip")
|
|
82
82
|
|
|
83
83
|
do {
|
|
84
84
|
try FileManager.default.moveItem(at: location, to: temporaryZip)
|
|
@@ -114,7 +114,7 @@ enum ManifestClient {
|
|
|
114
114
|
try requireHTTPS(url: dlURL, allowInsecure: allowInsecureUrls)
|
|
115
115
|
|
|
116
116
|
if manifestKeys.isEmpty {
|
|
117
|
-
print("[
|
|
117
|
+
print("[OtaKit] WARNING: No manifest signing keys configured — signature verification is disabled for this request.")
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
if !manifestKeys.isEmpty {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
#import <Capacitor/Capacitor.h>
|
|
2
2
|
|
|
3
3
|
CAP_PLUGIN(UpdaterPlugin, "OtaKit",
|
|
4
|
+
CAP_PLUGIN_METHOD(getState, CAPPluginReturnPromise);
|
|
4
5
|
CAP_PLUGIN_METHOD(check, CAPPluginReturnPromise);
|
|
5
6
|
CAP_PLUGIN_METHOD(download, CAPPluginReturnPromise);
|
|
6
7
|
CAP_PLUGIN_METHOD(apply, CAPPluginReturnPromise);
|
|
7
|
-
CAP_PLUGIN_METHOD(debugGetState, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(notifyAppReady, CAPPluginReturnPromise);
|
|
9
|
-
CAP_PLUGIN_METHOD(
|
|
10
|
-
CAP_PLUGIN_METHOD(debugListBundles, CAPPluginReturnPromise);
|
|
11
|
-
CAP_PLUGIN_METHOD(debugDeleteBundle, CAPPluginReturnPromise);
|
|
12
|
-
CAP_PLUGIN_METHOD(debugGetLastFailure, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(getLastFailure, CAPPluginReturnPromise);
|
|
13
10
|
)
|
|
@@ -19,15 +19,12 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
19
19
|
public let identifier = "UpdaterPlugin"
|
|
20
20
|
public let jsName = "OtaKit"
|
|
21
21
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
22
|
+
CAPPluginMethod(name: "getState", returnType: CAPPluginReturnPromise),
|
|
22
23
|
CAPPluginMethod(name: "check", returnType: CAPPluginReturnPromise),
|
|
23
24
|
CAPPluginMethod(name: "download", returnType: CAPPluginReturnPromise),
|
|
24
25
|
CAPPluginMethod(name: "apply", returnType: CAPPluginReturnPromise),
|
|
25
|
-
CAPPluginMethod(name: "debugGetState", returnType: CAPPluginReturnPromise),
|
|
26
26
|
CAPPluginMethod(name: "notifyAppReady", returnType: CAPPluginReturnPromise),
|
|
27
|
-
CAPPluginMethod(name: "
|
|
28
|
-
CAPPluginMethod(name: "debugListBundles", returnType: CAPPluginReturnPromise),
|
|
29
|
-
CAPPluginMethod(name: "debugDeleteBundle", returnType: CAPPluginReturnPromise),
|
|
30
|
-
CAPPluginMethod(name: "debugGetLastFailure", returnType: CAPPluginReturnPromise),
|
|
27
|
+
CAPPluginMethod(name: "getLastFailure", returnType: CAPPluginReturnPromise),
|
|
31
28
|
]
|
|
32
29
|
|
|
33
30
|
private let store = BundleStore()
|
|
@@ -85,11 +82,11 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
85
82
|
return (kid: kid, key: keyData)
|
|
86
83
|
}
|
|
87
84
|
if manifestKeys.isEmpty && !rawKeys.isEmpty {
|
|
88
|
-
print("[
|
|
85
|
+
print("[OtaKit] ERROR: manifestKeys configured but all entries are invalid. Manifest verification will reject all updates.")
|
|
89
86
|
manifestKeys = [(kid: "_invalid_", key: Data())]
|
|
90
87
|
}
|
|
91
88
|
} else if rawKeysValue != nil {
|
|
92
|
-
print("[
|
|
89
|
+
print("[OtaKit] ERROR: manifestKeys has wrong format (expected array of {kid, key}). Manifest verification will reject all updates.")
|
|
93
90
|
manifestKeys = [(kid: "_invalid_", key: Data())]
|
|
94
91
|
}
|
|
95
92
|
|
|
@@ -268,7 +265,7 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
268
265
|
}
|
|
269
266
|
}
|
|
270
267
|
|
|
271
|
-
@objc func
|
|
268
|
+
@objc func getState(_ call: CAPPluginCall) {
|
|
272
269
|
let current = store.getCurrentBundle()
|
|
273
270
|
let staged: [String: Any]? = {
|
|
274
271
|
guard let stagedId = store.getStagedBundleId() else {
|
|
@@ -410,58 +407,7 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
410
407
|
call.resolve()
|
|
411
408
|
}
|
|
412
409
|
|
|
413
|
-
@objc func
|
|
414
|
-
cancelTrialTimeout()
|
|
415
|
-
store.setCurrentBundleId(nil)
|
|
416
|
-
store.setStagedBundleId(nil)
|
|
417
|
-
store.setFallbackBundleId(nil)
|
|
418
|
-
store.setFailedBundle(nil)
|
|
419
|
-
applyServerBasePath(nil)
|
|
420
|
-
call.resolve()
|
|
421
|
-
reloadWebView()
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
@objc func debugListBundles(_ call: CAPPluginCall) {
|
|
425
|
-
let bundles = store.listDownloadedBundles().map { $0.toDictionary() }
|
|
426
|
-
call.resolve(["bundles": bundles])
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
@objc func debugDeleteBundle(_ call: CAPPluginCall) {
|
|
430
|
-
guard let bundleId = call.getString("bundleId") else {
|
|
431
|
-
call.reject("Missing bundleId")
|
|
432
|
-
return
|
|
433
|
-
}
|
|
434
|
-
guard store.bundleExists(id: bundleId) else {
|
|
435
|
-
call.reject("Bundle not found")
|
|
436
|
-
return
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
let current = store.getCurrentBundle()
|
|
440
|
-
if current.id == bundleId {
|
|
441
|
-
call.reject("Cannot delete current bundle")
|
|
442
|
-
return
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
let fallback = store.getFallbackBundle()
|
|
446
|
-
if fallback.id == bundleId {
|
|
447
|
-
call.reject("Cannot delete fallback bundle")
|
|
448
|
-
return
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if store.getStagedBundleId() == bundleId {
|
|
452
|
-
call.reject("Cannot delete staged bundle")
|
|
453
|
-
return
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
do {
|
|
457
|
-
try store.deleteBundle(id: bundleId)
|
|
458
|
-
call.resolve()
|
|
459
|
-
} catch {
|
|
460
|
-
call.reject("Failed to delete bundle: \(error.localizedDescription)")
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
@objc func debugGetLastFailure(_ call: CAPPluginCall) {
|
|
410
|
+
@objc func getLastFailure(_ call: CAPPluginCall) {
|
|
465
411
|
guard let failed = store.getFailedBundle() else {
|
|
466
412
|
call.resolve()
|
|
467
413
|
return
|
|
@@ -609,7 +555,7 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
609
555
|
let zipURL = try await downloader.download(from: url)
|
|
610
556
|
|
|
611
557
|
let extractDirectory = fileManager.temporaryDirectory
|
|
612
|
-
.appendingPathComponent("
|
|
558
|
+
.appendingPathComponent("otakit-extract-\(UUID().uuidString)", isDirectory: true)
|
|
613
559
|
defer {
|
|
614
560
|
try? fileManager.removeItem(at: zipURL)
|
|
615
561
|
try? fileManager.removeItem(at: extractDirectory)
|
|
@@ -1036,16 +982,16 @@ public class UpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1036
982
|
return
|
|
1037
983
|
}
|
|
1038
984
|
guard let bundleVersion = trimToNil(bundleVersion) else {
|
|
1039
|
-
print("[
|
|
985
|
+
print("[OtaKit] Skipping device event without bundleVersion")
|
|
1040
986
|
return
|
|
1041
987
|
}
|
|
1042
988
|
guard let releaseId = trimToNil(releaseId) else {
|
|
1043
|
-
print("[
|
|
989
|
+
print("[OtaKit] Skipping device event without releaseId")
|
|
1044
990
|
return
|
|
1045
991
|
}
|
|
1046
992
|
let nativeBuild = store.nativeBuild.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
1047
993
|
guard !nativeBuild.isEmpty else {
|
|
1048
|
-
print("[
|
|
994
|
+
print("[OtaKit] Skipping device event without nativeBuild")
|
|
1049
995
|
return
|
|
1050
996
|
}
|
|
1051
997
|
DeviceEventClient.send(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otakit/capacitor-updater",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Capacitor plugin for OTA updates",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist/",
|
|
17
17
|
"ios/Sources/",
|
|
18
18
|
"ios/Tests/",
|
|
19
|
-
"
|
|
19
|
+
"OtaKitUpdater.podspec"
|
|
20
20
|
],
|
|
21
21
|
"author": "OtaKit",
|
|
22
22
|
"license": "MIT",
|