@capawesome/capacitor-live-update 6.5.0 → 6.6.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/README.md +45 -5
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +13 -1
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +24 -2
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DownloadBundleOptions.java +15 -1
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +22 -0
- package/dist/docs.json +67 -4
- package/dist/esm/definitions.d.ts +42 -3
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +2 -1
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Classes/Options/DownloadBundleOptions.swift +11 -1
- package/ios/Plugin/Classes/Results/FetchLatestBundle.swift +16 -0
- package/ios/Plugin/LiveUpdate.swift +12 -2
- package/ios/Plugin/LiveUpdatePlugin.m +1 -0
- package/ios/Plugin/LiveUpdatePlugin.swift +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,6 +156,10 @@ const downloadBundle = async () => {
|
|
|
156
156
|
await LiveUpdate.downloadBundle({ url: 'https://example.com/1.0.0.zip', bundleId: '1.0.0' });
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
+
const fetchLatestBundle = async () => {
|
|
160
|
+
await LiveUpdate.fetchLatestBundle();
|
|
161
|
+
};
|
|
162
|
+
|
|
159
163
|
const getBundle = async () => {
|
|
160
164
|
const result = await LiveUpdate.getBundle();
|
|
161
165
|
return result.bundleId;
|
|
@@ -219,6 +223,16 @@ const sync = async () => {
|
|
|
219
223
|
const result = await LiveUpdate.sync();
|
|
220
224
|
return result.nextBundleId;
|
|
221
225
|
};
|
|
226
|
+
|
|
227
|
+
const isNewBundleAvailable = async () => {
|
|
228
|
+
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle();
|
|
229
|
+
if (latestBundleId) {
|
|
230
|
+
const { bundleId: currentBundleId } = await LiveUpdate.getBundle();
|
|
231
|
+
return latestBundleId !== currentBundleId;
|
|
232
|
+
} else {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
222
236
|
```
|
|
223
237
|
|
|
224
238
|
## API
|
|
@@ -227,6 +241,7 @@ const sync = async () => {
|
|
|
227
241
|
|
|
228
242
|
* [`deleteBundle(...)`](#deletebundle)
|
|
229
243
|
* [`downloadBundle(...)`](#downloadbundle)
|
|
244
|
+
* [`fetchLatestBundle()`](#fetchlatestbundle)
|
|
230
245
|
* [`getBundle()`](#getbundle)
|
|
231
246
|
* [`getBundles()`](#getbundles)
|
|
232
247
|
* [`getChannel()`](#getchannel)
|
|
@@ -286,6 +301,23 @@ Only available on Android and iOS.
|
|
|
286
301
|
--------------------
|
|
287
302
|
|
|
288
303
|
|
|
304
|
+
### fetchLatestBundle()
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
fetchLatestBundle() => Promise<FetchLatestBundleResult>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
311
|
+
|
|
312
|
+
Only available on Android and iOS.
|
|
313
|
+
|
|
314
|
+
**Returns:** <code>Promise<<a href="#fetchlatestbundleresult">FetchLatestBundleResult</a>></code>
|
|
315
|
+
|
|
316
|
+
**Since:** 6.6.0
|
|
317
|
+
|
|
318
|
+
--------------------
|
|
319
|
+
|
|
320
|
+
|
|
289
321
|
### getBundle()
|
|
290
322
|
|
|
291
323
|
```typescript
|
|
@@ -545,11 +577,19 @@ Only available on Android and iOS.
|
|
|
545
577
|
|
|
546
578
|
#### DownloadBundleOptions
|
|
547
579
|
|
|
548
|
-
| Prop
|
|
549
|
-
|
|
|
550
|
-
| **`
|
|
551
|
-
| **`
|
|
552
|
-
| **`
|
|
580
|
+
| Prop | Type | Description | Default | Since |
|
|
581
|
+
| ------------------ | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
|
|
582
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | <code>'zip'</code> | 6.6.0 |
|
|
583
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle. | | 5.0.0 |
|
|
584
|
+
| **`checksum`** | <code>string</code> | The checksum of the bundle to verify the integrity of the ZIP file. Must be a SHA-256 hash in base64 format. | | 6.1.0 |
|
|
585
|
+
| **`url`** | <code>string</code> | The URL of the bundle to download. For the `zip` artifact type, the URL must point to a ZIP file. For the `manifest` artifact type, the URL serves as the base URL to download the individual files. For example, if the URL is `https://example.com/download`, the plugin will download the file with the href `index.html` from `https://example.com/download?href=index.html`. To **verify the integrity** of the file, the server must return a `X-Checksum` header with the SHA-256 hash in base64 format. To **verify the signature** of the file, the server must return a `X-Signature` header with the signed SHA-256 hash in base64 format. | | 5.0.0 |
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
#### FetchLatestBundleResult
|
|
589
|
+
|
|
590
|
+
| Prop | Type | Description | Since |
|
|
591
|
+
| -------------- | --------------------------- | ------------------------------------------------------------------------------ | ----- |
|
|
592
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. If `null`, no bundle is available. | 6.6.0 |
|
|
553
593
|
|
|
554
594
|
|
|
555
595
|
#### GetBundleResult
|
|
@@ -20,6 +20,7 @@ import io.capawesome.capacitorjs.plugins.liveupdate.classes.options.DownloadBund
|
|
|
20
20
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.options.SetBundleOptions;
|
|
21
21
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.options.SetChannelOptions;
|
|
22
22
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.options.SetCustomIdOptions;
|
|
23
|
+
import io.capawesome.capacitorjs.plugins.liveupdate.classes.results.FetchLatestBundleResult;
|
|
23
24
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.results.GetBundleResult;
|
|
24
25
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.results.GetBundlesResult;
|
|
25
26
|
import io.capawesome.capacitorjs.plugins.liveupdate.classes.results.GetChannelResult;
|
|
@@ -120,6 +121,7 @@ public class LiveUpdate {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
public void downloadBundle(@NonNull DownloadBundleOptions options, @NonNull EmptyCallback callback) throws Exception {
|
|
124
|
+
ArtifactType artifactType = options.getArtifactType();
|
|
123
125
|
String bundleId = options.getBundleId();
|
|
124
126
|
String checksum = options.getChecksum();
|
|
125
127
|
String url = options.getUrl();
|
|
@@ -132,10 +134,20 @@ public class LiveUpdate {
|
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
// Download the bundle
|
|
135
|
-
|
|
137
|
+
if (artifactType == ArtifactType.MANIFEST) {
|
|
138
|
+
downloadBundleOfTypeManifest(bundleId, url);
|
|
139
|
+
} else {
|
|
140
|
+
downloadBundleOfTypeZip(bundleId, url, checksum);
|
|
141
|
+
}
|
|
136
142
|
callback.success();
|
|
137
143
|
}
|
|
138
144
|
|
|
145
|
+
public void fetchLatestBundle(@NonNull NonEmptyCallback callback) throws Exception {
|
|
146
|
+
GetLatestBundleResponse response = fetchLatestBundle();
|
|
147
|
+
FetchLatestBundleResult result = new FetchLatestBundleResult(response == null ? null : response.getBundleId());
|
|
148
|
+
callback.success(result);
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
public void getBundle(@NonNull NonEmptyCallback callback) {
|
|
140
152
|
String bundleId = getCurrentBundleId();
|
|
141
153
|
if (bundleId.equals(defaultWebAssetDir)) {
|
package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java
CHANGED
|
@@ -19,7 +19,7 @@ import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
|
|
|
19
19
|
public class LiveUpdatePlugin extends Plugin {
|
|
20
20
|
|
|
21
21
|
public static final String TAG = "LiveUpdate";
|
|
22
|
-
public static final String VERSION = "6.
|
|
22
|
+
public static final String VERSION = "6.6.0";
|
|
23
23
|
public static final String SHARED_PREFERENCES_NAME = "CapawesomeLiveUpdate"; // DO NOT CHANGE
|
|
24
24
|
public static final String ERROR_APP_ID_MISSING = "appId must be configured.";
|
|
25
25
|
public static final String ERROR_BUNDLE_EXISTS = "bundle already exists.";
|
|
@@ -86,6 +86,7 @@ public class LiveUpdatePlugin extends Plugin {
|
|
|
86
86
|
@PluginMethod
|
|
87
87
|
public void downloadBundle(PluginCall call) {
|
|
88
88
|
try {
|
|
89
|
+
String artifactType = call.getString("artifactType", "zip");
|
|
89
90
|
String bundleId = call.getString("bundleId");
|
|
90
91
|
if (bundleId == null) {
|
|
91
92
|
call.reject(ERROR_BUNDLE_ID_MISSING);
|
|
@@ -98,7 +99,7 @@ public class LiveUpdatePlugin extends Plugin {
|
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
DownloadBundleOptions options = new DownloadBundleOptions(bundleId, checksum, url);
|
|
102
|
+
DownloadBundleOptions options = new DownloadBundleOptions(artifactType, bundleId, checksum, url);
|
|
102
103
|
EmptyCallback callback = new EmptyCallback() {
|
|
103
104
|
@Override
|
|
104
105
|
public void success() {
|
|
@@ -117,6 +118,27 @@ public class LiveUpdatePlugin extends Plugin {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
@PluginMethod
|
|
122
|
+
public void fetchLatestBundle(PluginCall call) {
|
|
123
|
+
try {
|
|
124
|
+
NonEmptyCallback<Result> callback = new NonEmptyCallback<>() {
|
|
125
|
+
@Override
|
|
126
|
+
public void success(Result result) {
|
|
127
|
+
call.resolve(result.toJSObject());
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@Override
|
|
131
|
+
public void error(Exception exception) {
|
|
132
|
+
rejectCall(call, exception);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
implementation.fetchLatestBundle(callback);
|
|
137
|
+
} catch (Exception exception) {
|
|
138
|
+
rejectCall(call, exception);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
120
142
|
@PluginMethod
|
|
121
143
|
public void getBundle(PluginCall call) {
|
|
122
144
|
try {
|
|
@@ -2,9 +2,13 @@ package io.capawesome.capacitorjs.plugins.liveupdate.classes.options;
|
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
4
|
import androidx.annotation.Nullable;
|
|
5
|
+
import io.capawesome.capacitorjs.plugins.liveupdate.enums.ArtifactType;
|
|
5
6
|
|
|
6
7
|
public class DownloadBundleOptions {
|
|
7
8
|
|
|
9
|
+
@NonNull
|
|
10
|
+
private ArtifactType artifactType;
|
|
11
|
+
|
|
8
12
|
@NonNull
|
|
9
13
|
private String bundleId;
|
|
10
14
|
|
|
@@ -14,12 +18,22 @@ public class DownloadBundleOptions {
|
|
|
14
18
|
@NonNull
|
|
15
19
|
private String url;
|
|
16
20
|
|
|
17
|
-
public DownloadBundleOptions(@NonNull String bundleId, @Nullable String checksum, @NonNull String url) {
|
|
21
|
+
public DownloadBundleOptions(@NonNull String artifactType, @NonNull String bundleId, @Nullable String checksum, @NonNull String url) {
|
|
22
|
+
if (artifactType.equals("manifest")) {
|
|
23
|
+
this.artifactType = ArtifactType.MANIFEST;
|
|
24
|
+
} else {
|
|
25
|
+
this.artifactType = ArtifactType.ZIP;
|
|
26
|
+
}
|
|
18
27
|
this.bundleId = bundleId;
|
|
19
28
|
this.checksum = checksum;
|
|
20
29
|
this.url = url;
|
|
21
30
|
}
|
|
22
31
|
|
|
32
|
+
@NonNull
|
|
33
|
+
public ArtifactType getArtifactType() {
|
|
34
|
+
return artifactType;
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
@NonNull
|
|
24
38
|
public String getBundleId() {
|
|
25
39
|
return bundleId;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package io.capawesome.capacitorjs.plugins.liveupdate.classes.results;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.getcapacitor.JSObject;
|
|
5
|
+
import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
|
|
6
|
+
import org.json.JSONObject;
|
|
7
|
+
|
|
8
|
+
public class FetchLatestBundleResult implements Result {
|
|
9
|
+
|
|
10
|
+
@Nullable
|
|
11
|
+
private String bundleId;
|
|
12
|
+
|
|
13
|
+
public FetchLatestBundleResult(@Nullable String bundleId) {
|
|
14
|
+
this.bundleId = bundleId;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public JSObject toJSObject() {
|
|
18
|
+
JSObject result = new JSObject();
|
|
19
|
+
result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/docs.json
CHANGED
|
@@ -51,6 +51,23 @@
|
|
|
51
51
|
],
|
|
52
52
|
"slug": "downloadbundle"
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "fetchLatestBundle",
|
|
56
|
+
"signature": "() => Promise<FetchLatestBundleResult>",
|
|
57
|
+
"parameters": [],
|
|
58
|
+
"returns": "Promise<FetchLatestBundleResult>",
|
|
59
|
+
"tags": [
|
|
60
|
+
{
|
|
61
|
+
"name": "since",
|
|
62
|
+
"text": "6.6.0"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"docs": "Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).\n\nOnly available on Android and iOS.",
|
|
66
|
+
"complexTypes": [
|
|
67
|
+
"FetchLatestBundleResult"
|
|
68
|
+
],
|
|
69
|
+
"slug": "fetchlatestbundle"
|
|
70
|
+
},
|
|
54
71
|
{
|
|
55
72
|
"name": "getBundle",
|
|
56
73
|
"signature": "() => Promise<GetBundleResult>",
|
|
@@ -342,6 +359,26 @@
|
|
|
342
359
|
"tags": [],
|
|
343
360
|
"methods": [],
|
|
344
361
|
"properties": [
|
|
362
|
+
{
|
|
363
|
+
"name": "artifactType",
|
|
364
|
+
"tags": [
|
|
365
|
+
{
|
|
366
|
+
"text": "6.6.0",
|
|
367
|
+
"name": "since"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"text": "'zip'",
|
|
371
|
+
"name": "default"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"text": "'manifest'",
|
|
375
|
+
"name": "example"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"docs": "The artifact type of the bundle.",
|
|
379
|
+
"complexTypes": [],
|
|
380
|
+
"type": "'manifest' | 'zip' | undefined"
|
|
381
|
+
},
|
|
345
382
|
{
|
|
346
383
|
"name": "bundleId",
|
|
347
384
|
"tags": [
|
|
@@ -366,11 +403,11 @@
|
|
|
366
403
|
"name": "since"
|
|
367
404
|
},
|
|
368
405
|
{
|
|
369
|
-
"text": "
|
|
370
|
-
"name": "
|
|
406
|
+
"text": "The server should return a `X-Checksum` header instead.",
|
|
407
|
+
"name": "deprecated"
|
|
371
408
|
}
|
|
372
409
|
],
|
|
373
|
-
"docs": "The checksum of the bundle to verify the integrity of the ZIP file.\n\nMust be a SHA-256 hash in
|
|
410
|
+
"docs": "The checksum of the bundle to verify the integrity of the ZIP file.\n\nMust be a SHA-256 hash in base64 format.",
|
|
374
411
|
"complexTypes": [],
|
|
375
412
|
"type": "string | undefined"
|
|
376
413
|
},
|
|
@@ -386,12 +423,38 @@
|
|
|
386
423
|
"name": "example"
|
|
387
424
|
}
|
|
388
425
|
],
|
|
389
|
-
"docs": "The URL of the bundle to download.\n\
|
|
426
|
+
"docs": "The URL of the bundle to download.\n\nFor the `zip` artifact type, the URL must point to a ZIP file.\nFor the `manifest` artifact type, the URL serves as the base URL\nto download the individual files. For example, if the URL is\n`https://example.com/download`, the plugin will download the file\nwith the href `index.html` from `https://example.com/download?href=index.html`.\n\nTo **verify the integrity** of the file, the server must return\na `X-Checksum` header with the SHA-256 hash in base64 format.\n\nTo **verify the signature** of the file, the server must return\na `X-Signature` header with the signed SHA-256 hash in base64 format.",
|
|
390
427
|
"complexTypes": [],
|
|
391
428
|
"type": "string"
|
|
392
429
|
}
|
|
393
430
|
]
|
|
394
431
|
},
|
|
432
|
+
{
|
|
433
|
+
"name": "FetchLatestBundleResult",
|
|
434
|
+
"slug": "fetchlatestbundleresult",
|
|
435
|
+
"docs": "",
|
|
436
|
+
"tags": [
|
|
437
|
+
{
|
|
438
|
+
"text": "6.6.0",
|
|
439
|
+
"name": "since"
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
"methods": [],
|
|
443
|
+
"properties": [
|
|
444
|
+
{
|
|
445
|
+
"name": "bundleId",
|
|
446
|
+
"tags": [
|
|
447
|
+
{
|
|
448
|
+
"text": "6.6.0",
|
|
449
|
+
"name": "since"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"docs": "The unique identifier of the latest bundle.\n\nIf `null`, no bundle is available.",
|
|
453
|
+
"complexTypes": [],
|
|
454
|
+
"type": "string | null"
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
},
|
|
395
458
|
{
|
|
396
459
|
"name": "GetBundleResult",
|
|
397
460
|
"slug": "getbundleresult",
|
|
@@ -93,6 +93,14 @@ export interface LiveUpdatePlugin {
|
|
|
93
93
|
* @since 5.0.0
|
|
94
94
|
*/
|
|
95
95
|
downloadBundle(options: DownloadBundleOptions): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
98
|
+
*
|
|
99
|
+
* Only available on Android and iOS.
|
|
100
|
+
*
|
|
101
|
+
* @since 6.6.0
|
|
102
|
+
*/
|
|
103
|
+
fetchLatestBundle(): Promise<FetchLatestBundleResult>;
|
|
96
104
|
/**
|
|
97
105
|
* Get the active bundle identifier.
|
|
98
106
|
*
|
|
@@ -228,6 +236,14 @@ export interface DeleteBundleOptions {
|
|
|
228
236
|
bundleId: string;
|
|
229
237
|
}
|
|
230
238
|
export interface DownloadBundleOptions {
|
|
239
|
+
/**
|
|
240
|
+
* The artifact type of the bundle.
|
|
241
|
+
*
|
|
242
|
+
* @since 6.6.0
|
|
243
|
+
* @default 'zip'
|
|
244
|
+
* @example 'manifest'
|
|
245
|
+
*/
|
|
246
|
+
artifactType?: 'manifest' | 'zip';
|
|
231
247
|
/**
|
|
232
248
|
* The unique identifier of the bundle.
|
|
233
249
|
*
|
|
@@ -238,22 +254,45 @@ export interface DownloadBundleOptions {
|
|
|
238
254
|
/**
|
|
239
255
|
* The checksum of the bundle to verify the integrity of the ZIP file.
|
|
240
256
|
*
|
|
241
|
-
* Must be a SHA-256 hash in
|
|
257
|
+
* Must be a SHA-256 hash in base64 format.
|
|
242
258
|
*
|
|
243
259
|
* @since 6.1.0
|
|
244
|
-
* @
|
|
260
|
+
* @deprecated The server should return a `X-Checksum` header instead.
|
|
245
261
|
*/
|
|
246
262
|
checksum?: string;
|
|
247
263
|
/**
|
|
248
264
|
* The URL of the bundle to download.
|
|
249
265
|
*
|
|
250
|
-
*
|
|
266
|
+
* For the `zip` artifact type, the URL must point to a ZIP file.
|
|
267
|
+
* For the `manifest` artifact type, the URL serves as the base URL
|
|
268
|
+
* to download the individual files. For example, if the URL is
|
|
269
|
+
* `https://example.com/download`, the plugin will download the file
|
|
270
|
+
* with the href `index.html` from `https://example.com/download?href=index.html`.
|
|
271
|
+
*
|
|
272
|
+
* To **verify the integrity** of the file, the server must return
|
|
273
|
+
* a `X-Checksum` header with the SHA-256 hash in base64 format.
|
|
274
|
+
*
|
|
275
|
+
* To **verify the signature** of the file, the server must return
|
|
276
|
+
* a `X-Signature` header with the signed SHA-256 hash in base64 format.
|
|
251
277
|
*
|
|
252
278
|
* @since 5.0.0
|
|
253
279
|
* @example 'https://example.com/bundle.zip'
|
|
254
280
|
*/
|
|
255
281
|
url: string;
|
|
256
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* @since 6.6.0
|
|
285
|
+
*/
|
|
286
|
+
export interface FetchLatestBundleResult {
|
|
287
|
+
/**
|
|
288
|
+
* The unique identifier of the latest bundle.
|
|
289
|
+
*
|
|
290
|
+
* If `null`, no bundle is available.
|
|
291
|
+
*
|
|
292
|
+
* @since 6.6.0
|
|
293
|
+
*/
|
|
294
|
+
bundleId: string | null;
|
|
295
|
+
}
|
|
257
296
|
/**
|
|
258
297
|
* @since 5.0.0
|
|
259
298
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n LiveUpdate?: {\n /**\n * The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * This is **NOT** the same as the app identifier (e.g. `com.example.app`).\n * This is a unique identifier generated by Capawesome Cloud (e.g. `6e351b4f-69a7-415e-a057-4567df7ffe94`).\n *\n * @since 5.0.0\n * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'\n */\n appId?: string;\n /**\n * Whether or not to automatically delete unused bundles.\n *\n * When enabled, the plugin will automatically delete unused bundles after calling `ready()`.\n *\n * @since 5.0.0\n * @default false\n */\n autoDeleteBundles?: boolean;\n /**\n * The default channel of the app.\n *\n * @since 6.3.0\n * @example 'production'\n */\n defaultChannel?: string;\n /**\n * Whether or not the plugin is enabled.\n *\n * @since 5.0.0\n * @default true\n */\n enabled?: boolean;\n /**\n * The timeout in milliseconds for HTTP requests.\n *\n * @since 6.4.0\n * @default 60000\n */\n httpTimeout?: number;\n /**\n * The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * @since 6.2.0\n * @default 'us'\n * @example 'eu'\n * @see https://capawesome.io/cloud/live-updates/advanced/privacy/\n */\n location?: 'us' | 'eu';\n /**\n * The public key to verify the integrity of the bundle.\n *\n * The public key must be a PEM-encoded RSA public key.\n *\n * @since 6.1.0\n * @example '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----'\n */\n publicKey?: string;\n /**\n * The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle.\n *\n * @since 5.0.0\n * @default 10000\n */\n readyTimeout?: number;\n /**\n * Whether or not the app should be reset to the default bundle during an update.\n *\n * @since 5.0.0\n * @default true\n */\n resetOnUpdate?: boolean;\n };\n }\n}\n\nexport interface LiveUpdatePlugin {\n /**\n * Delete a bundle from the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n deleteBundle(options: DeleteBundleOptions): Promise<void>;\n /**\n * Download a bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n downloadBundle(options: DownloadBundleOptions): Promise<void>;\n /**\n * Get the active bundle identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundle(): Promise<GetBundleResult>;\n /**\n * Get all identifiers of bundles that have been downloaded.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the device identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the version code of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionCode(): Promise<GetVersionCodeResult>;\n /**\n * Get the version name of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionName(): Promise<GetVersionNameResult>;\n /**\n * Notify the plugin that the app is ready to use and no rollback is needed.\n *\n * **Attention**: This method should be called as soon as the app is ready to use\n * to prevent the app from being reset to the default bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n ready(): Promise<void>;\n /**\n * Reload the app to apply the new bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reload(): Promise<void>;\n /**\n * Reset the app to the default bundle.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reset(): Promise<void>;\n /**\n * Set the next bundle to use for the app.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setBundle(options: SetBundleOptions): Promise<void>;\n /**\n * Set the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setChannel(options: SetChannelOptions): Promise<void>;\n /**\n * Set the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n /**\n * Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n sync(): Promise<SyncResult>;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface DeleteBundleOptions {\n /**\n * The unique identifier of the bundle to delete.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\nexport interface DownloadBundleOptions {\n /**\n * The unique identifier of the bundle.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n /**\n * The checksum of the bundle to verify the integrity of the ZIP file.\n *\n * Must be a SHA-256 hash in hexadecimal format.\n *\n * @since 6.1.0\n * @example 'aab8e0a312e807c8eaeb923e2bdccd7731c5508869c62ad8e6e43ee881414c84'\n */\n checksum?: string;\n /**\n * The URL of the bundle to download.\n *\n * The bundle must be a ZIP file containing at least a `index.html` file.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundleResult {\n /**\n * The unique identifier of the active bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundlesResult {\n /**\n * An array of unique identifiers of all available bundles.\n *\n * @since 5.0.0\n */\n bundleIds: string[];\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetChannelResult {\n /**\n * The channel of the app.\n *\n * If `null`, the app is using the default channel.\n *\n * @since 5.0.0\n * @example 'production'\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetDeviceIdResult {\n /**\n * The unique identifier of the device.\n *\n * On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used.\n * The value of this property is the same for apps that come from the same vendor running on the same device.\n *\n * @since 5.0.0\n *\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n deviceId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionCodeResult {\n /**\n * The version code of the app.\n *\n * On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1\"\n */\n versionCode: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionNameResult {\n /**\n * The version name of the app.\n *\n * On **Android**, this is the `versionName` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1.0.0\"\n */\n versionName: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetCustomIdResult {\n /**\n * The custom identifier of the app.\n *\n * If `null`, no custom identifier is set.\n *\n * @since 5.0.0\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetChannelOptions {\n /**\n * The channel of the app.\n *\n * Set `null` to remove the channel.\n *\n * @since 5.0.0\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetCustomIdOptions {\n /**\n * The custom identifier of the app.\n *\n * Set `null` to remove the custom identifier.\n *\n * @since 5.0.0\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SyncResult {\n /**\n * The identifier of the next bundle to use.\n *\n * If `null`, the app is up-to-date and no new bundle is available.\n *\n * @since 5.0.0\n */\n nextBundleId: string | null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n LiveUpdate?: {\n /**\n * The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * This is **NOT** the same as the app identifier (e.g. `com.example.app`).\n * This is a unique identifier generated by Capawesome Cloud (e.g. `6e351b4f-69a7-415e-a057-4567df7ffe94`).\n *\n * @since 5.0.0\n * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'\n */\n appId?: string;\n /**\n * Whether or not to automatically delete unused bundles.\n *\n * When enabled, the plugin will automatically delete unused bundles after calling `ready()`.\n *\n * @since 5.0.0\n * @default false\n */\n autoDeleteBundles?: boolean;\n /**\n * The default channel of the app.\n *\n * @since 6.3.0\n * @example 'production'\n */\n defaultChannel?: string;\n /**\n * Whether or not the plugin is enabled.\n *\n * @since 5.0.0\n * @default true\n */\n enabled?: boolean;\n /**\n * The timeout in milliseconds for HTTP requests.\n *\n * @since 6.4.0\n * @default 60000\n */\n httpTimeout?: number;\n /**\n * The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * @since 6.2.0\n * @default 'us'\n * @example 'eu'\n * @see https://capawesome.io/cloud/live-updates/advanced/privacy/\n */\n location?: 'us' | 'eu';\n /**\n * The public key to verify the integrity of the bundle.\n *\n * The public key must be a PEM-encoded RSA public key.\n *\n * @since 6.1.0\n * @example '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----'\n */\n publicKey?: string;\n /**\n * The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle.\n *\n * @since 5.0.0\n * @default 10000\n */\n readyTimeout?: number;\n /**\n * Whether or not the app should be reset to the default bundle during an update.\n *\n * @since 5.0.0\n * @default true\n */\n resetOnUpdate?: boolean;\n };\n }\n}\n\nexport interface LiveUpdatePlugin {\n /**\n * Delete a bundle from the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n deleteBundle(options: DeleteBundleOptions): Promise<void>;\n /**\n * Download a bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n downloadBundle(options: DownloadBundleOptions): Promise<void>;\n /**\n * Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Only available on Android and iOS.\n *\n * @since 6.6.0\n */\n fetchLatestBundle(): Promise<FetchLatestBundleResult>;\n /**\n * Get the active bundle identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundle(): Promise<GetBundleResult>;\n /**\n * Get all identifiers of bundles that have been downloaded.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the device identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the version code of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionCode(): Promise<GetVersionCodeResult>;\n /**\n * Get the version name of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionName(): Promise<GetVersionNameResult>;\n /**\n * Notify the plugin that the app is ready to use and no rollback is needed.\n *\n * **Attention**: This method should be called as soon as the app is ready to use\n * to prevent the app from being reset to the default bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n ready(): Promise<void>;\n /**\n * Reload the app to apply the new bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reload(): Promise<void>;\n /**\n * Reset the app to the default bundle.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reset(): Promise<void>;\n /**\n * Set the next bundle to use for the app.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setBundle(options: SetBundleOptions): Promise<void>;\n /**\n * Set the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setChannel(options: SetChannelOptions): Promise<void>;\n /**\n * Set the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n /**\n * Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n sync(): Promise<SyncResult>;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface DeleteBundleOptions {\n /**\n * The unique identifier of the bundle to delete.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\nexport interface DownloadBundleOptions {\n /**\n * The artifact type of the bundle.\n *\n * @since 6.6.0\n * @default 'zip'\n * @example 'manifest'\n */\n artifactType?: 'manifest' | 'zip';\n /**\n * The unique identifier of the bundle.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n /**\n * The checksum of the bundle to verify the integrity of the ZIP file.\n *\n * Must be a SHA-256 hash in base64 format.\n *\n * @since 6.1.0\n * @deprecated The server should return a `X-Checksum` header instead.\n */\n checksum?: string;\n /**\n * The URL of the bundle to download.\n *\n * For the `zip` artifact type, the URL must point to a ZIP file.\n * For the `manifest` artifact type, the URL serves as the base URL\n * to download the individual files. For example, if the URL is\n * `https://example.com/download`, the plugin will download the file\n * with the href `index.html` from `https://example.com/download?href=index.html`.\n *\n * To **verify the integrity** of the file, the server must return\n * a `X-Checksum` header with the SHA-256 hash in base64 format.\n *\n * To **verify the signature** of the file, the server must return\n * a `X-Signature` header with the signed SHA-256 hash in base64 format.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n}\n\n/**\n * @since 6.6.0\n */\nexport interface FetchLatestBundleResult {\n /**\n * The unique identifier of the latest bundle.\n *\n * If `null`, no bundle is available.\n *\n * @since 6.6.0\n */\n bundleId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundleResult {\n /**\n * The unique identifier of the active bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundlesResult {\n /**\n * An array of unique identifiers of all available bundles.\n *\n * @since 5.0.0\n */\n bundleIds: string[];\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetChannelResult {\n /**\n * The channel of the app.\n *\n * If `null`, the app is using the default channel.\n *\n * @since 5.0.0\n * @example 'production'\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetDeviceIdResult {\n /**\n * The unique identifier of the device.\n *\n * On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used.\n * The value of this property is the same for apps that come from the same vendor running on the same device.\n *\n * @since 5.0.0\n *\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n deviceId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionCodeResult {\n /**\n * The version code of the app.\n *\n * On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1\"\n */\n versionCode: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionNameResult {\n /**\n * The version name of the app.\n *\n * On **Android**, this is the `versionName` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1.0.0\"\n */\n versionName: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetCustomIdResult {\n /**\n * The custom identifier of the app.\n *\n * If `null`, no custom identifier is set.\n *\n * @since 5.0.0\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetChannelOptions {\n /**\n * The channel of the app.\n *\n * Set `null` to remove the channel.\n *\n * @since 5.0.0\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetCustomIdOptions {\n /**\n * The custom identifier of the app.\n *\n * Set `null` to remove the custom identifier.\n *\n * @since 5.0.0\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SyncResult {\n /**\n * The identifier of the next bundle to use.\n *\n * If `null`, the app is up-to-date and no new bundle is available.\n *\n * @since 5.0.0\n */\n nextBundleId: string | null;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { DeleteBundleOptions, DownloadBundleOptions, GetBundleResult, GetBundlesResult, GetChannelResult, GetCustomIdResult, GetDeviceIdResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SyncResult } from './definitions';
|
|
2
|
+
import type { DeleteBundleOptions, DownloadBundleOptions, FetchLatestBundleResult, GetBundleResult, GetBundlesResult, GetChannelResult, GetCustomIdResult, GetDeviceIdResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SyncResult } from './definitions';
|
|
3
3
|
export declare class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin {
|
|
4
4
|
deleteBundle(_options: DeleteBundleOptions): Promise<void>;
|
|
5
5
|
downloadBundle(_options: DownloadBundleOptions): Promise<void>;
|
|
6
|
+
fetchLatestBundle(): Promise<FetchLatestBundleResult>;
|
|
6
7
|
getBundle(): Promise<GetBundleResult>;
|
|
7
8
|
getBundles(): Promise<GetBundlesResult>;
|
|
8
9
|
getChannel(): Promise<GetChannelResult>;
|
package/dist/esm/web.js
CHANGED
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;AAoB5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IACnC,KAAK,CAAC,YAAY,CAAC,QAA6B;QACrD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,QAA+B;QACzD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC5B,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,QAA0B;QAC/C,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAA2B;QACjD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,QAA4B;QACnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEO,uBAAuB;QAC7B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n DeleteBundleOptions,\n DownloadBundleOptions,\n FetchLatestBundleResult,\n GetBundleResult,\n GetBundlesResult,\n GetChannelResult,\n GetCustomIdResult,\n GetDeviceIdResult,\n GetVersionCodeResult,\n GetVersionNameResult,\n LiveUpdatePlugin,\n SetBundleOptions,\n SetChannelOptions,\n SetCustomIdOptions,\n SyncResult,\n} from './definitions';\n\nexport class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin {\n public async deleteBundle(_options: DeleteBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async downloadBundle(_options: DownloadBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async fetchLatestBundle(): Promise<FetchLatestBundleResult> {\n this.throwUnimplementedError();\n }\n\n public async getBundle(): Promise<GetBundleResult> {\n this.throwUnimplementedError();\n }\n\n public async getBundles(): Promise<GetBundlesResult> {\n this.throwUnimplementedError();\n }\n\n public async getChannel(): Promise<GetChannelResult> {\n this.throwUnimplementedError();\n }\n\n public async getCustomId(): Promise<GetCustomIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getDeviceId(): Promise<GetDeviceIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionCode(): Promise<GetVersionCodeResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionName(): Promise<GetVersionNameResult> {\n this.throwUnimplementedError();\n }\n\n public async ready(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async reload(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async reset(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setBundle(_options: SetBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setChannel(_options: SetChannelOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setCustomId(_options: SetCustomIdOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async sync(): Promise<SyncResult> {\n this.throwUnimplementedError();\n }\n\n private throwUnimplementedError(): never {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then((m) => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,uBAAuB,GAAG;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then((m) => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async fetchLatestBundle() {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;AACvC,KAAK;AACL,IAAI,uBAAuB,GAAG;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -12,6 +12,9 @@ var capacitorLiveUpdate = (function (exports, core) {
|
|
|
12
12
|
async downloadBundle(_options) {
|
|
13
13
|
this.throwUnimplementedError();
|
|
14
14
|
}
|
|
15
|
+
async fetchLatestBundle() {
|
|
16
|
+
this.throwUnimplementedError();
|
|
17
|
+
}
|
|
15
18
|
async getBundle() {
|
|
16
19
|
this.throwUnimplementedError();
|
|
17
20
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then((m) => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,uBAAuB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then((m) => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async fetchLatestBundle() {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACvC,KAAK;IACL,IAAI,uBAAuB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,16 +2,26 @@ import Foundation
|
|
|
2
2
|
import Capacitor
|
|
3
3
|
|
|
4
4
|
@objc public class DownloadBundleOptions: NSObject {
|
|
5
|
+
private var artifactType: ArtifactType
|
|
5
6
|
private var bundleId: String
|
|
6
7
|
private var checksum: String?
|
|
7
8
|
private var url: String
|
|
8
9
|
|
|
9
|
-
init(bundleId: String, checksum: String?, url: String) {
|
|
10
|
+
init(artifactType: String, bundleId: String, checksum: String?, url: String) {
|
|
11
|
+
if artifactType == "manifest" {
|
|
12
|
+
self.artifactType = .manifest
|
|
13
|
+
} else {
|
|
14
|
+
self.artifactType = .zip
|
|
15
|
+
}
|
|
10
16
|
self.bundleId = bundleId
|
|
11
17
|
self.checksum = checksum
|
|
12
18
|
self.url = url
|
|
13
19
|
}
|
|
14
20
|
|
|
21
|
+
func getArtifactType() -> ArtifactType {
|
|
22
|
+
return artifactType
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
func getBundleId() -> String {
|
|
16
26
|
return bundleId
|
|
17
27
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class FetchLatestBundleResult: NSObject, Result {
|
|
5
|
+
let bundleId: String?
|
|
6
|
+
|
|
7
|
+
init(bundleId: String?) {
|
|
8
|
+
self.bundleId = bundleId
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -4,7 +4,7 @@ import SSZipArchive
|
|
|
4
4
|
import Capacitor
|
|
5
5
|
import Alamofire
|
|
6
6
|
import CommonCrypto
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
// swiftlint:disable type_body_length
|
|
9
9
|
@objc public class LiveUpdate: NSObject {
|
|
10
10
|
private let bundlesDirectory = "NoCloud/ionic_built_snapshots" // DO NOT CHANGE! (See https://dub.sh/BLluidt)
|
|
@@ -61,6 +61,7 @@ import CommonCrypto
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
@objc public func downloadBundle(_ options: DownloadBundleOptions) async throws {
|
|
64
|
+
let artifactType = options.getArtifactType()
|
|
64
65
|
let bundleId = options.getBundleId()
|
|
65
66
|
let checksum = options.getChecksum()
|
|
66
67
|
let url = options.getUrl()
|
|
@@ -71,7 +72,16 @@ import CommonCrypto
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// Download the bundle
|
|
74
|
-
|
|
75
|
+
if artifactType == .manifest {
|
|
76
|
+
try await downloadBundleOfTypeManifest(bundleId: bundleId, url: url)
|
|
77
|
+
} else {
|
|
78
|
+
try await downloadBundleOfTypeZip(bundleId: bundleId, url: url, checksum: checksum)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@objc public func fetchLatestBundle() async throws -> FetchLatestBundleResult {
|
|
83
|
+
let response: GetLatestBundleResponse? = try await self.fetchLatestBundle()
|
|
84
|
+
return FetchLatestBundleResult(bundleId: response?.bundleId)
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
@objc public func getBundle(completion: @escaping (Result?, Error?) -> Void) {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
CAP_PLUGIN(LiveUpdatePlugin, "LiveUpdate",
|
|
7
7
|
CAP_PLUGIN_METHOD(deleteBundle, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(downloadBundle, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(fetchLatestBundle, CAPPluginReturnPromise);
|
|
9
10
|
CAP_PLUGIN_METHOD(getBundle, CAPPluginReturnPromise);
|
|
10
11
|
CAP_PLUGIN_METHOD(getBundles, CAPPluginReturnPromise);
|
|
11
12
|
CAP_PLUGIN_METHOD(getChannel, CAPPluginReturnPromise);
|
|
@@ -8,7 +8,7 @@ import Capacitor
|
|
|
8
8
|
@objc(LiveUpdatePlugin)
|
|
9
9
|
public class LiveUpdatePlugin: CAPPlugin {
|
|
10
10
|
public static let tag = "LiveUpdate"
|
|
11
|
-
public static let version = "6.
|
|
11
|
+
public static let version = "6.6.0"
|
|
12
12
|
public static let userDefaultsPrefix = "CapawesomeLiveUpdate" // DO NOT CHANGE
|
|
13
13
|
|
|
14
14
|
private var config: LiveUpdateConfig?
|
|
@@ -40,6 +40,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
40
40
|
@objc func downloadBundle(_ call: CAPPluginCall) {
|
|
41
41
|
Task {
|
|
42
42
|
do {
|
|
43
|
+
let artifactType = call.getString("artifactType", "zip")
|
|
43
44
|
guard let bundleId = call.getString("bundleId") else {
|
|
44
45
|
call.reject(CustomError.bundleIdMissing.localizedDescription)
|
|
45
46
|
return
|
|
@@ -50,7 +51,7 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
50
51
|
return
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
let options = DownloadBundleOptions(bundleId: bundleId, checksum: checksum, url: url)
|
|
54
|
+
let options = DownloadBundleOptions(artifactType: artifactType, bundleId: bundleId, checksum: checksum, url: url)
|
|
54
55
|
|
|
55
56
|
try await implementation?.downloadBundle(options)
|
|
56
57
|
call.resolve()
|
|
@@ -60,6 +61,19 @@ public class LiveUpdatePlugin: CAPPlugin {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
@objc func fetchLatestBundle(_ call: CAPPluginCall) {
|
|
65
|
+
Task {
|
|
66
|
+
do {
|
|
67
|
+
let result = try await implementation?.fetchLatestBundle()
|
|
68
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
69
|
+
call.resolve(result)
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
rejectCall(call, error)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
@objc func getBundle(_ call: CAPPluginCall) {
|
|
64
78
|
implementation?.getBundle(completion: { result, error in
|
|
65
79
|
if let error = error {
|