@capgo/capacitor-updater 3.3.12 → 4.0.0-alpha.2

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.
@@ -1,129 +1,227 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
+ declare module '@capacitor/cli' {
3
+ interface PluginsConfig {
4
+ /**
5
+ * These configuration values are available:
6
+ */
7
+ CapacitorUpdater?: {
8
+ /**
9
+ * Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.
10
+ *
11
+ * Only available for Android and iOS.
12
+ *
13
+ * @default 10000 // (10 seconds)
14
+ * @example 1000 // (1 second)
15
+ */
16
+ appReadyTimeout?: number;
17
+ /**
18
+ * Configure whether the plugin should use automatically delete failed bundles.
19
+ *
20
+ * Only available for Android and iOS.
21
+ *
22
+ * @default true
23
+ * @example false
24
+ */
25
+ autoDeleteFailed?: boolean;
26
+ /**
27
+ * Configure whether the plugin should use automatically delete previous bundles after a successful update.
28
+ *
29
+ * Only available for Android and iOS.
30
+ *
31
+ * @default true
32
+ * @example false
33
+ */
34
+ autoDeletePrevious?: boolean;
35
+ /**
36
+ * Configure whether the plugin should use Auto Update via an update server.
37
+ *
38
+ * Only available for Android and iOS.
39
+ *
40
+ * @default false
41
+ * @example false
42
+ */
43
+ autoUpdate?: boolean;
44
+ /**
45
+ * Configure the URL / endpoint to which update checks are sent.
46
+ *
47
+ * Only available for Android and iOS.
48
+ *
49
+ * @default https://capgo.app/api/auto_update
50
+ * @example https://example.com/api/auto_update
51
+ */
52
+ autoUpdateUrl?: string;
53
+ /**
54
+ * Automatically delete previous downloaded bundles when a newer native app version is installed to the device.
55
+ *
56
+ * Only available for Android and iOS.
57
+ *
58
+ * @default true
59
+ * @example false
60
+ */
61
+ resetWhenUpdate?: boolean;
62
+ /**
63
+ * Configure the URL / endpoint to which update statistics are sent.
64
+ *
65
+ * Only available for Android and iOS.
66
+ *
67
+ * @default https://capgo.app/api/stats
68
+ * @example https://example.com/api/stats
69
+ */
70
+ statsUrl?: string;
71
+ };
72
+ }
73
+ }
2
74
  export interface DownloadEvent {
3
75
  /**
4
76
  * Current status of download, between 0 and 100.
5
77
  *
6
- * @since 2.0.11
78
+ * @since 4.0.0
7
79
  */
8
80
  percent: number;
81
+ bundle: BundleInfo;
9
82
  }
10
83
  export interface MajorAvailableEvent {
11
84
  /**
12
85
  * Emit when a new major version is available.
13
86
  *
14
- * @since 2.3.0
87
+ * @since 4.0.0
15
88
  */
16
89
  version: string;
17
90
  }
18
- export interface UpdateAvailableEvent {
91
+ export interface DownloadCompleteEvent {
19
92
  /**
20
93
  * Emit when a new update is available.
21
94
  *
22
- * @since 3.0.0
95
+ * @since 4.0.0
23
96
  */
97
+ bundle: BundleInfo;
98
+ }
99
+ export interface UpdateFailedEvent {
100
+ /**
101
+ * Emit when a update failed to install.
102
+ *
103
+ * @since 4.0.0
104
+ */
105
+ bundle: BundleInfo;
106
+ }
107
+ export interface BundleInfo {
108
+ id: string;
24
109
  version: string;
110
+ downloaded: string;
111
+ status: BundleStatus;
25
112
  }
113
+ export declare type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
26
114
  export declare type DownloadChangeListener = (state: DownloadEvent) => void;
115
+ export declare type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
27
116
  export declare type MajorAvailableListener = (state: MajorAvailableEvent) => void;
28
- export declare type UpdateAvailableListener = (state: UpdateAvailableEvent) => void;
117
+ export declare type UpdateFailedListener = (state: UpdateFailedEvent) => void;
29
118
  export interface CapacitorUpdaterPlugin {
30
119
  /**
31
- * Download a new version from the provided URL, it should be a zip file, with files inside or with a unique folder inside with all your files
32
- * @returns {Promise<{version: string}>} an Promise with version name of the downloaded version, version is generated by the plugin, it's a random string of 10 char length
33
- * @param url The URL where download the version, it can be S3 github tag or whatever, it should be a zip file
34
- */
120
+ * Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
121
+ *
122
+ * @returns {Promise<void>} an Promise resolved directly
123
+ * @throws An error if the something went wrong
124
+ */
125
+ notifyAppReady(): Promise<BundleInfo>;
126
+ /**
127
+ * Download a new version from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
128
+ *
129
+ * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified version.
130
+ * @param url The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a github tag, any other place you've hosted your bundle.)
131
+ * @param version (optional) set the version code/name of this bundle/version
132
+ * @example https://example.com/versions/{version}/dist.zip
133
+ */
35
134
  download(options: {
36
135
  url: string;
37
- }): Promise<{
38
- version: string;
39
- }>;
40
- /**
41
- * Set version as current version, set will return an error if there are is no index.html file inside the version folder. `versionName` is optional and it's a custom value that will be saved for you
42
- * @returns {Promise<void>} an empty Promise when the version is set, if there are no index.html or no version folder throw an error
43
- * @param version The version name to set as current version
44
- */
45
- set(options: {
46
- version: string;
47
- versionName?: string;
48
- }): Promise<void>;
136
+ version?: string;
137
+ }): Promise<BundleInfo>;
49
138
  /**
50
- * Get unique ID used to identify device into auto update server
51
- * @returns {Promise<{ id: string }>} an Promise with id for this device
52
- */
53
- getId(): Promise<{
139
+ * Set the next bundle to be used when the app is reloaded.
140
+ *
141
+ * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle id.
142
+ * @param id The bundle id to set as current, next time the app is reloaded. See {@link BundleInfo.id}
143
+ * @throws An error if there are is no index.html file inside the version folder.
144
+ */
145
+ next(options: {
54
146
  id: string;
55
- }>;
147
+ }): Promise<BundleInfo>;
56
148
  /**
57
- * Get plugin version used in native code
58
- * @returns {Promise<{ id: string }>} an Promise with version for this device
59
- */
60
- getPluginVersion(): Promise<{
61
- version: string;
62
- }>;
149
+ * Set the current bundle and immediately reloads the app.
150
+ *
151
+ * @param id The bundle id to set as current. See {@link BundleInfo.id}
152
+ * @returns {Promise<Void>} An empty promise.
153
+ * @throws An error if there are is no index.html file inside the version folder.
154
+ */
155
+ set(options: {
156
+ id: string;
157
+ }): Promise<void>;
63
158
  /**
64
- * Delete version in storage
65
- * @returns {Promise<void>} an empty Promise when the version is delete, otherwise throw an error
66
- * @param version The version name to delete
67
- */
159
+ * Delete bundle in storage
160
+ *
161
+ * @returns {Promise<void>} an empty Promise when the bundle is deleted
162
+ * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)
163
+ * @throws An error if the something went wrong
164
+ */
68
165
  delete(options: {
69
- version: string;
166
+ id: string;
70
167
  }): Promise<void>;
71
168
  /**
72
- * Get all available versions
73
- * @returns {Promise<{version: string[]}>} an Promise witht the version list
74
- */
169
+ * Get all available versions
170
+ *
171
+ * @returns {Promise<{version: BundleInfo[]}>} an Promise witht the version list
172
+ * @throws An error if the something went wrong
173
+ */
75
174
  list(): Promise<{
76
- versions: string[];
175
+ bundles: BundleInfo[];
77
176
  }>;
78
177
  /**
79
- * Set the `builtin` version (the one sent to Apple store / Google play store ) as current version
80
- * @returns {Promise<void>} an empty Promise
81
- * @param toAutoUpdate [false] if yes it reset to to the last AutoUpdate version instead of `builtin`
82
- */
178
+ * Set the `builtin` version (the one sent to Apple store / Google play store ) as current version
179
+ *
180
+ * @returns {Promise<void>} an empty Promise
181
+ * @param toLastSuccessful [false] if yes it reset to to the last successfully loaded bundle instead of `builtin`
182
+ * @throws An error if the something went wrong
183
+ */
83
184
  reset(options?: {
84
- toAutoUpdate?: boolean;
185
+ toLastSuccessful?: boolean;
85
186
  }): Promise<void>;
86
187
  /**
87
- * Get the current version, if none are set it returns `builtin`, currentNative is the original version install on the device
88
- * @returns {Promise<{ current: string, currentNative: string }>} an Promise with the current version name
89
- */
188
+ * Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
189
+ *
190
+ * @returns {Promise<{ current: string, currentNative: string }>} an Promise with the current bundle info
191
+ * @throws An error if the something went wrong
192
+ */
90
193
  current(): Promise<{
91
- current: string;
92
- currentNative: string;
194
+ bundle: BundleInfo;
195
+ native: string;
93
196
  }>;
94
197
  /**
95
- * Reload the view
96
- * @returns {Promise<void>} an Promise resolved when the view is reloaded
97
- */
98
- reload(): Promise<void>;
99
- /**
100
- * Get the version name, if it was set during the set phase
101
- * @returns {Promise<{ versionName: string }>} an Promise witht the current versionName
102
- */
103
- versionName(): Promise<{
104
- versionName: string;
105
- }>;
106
- /**
107
- * Notify native plugin that the update is working, only in auto-update
108
- * @returns {Promise<void>} an Promise resolved directly
109
- */
110
- notifyAppReady(): Promise<void>;
111
- /**
112
- * Skip updates in the next time the app goes into the background, only in auto-update
113
- * @returns {Promise<void>} an Promise resolved directly
198
+ * Reload the view
199
+ *
200
+ * @returns {Promise<void>} an Promise resolved when the view is reloaded
201
+ * @throws An error if the something went wrong
114
202
  */
115
- delayUpdate(): Promise<void>;
203
+ reload(): Promise<void>;
116
204
  /**
117
- * allow update in the next time the app goes into the background, only in auto-update
205
+ * Set delay to skip updates in the next time the app goes into the background
206
+ *
118
207
  * @returns {Promise<void>} an Promise resolved directly
208
+ * @throws An error if the something went wrong
119
209
  */
120
- cancelDelay(): Promise<void>;
210
+ setDelay(options: {
211
+ delay: boolean;
212
+ }): Promise<void>;
121
213
  /**
122
214
  * Listen for download event in the App, let you know when the download is started, loading and finished
123
215
  *
124
216
  * @since 2.0.11
125
217
  */
126
218
  addListener(eventName: 'download', listenerFunc: DownloadChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
219
+ /**
220
+ * Listen for download event in the App, let you know when the download is started, loading and finished
221
+ *
222
+ * @since 4.0.0
223
+ */
224
+ addListener(eventName: 'downloadComplete', listenerFunc: DownloadCompleteListener): Promise<PluginListenerHandle> & PluginListenerHandle;
127
225
  /**
128
226
  * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
129
227
  *
@@ -131,9 +229,36 @@ export interface CapacitorUpdaterPlugin {
131
229
  */
132
230
  addListener(eventName: 'majorAvailable', listenerFunc: MajorAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
133
231
  /**
134
- * Listen for update event in the App, let you know when update is ready to install at next app start
232
+ * Listen for update event in the App, let you know when update is ready to install at next app start
233
+ *
234
+ * @since 2.3.0
235
+ */
236
+ addListener(eventName: 'updateFailed', listenerFunc: UpdateFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
237
+ /**
238
+ * Get unique ID used to identify device (sent to auto update server)
135
239
  *
136
- * @since 2.3.0
240
+ * @returns {Promise<{ id: string }>} an Promise with id for this device
241
+ * @throws An error if the something went wrong
137
242
  */
138
- addListener(eventName: 'updateAvailable', listenerFunc: UpdateAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
243
+ getId(): Promise<{
244
+ id: string;
245
+ }>;
246
+ /**
247
+ * Get the native Capacitor Updater plugin version (sent to auto update server)
248
+ *
249
+ * @returns {Promise<{ id: string }>} an Promise with version for this device
250
+ * @throws An error if the something went wrong
251
+ */
252
+ getPluginVersion(): Promise<{
253
+ version: string;
254
+ }>;
255
+ /**
256
+ * Get the state of auto update config. This will return `false` in manual mode.
257
+ *
258
+ * @returns {Promise<{enabled: boolean}>} The status for auto update.
259
+ * @throws An error if the something went wrong
260
+ */
261
+ isAutoUpdateEnabled(): Promise<{
262
+ enabled: boolean;
263
+ }>;
139
264
  }
package/dist/esm/web.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { CapacitorUpdaterPlugin } from './definitions';
2
+ import type { CapacitorUpdaterPlugin, BundleInfo } from './definitions';
3
3
  export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {
4
4
  download(options: {
5
5
  url: string;
6
- }): Promise<{
7
- version: string;
6
+ version?: string;
7
+ }): Promise<BundleInfo>;
8
+ next(options: {
9
+ id: string;
10
+ }): Promise<BundleInfo>;
11
+ isAutoUpdateEnabled(): Promise<{
12
+ enabled: boolean;
8
13
  }>;
9
14
  set(options: {
10
- version: string;
11
- versionName?: string;
15
+ id: string;
12
16
  }): Promise<void>;
13
17
  getId(): Promise<{
14
18
  id: string;
@@ -17,23 +21,21 @@ export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorU
17
21
  version: string;
18
22
  }>;
19
23
  delete(options: {
20
- version: string;
24
+ id: string;
21
25
  }): Promise<void>;
22
26
  list(): Promise<{
23
- versions: string[];
27
+ bundles: BundleInfo[];
24
28
  }>;
25
29
  reset(options?: {
26
- toAutoUpdate?: boolean;
30
+ toLastSuccessful?: boolean;
27
31
  }): Promise<void>;
28
32
  current(): Promise<{
29
- current: string;
30
- currentNative: string;
33
+ bundle: BundleInfo;
34
+ native: string;
31
35
  }>;
32
36
  reload(): Promise<void>;
33
- versionName(): Promise<{
34
- versionName: string;
35
- }>;
36
- notifyAppReady(): Promise<void>;
37
- delayUpdate(): Promise<void>;
38
- cancelDelay(): Promise<void>;
37
+ notifyAppReady(): Promise<BundleInfo>;
38
+ setDelay(options: {
39
+ delay: boolean;
40
+ }): Promise<void>;
39
41
  }
package/dist/esm/web.js CHANGED
@@ -1,52 +1,54 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
+ const BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };
2
3
  export class CapacitorUpdaterWeb extends WebPlugin {
3
4
  async download(options) {
4
- console.log('Cannot download version in web', options);
5
- return { version: "" };
5
+ console.warn('Cannot download version in web', options);
6
+ return BUNDLE_BUILTIN;
7
+ }
8
+ async next(options) {
9
+ console.warn('Cannot set next version in web', options);
10
+ return BUNDLE_BUILTIN;
11
+ }
12
+ async isAutoUpdateEnabled() {
13
+ console.warn('Cannot get isAutoUpdateEnabled in web');
14
+ return { enabled: false };
6
15
  }
7
16
  async set(options) {
8
- console.log('Cannot set version in web', options);
17
+ console.warn('Cannot set active bundle in web', options);
18
+ return;
9
19
  }
10
20
  async getId() {
11
- console.log('Cannot get ID in web');
21
+ console.warn('Cannot get ID in web');
12
22
  return { id: 'default' };
13
23
  }
14
24
  async getPluginVersion() {
15
- console.log('Cannot get version in web');
25
+ console.warn('Cannot get plugin version in web');
16
26
  return { version: 'default' };
17
27
  }
18
28
  async delete(options) {
19
- console.log('Cannot delete version in web', options);
29
+ console.warn('Cannot delete bundle in web', options);
20
30
  }
21
31
  async list() {
22
- console.log('Cannot list version in web');
23
- return { versions: [] };
32
+ console.warn('Cannot list bundles in web');
33
+ return { bundles: [] };
24
34
  }
25
35
  async reset(options) {
26
- console.log('Cannot reset version in web', options);
36
+ console.warn('Cannot reset version in web', options);
27
37
  }
28
38
  async current() {
29
- console.log('Cannot get current version in web');
30
- return { current: 'default', currentNative: '0.0.0' };
39
+ console.warn('Cannot get current bundle in web');
40
+ return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };
31
41
  }
32
42
  async reload() {
33
- console.log('Cannot reload current version in web');
43
+ console.warn('Cannot reload current bundle in web');
34
44
  return;
35
45
  }
36
- async versionName() {
37
- console.log('Cannot get current versionName in web');
38
- return { versionName: 'default' };
39
- }
40
46
  async notifyAppReady() {
41
- console.log('Cannot notify App Ready in web');
42
- return;
43
- }
44
- async delayUpdate() {
45
- console.log('Cannot delay update in web');
46
- return;
47
+ console.warn('Cannot notify App Ready in web');
48
+ return BUNDLE_BUILTIN;
47
49
  }
48
- async cancelDelay() {
49
- console.log('Cannot cancel delay update in web');
50
+ async setDelay(options) {
51
+ console.warn('Cannot setDelay delay update in web', options);
50
52
  return;
51
53
  }
52
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,mBACX,SAAQ,SAAS;IAEjB,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,OAAkD;QAC1D,OAAO,CAAC,GAAG,CAAC,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M,CAAC,OAAuB;QAClC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,CAAC,IAAI;QACR,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC3C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,OAAwC;QAClD,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,CAAC,OAAO;QACX,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACrD,CAAC;IACD,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC/C,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAA2B;QACxC,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;CACF"}
@@ -8,54 +8,56 @@ const CapacitorUpdater = core.registerPlugin('CapacitorUpdater', {
8
8
  web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorUpdaterWeb()),
9
9
  });
10
10
 
11
+ const BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };
11
12
  class CapacitorUpdaterWeb extends core.WebPlugin {
12
13
  async download(options) {
13
- console.log('Cannot download version in web', options);
14
- return { version: "" };
14
+ console.warn('Cannot download version in web', options);
15
+ return BUNDLE_BUILTIN;
16
+ }
17
+ async next(options) {
18
+ console.warn('Cannot set next version in web', options);
19
+ return BUNDLE_BUILTIN;
20
+ }
21
+ async isAutoUpdateEnabled() {
22
+ console.warn('Cannot get isAutoUpdateEnabled in web');
23
+ return { enabled: false };
15
24
  }
16
25
  async set(options) {
17
- console.log('Cannot set version in web', options);
26
+ console.warn('Cannot set active bundle in web', options);
27
+ return;
18
28
  }
19
29
  async getId() {
20
- console.log('Cannot get ID in web');
30
+ console.warn('Cannot get ID in web');
21
31
  return { id: 'default' };
22
32
  }
23
33
  async getPluginVersion() {
24
- console.log('Cannot get version in web');
34
+ console.warn('Cannot get plugin version in web');
25
35
  return { version: 'default' };
26
36
  }
27
37
  async delete(options) {
28
- console.log('Cannot delete version in web', options);
38
+ console.warn('Cannot delete bundle in web', options);
29
39
  }
30
40
  async list() {
31
- console.log('Cannot list version in web');
32
- return { versions: [] };
41
+ console.warn('Cannot list bundles in web');
42
+ return { bundles: [] };
33
43
  }
34
44
  async reset(options) {
35
- console.log('Cannot reset version in web', options);
45
+ console.warn('Cannot reset version in web', options);
36
46
  }
37
47
  async current() {
38
- console.log('Cannot get current version in web');
39
- return { current: 'default', currentNative: '0.0.0' };
48
+ console.warn('Cannot get current bundle in web');
49
+ return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };
40
50
  }
41
51
  async reload() {
42
- console.log('Cannot reload current version in web');
52
+ console.warn('Cannot reload current bundle in web');
43
53
  return;
44
54
  }
45
- async versionName() {
46
- console.log('Cannot get current versionName in web');
47
- return { versionName: 'default' };
48
- }
49
55
  async notifyAppReady() {
50
- console.log('Cannot notify App Ready in web');
51
- return;
52
- }
53
- async delayUpdate() {
54
- console.log('Cannot delay update in web');
55
- return;
56
+ console.warn('Cannot notify App Ready in web');
57
+ return BUNDLE_BUILTIN;
56
58
  }
57
- async cancelDelay() {
58
- console.log('Cannot cancel delay update in web');
59
+ async setDelay(options) {
60
+ console.warn('Cannot setDelay delay update in web', options);
59
61
  return;
60
62
  }
61
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.log('Cannot download version in web', options);\n return { version: \"\" };\n }\n async set(options) {\n console.log('Cannot set version in web', options);\n }\n async getId() {\n console.log('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.log('Cannot get version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.log('Cannot delete version in web', options);\n }\n async list() {\n console.log('Cannot list version in web');\n return { versions: [] };\n }\n async reset(options) {\n console.log('Cannot reset version in web', options);\n }\n async current() {\n console.log('Cannot get current version in web');\n return { current: 'default', currentNative: '0.0.0' };\n }\n async reload() {\n console.log('Cannot reload current version in web');\n return;\n }\n async versionName() {\n console.log('Cannot get current versionName in web');\n return { versionName: 'default' };\n }\n async notifyAppReady() {\n console.log('Cannot notify App Ready in web');\n return;\n }\n async delayUpdate() {\n console.log('Cannot delay update in web');\n return;\n }\n async cancelDelay() {\n console.log('Cannot cancel delay update in web');\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAC/D,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE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CAAuC,CAAC,CAAC;AAC7D,QAAQ,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC1C,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AACtD,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAClD,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AACzD,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n async set(options) {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n async getId() {\n console.warn('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.warn('Cannot delete bundle in web', options);\n }\n async list() {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n async reset(options) {\n console.warn('Cannot reset version in web', options);\n }\n async current() {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n async reload() {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n async notifyAppReady() {\n console.warn('Cannot notify App Ready in web');\n return BUNDLE_BUILTIN;\n }\n async setDelay(options) {\n console.warn('Cannot setDelay delay update in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC;;ACFD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;AAC1G,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,mBAAmB,GAAG;AAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;AAC9D,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClC,KAAK;AACL,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE;AACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,C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