@tauri-apps/plugin-updater 2.6.0 → 2.7.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 CHANGED
@@ -76,7 +76,7 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
76
76
  import { check } from '@tauri-apps/plugin-updater'
77
77
  import { relaunch } from '@tauri-apps/plugin-process'
78
78
  const update = await check()
79
- if (update?.available) {
79
+ if (update) {
80
80
  await update.downloadAndInstall()
81
81
  await relaunch()
82
82
  }
package/dist-js/index.cjs CHANGED
@@ -8,7 +8,7 @@ var core = require('@tauri-apps/api/core');
8
8
  class Update extends core.Resource {
9
9
  constructor(metadata) {
10
10
  super(metadata.rid);
11
- this.available = metadata.available;
11
+ this.available = true;
12
12
  this.currentVersion = metadata.currentVersion;
13
13
  this.version = metadata.version;
14
14
  this.date = metadata.date;
@@ -62,9 +62,10 @@ async function check(options) {
62
62
  if (options?.headers) {
63
63
  options.headers = Array.from(new Headers(options.headers).entries());
64
64
  }
65
- return await core.invoke('plugin:updater|check', {
65
+ const metadata = await core.invoke('plugin:updater|check', {
66
66
  ...options
67
- }).then((meta) => (meta.available ? new Update(meta) : null));
67
+ });
68
+ return metadata ? new Update(metadata) : null;
68
69
  }
69
70
 
70
71
  exports.Update = Update;
@@ -31,7 +31,6 @@ interface DownloadOptions {
31
31
  }
32
32
  interface UpdateMetadata {
33
33
  rid: number;
34
- available: boolean;
35
34
  currentVersion: string;
36
35
  version: string;
37
36
  date?: string;
@@ -53,6 +52,7 @@ type DownloadEvent = {
53
52
  event: 'Finished';
54
53
  };
55
54
  declare class Update extends Resource {
55
+ /** @deprecated This is always true, check if the return value is `null` instead when using {@linkcode check} */
56
56
  available: boolean;
57
57
  currentVersion: string;
58
58
  version: string;
package/dist-js/index.js CHANGED
@@ -6,7 +6,7 @@ import { Resource, Channel, invoke } from '@tauri-apps/api/core';
6
6
  class Update extends Resource {
7
7
  constructor(metadata) {
8
8
  super(metadata.rid);
9
- this.available = metadata.available;
9
+ this.available = true;
10
10
  this.currentVersion = metadata.currentVersion;
11
11
  this.version = metadata.version;
12
12
  this.date = metadata.date;
@@ -60,9 +60,10 @@ async function check(options) {
60
60
  if (options?.headers) {
61
61
  options.headers = Array.from(new Headers(options.headers).entries());
62
62
  }
63
- return await invoke('plugin:updater|check', {
63
+ const metadata = await invoke('plugin:updater|check', {
64
64
  ...options
65
- }).then((meta) => (meta.available ? new Update(meta) : null));
65
+ });
66
+ return metadata ? new Update(metadata) : null;
66
67
  }
67
68
 
68
69
  export { Update, check };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-updater",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"