@capawesome/cordova-live-update 0.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1113 -0
  3. package/dist/docs.json +1654 -0
  4. package/dist/esm/definitions.d.ts +788 -0
  5. package/dist/esm/definitions.js +7 -0
  6. package/dist/esm/definitions.js.map +1 -0
  7. package/dist/esm/exec.d.ts +1 -0
  8. package/dist/esm/exec.js +8 -0
  9. package/dist/esm/exec.js.map +1 -0
  10. package/dist/esm/index.d.ts +4 -0
  11. package/dist/esm/index.js +46 -0
  12. package/dist/esm/index.js.map +1 -0
  13. package/dist/plugin.js +56 -0
  14. package/dist/plugin.js.map +1 -0
  15. package/package.json +93 -0
  16. package/plugin.xml +268 -0
  17. package/src/android/capawesome-cordova-live-update.gradle +12 -0
  18. package/src/android/capawesome-live-update.xml +5 -0
  19. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdate.java +1480 -0
  20. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateConfig.java +105 -0
  21. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateHttpClient.java +114 -0
  22. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePathHandler.java +96 -0
  23. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePlugin.java +550 -0
  24. package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePreferences.java +151 -0
  25. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/Manifest.java +58 -0
  26. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/ManifestItem.java +37 -0
  27. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetChannelsResponseItem.java +28 -0
  28. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +74 -0
  29. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +33 -0
  30. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/NextBundleSetEvent.java +26 -0
  31. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DeleteBundleOptions.java +18 -0
  32. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DownloadBundleOptions.java +66 -0
  33. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchChannelsOptions.java +39 -0
  34. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchLatestBundleOptions.java +25 -0
  35. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetChannelOptions.java +18 -0
  36. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetConfigOptions.java +20 -0
  37. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetCustomIdOptions.java +18 -0
  38. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetNextBundleOptions.java +21 -0
  39. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SyncOptions.java +25 -0
  40. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ChannelResult.java +29 -0
  41. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchChannelsResult.java +29 -0
  42. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +69 -0
  43. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +28 -0
  44. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBundlesResult.java +28 -0
  45. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetChannelResult.java +22 -0
  46. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
  47. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCurrentBundleResult.java +22 -0
  48. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCustomIdResult.java +22 -0
  49. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDeviceIdResult.java +22 -0
  50. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +28 -0
  51. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetNextBundleResult.java +22 -0
  52. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionCodeResult.java +21 -0
  53. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionNameResult.java +22 -0
  54. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/IsSyncingResult.java +27 -0
  55. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
  56. package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/SyncResult.java +22 -0
  57. package/src/android/io/capawesome/cordova/plugins/liveupdate/enums/ArtifactType.java +6 -0
  58. package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Callback.java +5 -0
  59. package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
  60. package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/EmptyCallback.java +5 -0
  61. package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/NonEmptyCallback.java +7 -0
  62. package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Result.java +8 -0
  63. package/src/ios/LiveUpdate.swift +895 -0
  64. package/src/ios/LiveUpdateArtifactType.swift +4 -0
  65. package/src/ios/LiveUpdateChannelResult.swift +18 -0
  66. package/src/ios/LiveUpdateConfig.swift +11 -0
  67. package/src/ios/LiveUpdateDeleteBundleOptions.swift +13 -0
  68. package/src/ios/LiveUpdateDownloadBundleOptions.swift +41 -0
  69. package/src/ios/LiveUpdateDownloadBundleProgressEvent.swift +24 -0
  70. package/src/ios/LiveUpdateError.swift +62 -0
  71. package/src/ios/LiveUpdateFetchChannelsOptions.swift +25 -0
  72. package/src/ios/LiveUpdateFetchChannelsResult.swift +15 -0
  73. package/src/ios/LiveUpdateFetchLatestBundleOptions.swift +17 -0
  74. package/src/ios/LiveUpdateFetchLatestBundleResult.swift +42 -0
  75. package/src/ios/LiveUpdateGetBlockedBundlesResult.swift +15 -0
  76. package/src/ios/LiveUpdateGetBundlesResult.swift +15 -0
  77. package/src/ios/LiveUpdateGetChannelResult.swift +15 -0
  78. package/src/ios/LiveUpdateGetChannelsResponseItem.swift +4 -0
  79. package/src/ios/LiveUpdateGetConfigResult.swift +18 -0
  80. package/src/ios/LiveUpdateGetCurrentBundleResult.swift +15 -0
  81. package/src/ios/LiveUpdateGetCustomIdResult.swift +15 -0
  82. package/src/ios/LiveUpdateGetDeviceIdResult.swift +15 -0
  83. package/src/ios/LiveUpdateGetDownloadedBundlesResult.swift +15 -0
  84. package/src/ios/LiveUpdateGetLatestBundleResponse.swift +8 -0
  85. package/src/ios/LiveUpdateGetNextBundleResult.swift +15 -0
  86. package/src/ios/LiveUpdateGetVersionCodeResult.swift +15 -0
  87. package/src/ios/LiveUpdateGetVersionNameResult.swift +15 -0
  88. package/src/ios/LiveUpdateHttpClient.swift +58 -0
  89. package/src/ios/LiveUpdateIsSyncingResult.swift +15 -0
  90. package/src/ios/LiveUpdateManifest.swift +19 -0
  91. package/src/ios/LiveUpdateManifestItem.swift +5 -0
  92. package/src/ios/LiveUpdateNextBundleSetEvent.swift +15 -0
  93. package/src/ios/LiveUpdatePlugin.swift +521 -0
  94. package/src/ios/LiveUpdatePreferences.swift +116 -0
  95. package/src/ios/LiveUpdateReadyResult.swift +21 -0
  96. package/src/ios/LiveUpdateResult.swift +5 -0
  97. package/src/ios/LiveUpdateSchemeHandler.swift +286 -0
  98. package/src/ios/LiveUpdateSetChannelOptions.swift +13 -0
  99. package/src/ios/LiveUpdateSetConfigOptions.swift +13 -0
  100. package/src/ios/LiveUpdateSetCustomIdOptions.swift +13 -0
  101. package/src/ios/LiveUpdateSetNextBundleOptions.swift +13 -0
  102. package/src/ios/LiveUpdateSyncOptions.swift +17 -0
  103. package/src/ios/LiveUpdateSyncResult.swift +15 -0
@@ -0,0 +1,788 @@
1
+ /**
2
+ * Handle returned from `addListener(...)`. Call `remove()` to detach the
3
+ * listener.
4
+ *
5
+ * @since 0.1.0
6
+ */
7
+ export interface PluginListenerHandle {
8
+ remove: () => Promise<void>;
9
+ }
10
+ export interface LiveUpdatePlugin {
11
+ /**
12
+ * Clear all blocked bundles from the blocked list.
13
+ *
14
+ * This removes all bundle identifiers that were automatically blocked
15
+ * due to rollbacks when `autoBlockRolledBackBundles` is enabled.
16
+ *
17
+ * @since 0.1.0
18
+ */
19
+ clearBlockedBundles(): Promise<void>;
20
+ /**
21
+ * Delete a bundle from the app.
22
+ *
23
+ * @since 0.1.0
24
+ */
25
+ deleteBundle(options: DeleteBundleOptions): Promise<void>;
26
+ /**
27
+ * Download a bundle.
28
+ *
29
+ * @since 0.1.0
30
+ */
31
+ downloadBundle(options: DownloadBundleOptions): Promise<void>;
32
+ /**
33
+ * Fetch channels from [Capawesome Cloud](https://capawesome.io/cloud/).
34
+ *
35
+ * This is primarily intended for development and QA purposes.
36
+ * It allows you to retrieve a list of available channels so you can
37
+ * dynamically switch between them using `setChannel(...)`.
38
+ *
39
+ * **Attention**: Only works for apps with public channels enabled.
40
+ * If channels are private, they can still be set using `setChannel(...)`
41
+ * but won't be returned by this method.
42
+ *
43
+ * @since 0.1.0
44
+ */
45
+ fetchChannels(options?: FetchChannelsOptions): Promise<FetchChannelsResult>;
46
+ /**
47
+ * Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).
48
+ *
49
+ * @since 0.1.0
50
+ */
51
+ fetchLatestBundle(options?: FetchLatestBundleOptions): Promise<FetchLatestBundleResult>;
52
+ /**
53
+ * Get all blocked bundle identifiers.
54
+ *
55
+ * Returns the list of bundle identifiers that were automatically blocked
56
+ * due to rollbacks when `autoBlockRolledBackBundles` is enabled.
57
+ *
58
+ * @since 0.1.0
59
+ */
60
+ getBlockedBundles(): Promise<GetBlockedBundlesResult>;
61
+ /**
62
+ * Get all identifiers of bundles that have been downloaded.
63
+ *
64
+ * @since 0.1.0
65
+ * @deprecated Use `getDownloadedBundles()` instead.
66
+ */
67
+ getBundles(): Promise<GetBundlesResult>;
68
+ /**
69
+ * Get the channel that is used for the update.
70
+ *
71
+ * The channel is resolved in the following order (highest priority first):
72
+ * 1. `setChannel()` (SharedPreferences on Android / UserDefaults on iOS)
73
+ * 2. Native config (`CapawesomeLiveUpdateDefaultChannel` in `Info.plist` on iOS or
74
+ * `capawesome_live_update_default_channel` in `strings.xml` on Android)
75
+ * 3. The `DEFAULT_CHANNEL` preference in `config.xml`
76
+ *
77
+ * **Note**: The `channel` parameter of `sync()` takes the highest priority
78
+ * but is not persisted and therefore not returned by this method.
79
+ *
80
+ * @since 0.1.0
81
+ */
82
+ getChannel(): Promise<GetChannelResult>;
83
+ /**
84
+ * Get the runtime configuration.
85
+ *
86
+ * Returns the current plugin configuration including any runtime
87
+ * overrides set via `setConfig()`.
88
+ *
89
+ * @since 0.1.0
90
+ */
91
+ getConfig(): Promise<GetConfigResult>;
92
+ /**
93
+ * Get all identifiers of bundles that have been downloaded.
94
+ *
95
+ * @since 0.1.0
96
+ */
97
+ getDownloadedBundles(): Promise<GetDownloadedBundlesResult>;
98
+ /**
99
+ * Get the bundle identifier of the current bundle.
100
+ * The current bundle is the bundle that is currently used by the app.
101
+ *
102
+ * @since 0.1.0
103
+ */
104
+ getCurrentBundle(): Promise<GetCurrentBundleResult>;
105
+ /**
106
+ * Get the custom identifier of the device.
107
+ *
108
+ * @since 0.1.0
109
+ */
110
+ getCustomId(): Promise<GetCustomIdResult>;
111
+ /**
112
+ * Get the unique device identifier.
113
+ *
114
+ * @since 0.1.0
115
+ */
116
+ getDeviceId(): Promise<GetDeviceIdResult>;
117
+ /**
118
+ * Check whether a sync operation is currently in progress.
119
+ *
120
+ * @since 0.1.0
121
+ */
122
+ isSyncing(): Promise<IsSyncingResult>;
123
+ /**
124
+ * Get the bundle identifier of the next bundle.
125
+ * The next bundle is the bundle that will be used after calling `reload()`
126
+ * or restarting the app.
127
+ *
128
+ * @since 0.1.0
129
+ */
130
+ getNextBundle(): Promise<GetNextBundleResult>;
131
+ /**
132
+ * Get the version code of the app.
133
+ *
134
+ * On **Android**, this is the `versionCode` from `PackageInfo`.
135
+ * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.
136
+ *
137
+ * @since 0.1.0
138
+ */
139
+ getVersionCode(): Promise<GetVersionCodeResult>;
140
+ /**
141
+ * Get the version name of the app.
142
+ *
143
+ * On **Android**, this is the `versionName` from `PackageInfo`.
144
+ * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.
145
+ *
146
+ * @since 0.1.0
147
+ */
148
+ getVersionName(): Promise<GetVersionNameResult>;
149
+ /**
150
+ * Notify the plugin that the app is ready to use and no rollback is needed.
151
+ *
152
+ * **Attention**: This method should be called as soon as the app is ready to use
153
+ * to prevent the app from being reset to the default bundle.
154
+ *
155
+ * @since 0.1.0
156
+ */
157
+ ready(): Promise<ReadyResult>;
158
+ /**
159
+ * Reload the app to apply the new bundle.
160
+ *
161
+ * @since 0.1.0
162
+ */
163
+ reload(): Promise<void>;
164
+ /**
165
+ * Reset the app to the default bundle.
166
+ *
167
+ * Call `reload()` or restart the app to apply the changes.
168
+ *
169
+ * @since 0.1.0
170
+ */
171
+ reset(): Promise<void>;
172
+ /**
173
+ * Reset the runtime configuration to the values from `config.xml`.
174
+ *
175
+ * This clears any runtime configuration set via `setConfig()`.
176
+ * The changes take effect immediately.
177
+ *
178
+ * @since 0.1.0
179
+ */
180
+ resetConfig(): Promise<void>;
181
+ /**
182
+ * Set the channel to use for the update.
183
+ *
184
+ * @since 0.1.0
185
+ */
186
+ setChannel(options: SetChannelOptions): Promise<void>;
187
+ /**
188
+ * Set the runtime configuration.
189
+ *
190
+ * This allows updating plugin configuration options at runtime.
191
+ * The changes are persisted across app restarts and take effect immediately.
192
+ *
193
+ * **Important:** Runtime configuration is automatically reset to default values
194
+ * whenever the native app is updated to a new version. This ensures that
195
+ * configuration from previous versions doesn't persist after an app update.
196
+ *
197
+ * @since 0.1.0
198
+ */
199
+ setConfig(options: SetConfigOptions): Promise<void>;
200
+ /**
201
+ * Set the custom identifier of the device.
202
+ *
203
+ * @since 0.1.0
204
+ */
205
+ setCustomId(options: SetCustomIdOptions): Promise<void>;
206
+ /**
207
+ * Set the next bundle to use for the app.
208
+ *
209
+ * Call `reload()` or restart the app to apply the changes.
210
+ *
211
+ * @since 0.1.0
212
+ */
213
+ setNextBundle(options: SetNextBundleOptions): Promise<void>;
214
+ /**
215
+ * Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).
216
+ *
217
+ * Call `reload()` or restart the app to apply the changes.
218
+ *
219
+ * @since 0.1.0
220
+ */
221
+ sync(options?: SyncOptions): Promise<SyncResult>;
222
+ /**
223
+ * Listen for the download progress of a bundle.
224
+ *
225
+ * @since 0.1.0
226
+ */
227
+ addListener(eventName: 'downloadBundleProgress', listenerFunc: DownloadBundleProgressListener): Promise<PluginListenerHandle>;
228
+ /**
229
+ * Listen for when a bundle is set as the next bundle.
230
+ *
231
+ * This event is triggered whenever a bundle is set to be used on the next app restart,
232
+ * either through automatic updates or manual calls to `setNextBundle()`.
233
+ *
234
+ * @since 0.1.0
235
+ */
236
+ addListener(eventName: 'nextBundleSet', listenerFunc: NextBundleSetListener): Promise<PluginListenerHandle>;
237
+ /**
238
+ * Remove all listeners for this plugin.
239
+ *
240
+ * @since 0.1.0
241
+ */
242
+ removeAllListeners(): Promise<void>;
243
+ }
244
+ /**
245
+ * @since 0.1.0
246
+ */
247
+ export interface DeleteBundleOptions {
248
+ /**
249
+ * The unique identifier of the bundle to delete.
250
+ *
251
+ * @since 0.1.0
252
+ * @example '1.0.0'
253
+ */
254
+ bundleId: string;
255
+ }
256
+ /**
257
+ * @since 0.1.0
258
+ */
259
+ export interface DownloadBundleOptions {
260
+ /**
261
+ * The artifact type of the bundle.
262
+ *
263
+ * @since 0.1.0
264
+ * @default 'zip'
265
+ * @example 'manifest'
266
+ */
267
+ artifactType?: 'manifest' | 'zip';
268
+ /**
269
+ * The unique identifier of the bundle.
270
+ *
271
+ * **Attention**: The value `public` is reserved and cannot be used as a bundle identifier.
272
+ *
273
+ * @since 0.1.0
274
+ * @example '1.0.0'
275
+ */
276
+ bundleId: string;
277
+ /**
278
+ * The checksum of the self-hosted bundle as a SHA-256 hash
279
+ * in hex format to verify the integrity of the bundle.
280
+ *
281
+ * **Attention**: Only supported for the `zip` artifact type.
282
+ *
283
+ * @since 0.1.0
284
+ */
285
+ checksum?: string;
286
+ /**
287
+ * The signature of the self-hosted bundle as a signed SHA-256 hash
288
+ * in base64 format to verify the integrity of the bundle.
289
+ *
290
+ * **Attention**: Only supported for the `zip` artifact type.
291
+ *
292
+ * @since 0.1.0
293
+ */
294
+ signature?: string;
295
+ /**
296
+ * The URL of the bundle to download.
297
+ *
298
+ * For the `zip` artifact type, the URL must point to a ZIP file.
299
+ * For the `manifest` artifact type, the URL serves as the base URL
300
+ * to download the individual files. For example, if the URL is
301
+ * `https://example.com/download`, the plugin will download the file
302
+ * with the href `index.html` from `https://example.com/download?href=index.html`.
303
+ *
304
+ * To **verify the integrity** of the file, the server should return
305
+ * a `X-Checksum` header with the SHA-256 hash in hex format.
306
+ *
307
+ * To **verify the signature** of the file, the server should return
308
+ * a `X-Signature` header with the signed SHA-256 hash in base64 format.
309
+ *
310
+ * @since 0.1.0
311
+ * @example 'https://example.com/bundle.zip'
312
+ */
313
+ url: string;
314
+ }
315
+ /**
316
+ * @since 0.1.0
317
+ */
318
+ export interface FetchChannelsOptions {
319
+ /**
320
+ * The maximum number of channels to return.
321
+ *
322
+ * @since 0.1.0
323
+ * @default 50
324
+ */
325
+ limit?: number;
326
+ /**
327
+ * The number of channels to skip.
328
+ *
329
+ * @since 0.1.0
330
+ * @default 0
331
+ */
332
+ offset?: number;
333
+ /**
334
+ * The query to filter channels by name.
335
+ *
336
+ * @since 0.1.0
337
+ */
338
+ query?: string;
339
+ }
340
+ /**
341
+ * @since 0.1.0
342
+ */
343
+ export interface FetchChannelsResult {
344
+ /**
345
+ * The list of channels.
346
+ *
347
+ * @since 0.1.0
348
+ */
349
+ channels: Channel[];
350
+ }
351
+ /**
352
+ * @since 0.1.0
353
+ */
354
+ export interface Channel {
355
+ /**
356
+ * The unique identifier of the channel.
357
+ *
358
+ * @since 0.1.0
359
+ */
360
+ id: string;
361
+ /**
362
+ * The name of the channel.
363
+ *
364
+ * @since 0.1.0
365
+ */
366
+ name: string;
367
+ }
368
+ /**
369
+ * @since 0.1.0
370
+ */
371
+ export interface FetchLatestBundleOptions {
372
+ /**
373
+ * The name of the channel where the latest bundle is fetched from.
374
+ *
375
+ * @since 0.1.0
376
+ */
377
+ channel?: string;
378
+ }
379
+ /**
380
+ * @since 0.1.0
381
+ */
382
+ export interface FetchLatestBundleResult {
383
+ /**
384
+ * The artifact type of the bundle.
385
+ *
386
+ * @since 0.1.0
387
+ */
388
+ artifactType?: 'manifest' | 'zip';
389
+ /**
390
+ * The unique identifier of the latest bundle.
391
+ *
392
+ * On Capawesome Cloud, this is the ID of the app build artifact.
393
+ *
394
+ * If `null`, no bundle is available.
395
+ *
396
+ * @since 0.1.0
397
+ */
398
+ bundleId: string | null;
399
+ /**
400
+ * The checksum of the latest bundle if the bundle is self-hosted.
401
+ *
402
+ * If the bundle is hosted on Capawesome Cloud, the checksum will be
403
+ * returned as response header when downloading the bundle.
404
+ *
405
+ * @since 0.1.0
406
+ */
407
+ checksum?: string;
408
+ /**
409
+ * Custom properties that are associated with the latest bundle.
410
+ *
411
+ * @since 0.1.0
412
+ * @example { "key": "value" }
413
+ */
414
+ customProperties?: {
415
+ [key: string]: string;
416
+ };
417
+ /**
418
+ * The URL of the latest bundle to download.
419
+ * Pass this URL to the `downloadBundle(...)` method to download the bundle.
420
+ *
421
+ * @since 0.1.0
422
+ */
423
+ downloadUrl?: string;
424
+ /**
425
+ * The signature of the latest bundle if the bundle is self-hosted.
426
+ *
427
+ * If the bundle is hosted on Capawesome Cloud, the signature will be
428
+ * returned as response header when downloading the bundle.
429
+ *
430
+ * @since 0.1.0
431
+ */
432
+ signature?: string;
433
+ }
434
+ /**
435
+ * @since 0.1.0
436
+ */
437
+ export interface GetBundleResult {
438
+ /**
439
+ * The unique identifier of the active bundle.
440
+ *
441
+ * If `null`, the default bundle is being used.
442
+ *
443
+ * @since 0.1.0
444
+ * @example '1.0.0'
445
+ */
446
+ bundleId: string | null;
447
+ }
448
+ /**
449
+ * @since 0.1.0
450
+ */
451
+ export interface GetBlockedBundlesResult {
452
+ /**
453
+ * An array of unique identifiers of all blocked bundles.
454
+ *
455
+ * @since 0.1.0
456
+ */
457
+ bundleIds: string[];
458
+ }
459
+ /**
460
+ * @since 0.1.0
461
+ */
462
+ export interface GetBundlesResult {
463
+ /**
464
+ * An array of unique identifiers of all available bundles.
465
+ *
466
+ * @since 0.1.0
467
+ */
468
+ bundleIds: string[];
469
+ }
470
+ /**
471
+ * @since 0.1.0
472
+ */
473
+ export interface GetDownloadedBundlesResult {
474
+ /**
475
+ * An array of unique identifiers of all downloaded bundles.
476
+ *
477
+ * @since 0.1.0
478
+ */
479
+ bundleIds: string[];
480
+ }
481
+ /**
482
+ * @since 0.1.0
483
+ */
484
+ export interface GetChannelResult {
485
+ /**
486
+ * The channel name.
487
+ *
488
+ * If `null`, the app is using the default channel.
489
+ *
490
+ * @since 0.1.0
491
+ * @example 'production'
492
+ */
493
+ channel: string | null;
494
+ }
495
+ /**
496
+ * @since 0.1.0
497
+ */
498
+ export interface GetConfigResult {
499
+ /**
500
+ * The app ID used to identify the app.
501
+ *
502
+ * If `null`, no app ID is configured.
503
+ *
504
+ * @since 0.1.0
505
+ * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'
506
+ */
507
+ appId: string | null;
508
+ /**
509
+ * The auto-update strategy for live updates.
510
+ *
511
+ * @since 0.1.0
512
+ * @example 'background'
513
+ */
514
+ autoUpdateStrategy: 'none' | 'background';
515
+ }
516
+ /**
517
+ * @since 0.1.0
518
+ */
519
+ export interface GetCurrentBundleResult {
520
+ /**
521
+ * The unique identifier of the current bundle.
522
+ *
523
+ * If `null`, the default bundle is being used.
524
+ *
525
+ * @since 0.1.0
526
+ */
527
+ bundleId: string | null;
528
+ }
529
+ /**
530
+ * @since 0.1.0
531
+ */
532
+ export interface GetDeviceIdResult {
533
+ /**
534
+ * The unique identifier of the device.
535
+ *
536
+ * On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used.
537
+ * The value of this property is the same for apps that come from the same vendor running on the same device.
538
+ *
539
+ * @since 0.1.0
540
+ * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'
541
+ */
542
+ deviceId: string;
543
+ }
544
+ /**
545
+ * @since 0.1.0
546
+ */
547
+ export interface IsSyncingResult {
548
+ /**
549
+ * Whether a sync operation is currently in progress.
550
+ *
551
+ * @since 0.1.0
552
+ */
553
+ syncing: boolean;
554
+ }
555
+ /**
556
+ * @since 0.1.0
557
+ */
558
+ export interface GetNextBundleResult {
559
+ /**
560
+ * The unique identifier of the next bundle.
561
+ *
562
+ * If `null`, the default bundle is being used.
563
+ *
564
+ * @since 0.1.0
565
+ */
566
+ bundleId: string | null;
567
+ }
568
+ /**
569
+ * @since 0.1.0
570
+ */
571
+ export interface GetVersionCodeResult {
572
+ /**
573
+ * The version code of the app.
574
+ *
575
+ * On **Android**, this is the `versionCode` from `PackageInfo`.
576
+ * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.
577
+ *
578
+ * @since 0.1.0
579
+ * @example "1"
580
+ */
581
+ versionCode: string;
582
+ }
583
+ /**
584
+ * @since 0.1.0
585
+ */
586
+ export interface GetVersionNameResult {
587
+ /**
588
+ * The version name of the app.
589
+ *
590
+ * On **Android**, this is the `versionName` from `PackageInfo`.
591
+ * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.
592
+ *
593
+ * @since 0.1.0
594
+ * @example "1.0.0"
595
+ */
596
+ versionName: string;
597
+ }
598
+ /**
599
+ * @since 0.1.0
600
+ */
601
+ export interface GetCustomIdResult {
602
+ /**
603
+ * The custom identifier of the device.
604
+ *
605
+ * If `null`, no custom identifier is set.
606
+ *
607
+ * @since 0.1.0
608
+ * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'
609
+ */
610
+ customId: string | null;
611
+ }
612
+ /**
613
+ * @since 0.1.0
614
+ */
615
+ export interface ReadyResult {
616
+ /**
617
+ * The identifier of the previous bundle used.
618
+ *
619
+ * If `null`, the default bundle was used.
620
+ *
621
+ * @since 0.1.0
622
+ */
623
+ previousBundleId: string | null;
624
+ /**
625
+ * The identifier of the current bundle used.
626
+ *
627
+ * If `null`, the default bundle is being used.
628
+ *
629
+ * @since 0.1.0
630
+ */
631
+ currentBundleId: string | null;
632
+ /**
633
+ * Whether or not the app was reset to the default bundle.
634
+ *
635
+ * @since 0.1.0
636
+ */
637
+ rollback: boolean;
638
+ }
639
+ /**
640
+ * @since 0.1.0
641
+ */
642
+ export interface SetBundleOptions {
643
+ /**
644
+ * The unique identifier of the bundle to use.
645
+ *
646
+ * @since 0.1.0
647
+ * @example '1.0.0'
648
+ */
649
+ bundleId: string;
650
+ }
651
+ /**
652
+ * @since 0.1.0
653
+ */
654
+ export interface SetChannelOptions {
655
+ /**
656
+ * The channel name.
657
+ *
658
+ * Set `null` to remove the channel.
659
+ *
660
+ * @since 0.1.0
661
+ */
662
+ channel: string | null;
663
+ }
664
+ /**
665
+ * @since 0.1.0
666
+ */
667
+ export interface SetConfigOptions {
668
+ /**
669
+ * The app ID used to identify the app.
670
+ *
671
+ * Set `null` to reset to the value from the `APP_ID` preference in `config.xml`.
672
+ *
673
+ * @since 0.1.0
674
+ * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'
675
+ */
676
+ appId?: string | null;
677
+ }
678
+ /**
679
+ * @since 0.1.0
680
+ */
681
+ export interface SetCustomIdOptions {
682
+ /**
683
+ * The custom identifier of the device.
684
+ *
685
+ * Set `null` to remove the custom identifier.
686
+ *
687
+ * @since 0.1.0
688
+ */
689
+ customId: string | null;
690
+ }
691
+ /**
692
+ * @since 0.1.0
693
+ */
694
+ export interface SetNextBundleOptions {
695
+ /**
696
+ * The unique identifier of the bundle to use.
697
+ *
698
+ * Set `null` to use the default bundle (same as calling `reset()`).
699
+ *
700
+ * @since 0.1.0
701
+ * @example '1.0.0'
702
+ */
703
+ bundleId: string | null;
704
+ }
705
+ /**
706
+ * @since 0.1.0
707
+ */
708
+ export interface SyncOptions {
709
+ /**
710
+ * The name of the channel where the latest bundle is fetched from.
711
+ *
712
+ * @since 0.1.0
713
+ */
714
+ channel?: string;
715
+ }
716
+ /**
717
+ * @since 0.1.0
718
+ */
719
+ export interface SyncResult {
720
+ /**
721
+ * The identifier of the next bundle to use.
722
+ *
723
+ * If `null`, the app is up-to-date and no new bundle is available.
724
+ *
725
+ * @since 0.1.0
726
+ */
727
+ nextBundleId: string | null;
728
+ }
729
+ /**
730
+ * Listener for the download progress of a bundle.
731
+ *
732
+ * @since 0.1.0
733
+ */
734
+ export type DownloadBundleProgressListener = (event: DownloadBundleProgressEvent) => void;
735
+ /**
736
+ * Event that is triggered when the download progress of a bundle changes.
737
+ *
738
+ * @since 0.1.0
739
+ */
740
+ export interface DownloadBundleProgressEvent {
741
+ /**
742
+ * The unique identifier of the bundle that is being downloaded.
743
+ *
744
+ * @since 0.1.0
745
+ */
746
+ bundleId: string;
747
+ /**
748
+ * The number of bytes that have been downloaded.
749
+ *
750
+ * @since 0.1.0
751
+ */
752
+ downloadedBytes: number;
753
+ /**
754
+ * The progress of the download in percent as a value between `0` and `1`.
755
+ *
756
+ * @since 0.1.0
757
+ * @example 0.5
758
+ */
759
+ progress: number;
760
+ /**
761
+ * The total number of bytes to download.
762
+ *
763
+ * @since 0.1.0
764
+ */
765
+ totalBytes: number;
766
+ }
767
+ /**
768
+ * Listener for when a bundle is set as the next bundle.
769
+ *
770
+ * @since 0.1.0
771
+ */
772
+ export type NextBundleSetListener = (event: NextBundleSetEvent) => void;
773
+ /**
774
+ * Event that is triggered when a bundle is set as the next bundle.
775
+ *
776
+ * @since 0.1.0
777
+ */
778
+ export interface NextBundleSetEvent {
779
+ /**
780
+ * The unique identifier of the bundle that is set as the next bundle.
781
+ *
782
+ * If `null`, the default bundle will be used.
783
+ *
784
+ * @since 0.1.0
785
+ * @example '1.0.0'
786
+ */
787
+ bundleId: string | null;
788
+ }