@capgo/capacitor-updater 3.3.11 → 4.0.0-alpha.10

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,250 @@
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
+ updateUrl?: 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
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 latestVersion {
108
+ /**
109
+ * Res of getLatest method
110
+ *
111
+ * @since 4.0.0
23
112
  */
24
113
  version: string;
114
+ major?: boolean;
115
+ message?: string;
116
+ old?: string;
117
+ url?: string;
25
118
  }
119
+ export interface BundleInfo {
120
+ id: string;
121
+ version: string;
122
+ downloaded: string;
123
+ status: BundleStatus;
124
+ }
125
+ export declare type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
26
126
  export declare type DownloadChangeListener = (state: DownloadEvent) => void;
127
+ export declare type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
27
128
  export declare type MajorAvailableListener = (state: MajorAvailableEvent) => void;
28
- export declare type UpdateAvailableListener = (state: UpdateAvailableEvent) => void;
129
+ export declare type UpdateFailedListener = (state: UpdateFailedEvent) => void;
29
130
  export interface CapacitorUpdaterPlugin {
30
131
  /**
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
- */
132
+ * Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
133
+ *
134
+ * @returns {Promise<BundleInfo>} an Promise resolved directly
135
+ * @throws An error if the something went wrong
136
+ */
137
+ notifyAppReady(): Promise<BundleInfo>;
138
+ /**
139
+ * 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
140
+ *
141
+ * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified version.
142
+ * @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.)
143
+ * @param version (optional) set the version code/name of this bundle/version
144
+ * @example https://example.com/versions/{version}/dist.zip
145
+ */
35
146
  download(options: {
36
147
  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>;
148
+ version?: string;
149
+ }): Promise<BundleInfo>;
49
150
  /**
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<{
151
+ * Set the next bundle to be used when the app is reloaded.
152
+ *
153
+ * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle id.
154
+ * @param id The bundle id to set as current, next time the app is reloaded. See {@link BundleInfo.id}
155
+ * @throws An error if there are is no index.html file inside the version folder.
156
+ */
157
+ next(options: {
54
158
  id: string;
55
- }>;
159
+ }): Promise<BundleInfo>;
56
160
  /**
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
- }>;
161
+ * Set the current bundle and immediately reloads the app.
162
+ *
163
+ * @param id The bundle id to set as current. See {@link BundleInfo.id}
164
+ * @returns {Promise<Void>} An empty promise.
165
+ * @throws An error if there are is no index.html file inside the version folder.
166
+ */
167
+ set(options: {
168
+ id: string;
169
+ }): Promise<void>;
63
170
  /**
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
- */
171
+ * Delete bundle in storage
172
+ *
173
+ * @returns {Promise<void>} an empty Promise when the bundle is deleted
174
+ * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)
175
+ * @throws An error if the something went wrong
176
+ */
68
177
  delete(options: {
69
- version: string;
178
+ id: string;
70
179
  }): Promise<void>;
71
180
  /**
72
- * Get all available versions
73
- * @returns {Promise<{version: string[]}>} an Promise witht the version list
74
- */
181
+ * Get all available versions
182
+ *
183
+ * @returns {Promise<{version: BundleInfo[]}>} an Promise witht the version list
184
+ * @throws An error if the something went wrong
185
+ */
75
186
  list(): Promise<{
76
- versions: string[];
187
+ bundles: BundleInfo[];
77
188
  }>;
78
189
  /**
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
- */
190
+ * Set the `builtin` version (the one sent to Apple store / Google play store ) as current version
191
+ *
192
+ * @returns {Promise<void>} an empty Promise
193
+ * @param toLastSuccessful [false] if yes it reset to to the last successfully loaded bundle instead of `builtin`
194
+ * @throws An error if the something went wrong
195
+ */
83
196
  reset(options?: {
84
- toAutoUpdate?: boolean;
197
+ toLastSuccessful?: boolean;
85
198
  }): Promise<void>;
86
199
  /**
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
- */
200
+ * Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
201
+ *
202
+ * @returns {Promise<{ bundle: BundleInfo, native: string }>} an Promise with the current bundle info
203
+ * @throws An error if the something went wrong
204
+ */
90
205
  current(): Promise<{
91
- current: string;
92
- currentNative: string;
93
- }>;
94
- /**
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;
206
+ bundle: BundleInfo;
207
+ native: string;
105
208
  }>;
106
209
  /**
107
- * Notify native plugin that the update is working, only in auto-update
108
- * @returns {Promise<void>} an Promise resolved directly
210
+ * Reload the view
211
+ *
212
+ * @returns {Promise<void>} an Promise resolved when the view is reloaded
213
+ * @throws An error if the something went wrong
109
214
  */
110
- notifyAppReady(): Promise<void>;
215
+ reload(): Promise<void>;
111
216
  /**
112
- * Skip updates in the next time the app goes into the background, only in auto-update
217
+ * Set delay to skip updates in the next time the app goes into the background
218
+ *
113
219
  * @returns {Promise<void>} an Promise resolved directly
220
+ * @throws An error if the something went wrong
221
+ * @since 4.0.0
114
222
  */
115
- delayUpdate(): Promise<void>;
223
+ setDelay(options: {
224
+ delay: boolean;
225
+ }): Promise<void>;
116
226
  /**
117
- * allow update in the next time the app goes into the background, only in auto-update
118
- * @returns {Promise<void>} an Promise resolved directly
227
+ * Get Latest version available from update Url
228
+ *
229
+ * @returns {Promise<latestVersion>} an Promise resolved when url is loaded
230
+ * @throws An error if the something went wrong
231
+ * @since 4.0.0
119
232
  */
120
- cancelDelay(): Promise<void>;
233
+ getLatest(options: {
234
+ delay: boolean;
235
+ }): Promise<latestVersion>;
121
236
  /**
122
237
  * Listen for download event in the App, let you know when the download is started, loading and finished
123
238
  *
124
239
  * @since 2.0.11
125
240
  */
126
241
  addListener(eventName: 'download', listenerFunc: DownloadChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
242
+ /**
243
+ * Listen for download event in the App, let you know when the download is started, loading and finished
244
+ *
245
+ * @since 4.0.0
246
+ */
247
+ addListener(eventName: 'downloadComplete', listenerFunc: DownloadCompleteListener): Promise<PluginListenerHandle> & PluginListenerHandle;
127
248
  /**
128
249
  * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
129
250
  *
@@ -131,9 +252,36 @@ export interface CapacitorUpdaterPlugin {
131
252
  */
132
253
  addListener(eventName: 'majorAvailable', listenerFunc: MajorAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
133
254
  /**
134
- * Listen for update event in the App, let you know when update is ready to install at next app start
255
+ * Listen for update event in the App, let you know when update is ready to install at next app start
256
+ *
257
+ * @since 2.3.0
258
+ */
259
+ addListener(eventName: 'updateFailed', listenerFunc: UpdateFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
260
+ /**
261
+ * Get unique ID used to identify device (sent to auto update server)
135
262
  *
136
- * @since 2.3.0
263
+ * @returns {Promise<{ id: string }>} an Promise with id for this device
264
+ * @throws An error if the something went wrong
137
265
  */
138
- addListener(eventName: 'updateAvailable', listenerFunc: UpdateAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
266
+ getId(): Promise<{
267
+ id: string;
268
+ }>;
269
+ /**
270
+ * Get the native Capacitor Updater plugin version (sent to auto update server)
271
+ *
272
+ * @returns {Promise<{ id: string }>} an Promise with version for this device
273
+ * @throws An error if the something went wrong
274
+ */
275
+ getPluginVersion(): Promise<{
276
+ version: string;
277
+ }>;
278
+ /**
279
+ * Get the state of auto update config. This will return `false` in manual mode.
280
+ *
281
+ * @returns {Promise<{enabled: boolean}>} The status for auto update.
282
+ * @throws An error if the something went wrong
283
+ */
284
+ isAutoUpdateEnabled(): Promise<{
285
+ enabled: boolean;
286
+ }>;
139
287
  }
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, latestVersion } 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,22 @@ 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
+ getLatest(): Promise<latestVersion>;
38
+ notifyAppReady(): Promise<BundleInfo>;
39
+ setDelay(options: {
40
+ delay: boolean;
41
+ }): Promise<void>;
39
42
  }
package/dist/esm/web.js CHANGED
@@ -1,52 +1,61 @@
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' };
46
+ async getLatest() {
47
+ console.warn('Cannot getLatest current bundle in web');
48
+ return {
49
+ version: "0.0.0",
50
+ message: "Cannot getLatest current bundle in web",
51
+ };
39
52
  }
40
53
  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;
54
+ console.warn('Cannot notify App Ready in web');
55
+ return BUNDLE_BUILTIN;
47
56
  }
48
- async cancelDelay() {
49
- console.log('Cannot cancel delay update in web');
57
+ async setDelay(options) {
58
+ console.warn('Cannot setDelay delay update in web', options);
50
59
  return;
51
60
  }
52
61
  }
@@ -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,2BAA2B,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IACD,KAAK,CAAC,KAAK;QACT,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,EAAE,EAAE,EAAE,SAAS,EAAC,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAA4B;QACvC,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,CAAC,IAAI;QACR,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC1C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAC,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,OAAoC;QAC9C,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,KAAK,CAAC,OAAO;QACX,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,OAAO,EAAE,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c;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,63 @@ 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' };
55
+ async getLatest() {
56
+ console.warn('Cannot getLatest current bundle in web');
57
+ return {
58
+ version: "0.0.0",
59
+ message: "Cannot getLatest current bundle in web",
60
+ };
48
61
  }
49
62
  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;
63
+ console.warn('Cannot notify App Ready in web');
64
+ return BUNDLE_BUILTIN;
56
65
  }
57
- async cancelDelay() {
58
- console.log('Cannot cancel delay update in web');
66
+ async setDelay(options) {
67
+ console.warn('Cannot setDelay delay update in web', options);
59
68
  return;
60
69
  }
61
70
  }
@@ -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,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAC5C,QAAQ,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;AACjC,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AACjD,QAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACtC,KAAK;AACL,IAAI,MAAM,MAAM,CAAC,OAAO,E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","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 getLatest() {\n console.warn('Cannot getLatest current bundle in web');\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\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,CAA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