@tauri-apps/plugin-sql 2.0.0-alpha.2 → 2.0.0-alpha.4

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
@@ -109,6 +109,22 @@ const result = await db.execute(
109
109
 
110
110
  PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
111
111
 
112
+ ## Partners
113
+
114
+ <table>
115
+ <tbody>
116
+ <tr>
117
+ <td align="center" valign="middle">
118
+ <a href="https://crabnebula.dev" target="_blank">
119
+ <img src="https://github.com/tauri-apps/plugins-workspace/raw/v2/.github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
120
+ </a>
121
+ </td>
122
+ </tr>
123
+ </tbody>
124
+ </table>
125
+
126
+ For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
127
+
112
128
  ## License
113
129
 
114
130
  Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
@@ -1,6 +1,6 @@
1
- var f=Object.defineProperty;var g=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0});};var e=(a,b,c)=>{if(!b.has(a))throw TypeError("Cannot "+c)};var h=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),i$1=(a,b,c)=>{if(b.has(a))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(a):b.set(a,c);},j=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c);
1
+ 'use strict';
2
2
 
3
- var T={};g(T,{Channel:()=>i,PluginListener:()=>o,addPluginListener:()=>l,convertFileSrc:()=>v,invoke:()=>u,transformCallback:()=>_});function _(e,n=!1){return window.__TAURI_INTERNALS__.transformCallback(e,n)}var r,i=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0;i$1(this,r,()=>{});this.id=_(n=>{h(this,r).call(this,n);});}set onmessage(n){j(this,r,n);}get onmessage(){return h(this,r)}toJSON(){return `__CHANNEL__:${this.id}`}};r=new WeakMap;var o=class{constructor(n,s,t){this.plugin=n,this.event=s,this.channelId=t;}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function l(e,n,s){let t=new i;return t.onmessage=s,u(`plugin:${e}|register_listener`,{event:n,handler:t}).then(()=>new o(e,n,t.id))}async function u(e,n={},s){return window.__TAURI_INTERNALS__.invoke(e,n,s)}function v(e,n="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,n)}
3
+ var primitives = require('@tauri-apps/api/primitives');
4
4
 
5
5
  // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
6
6
  // SPDX-License-Identifier: Apache-2.0
@@ -31,7 +31,7 @@ class Database {
31
31
  * ```
32
32
  */
33
33
  static async load(path) {
34
- const _path = await u("plugin:sql|load", {
34
+ const _path = await primitives.invoke("plugin:sql|load", {
35
35
  db: path,
36
36
  });
37
37
  return new Database(_path);
@@ -88,10 +88,10 @@ class Database {
88
88
  * ```
89
89
  */
90
90
  async execute(query, bindValues) {
91
- const [rowsAffected, lastInsertId] = await u("plugin:sql|execute", {
91
+ const [rowsAffected, lastInsertId] = await primitives.invoke("plugin:sql|execute", {
92
92
  db: this.path,
93
93
  query,
94
- values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
94
+ values: bindValues ?? [],
95
95
  });
96
96
  return {
97
97
  lastInsertId,
@@ -117,10 +117,10 @@ class Database {
117
117
  * ```
118
118
  */
119
119
  async select(query, bindValues) {
120
- const result = await u("plugin:sql|select", {
120
+ const result = await primitives.invoke("plugin:sql|select", {
121
121
  db: this.path,
122
122
  query,
123
- values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
123
+ values: bindValues ?? [],
124
124
  });
125
125
  return result;
126
126
  }
@@ -136,12 +136,11 @@ class Database {
136
136
  * @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
137
137
  */
138
138
  async close(db) {
139
- const success = await u("plugin:sql|close", {
139
+ const success = await primitives.invoke("plugin:sql|close", {
140
140
  db,
141
141
  });
142
142
  return success;
143
143
  }
144
144
  }
145
145
 
146
- export { Database as default };
147
- //# sourceMappingURL=index.min.js.map
146
+ module.exports = Database;
@@ -89,7 +89,7 @@ class Database {
89
89
  const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
90
90
  db: this.path,
91
91
  query,
92
- values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
92
+ values: bindValues ?? [],
93
93
  });
94
94
  return {
95
95
  lastInsertId,
@@ -118,7 +118,7 @@ class Database {
118
118
  const result = await invoke("plugin:sql|select", {
119
119
  db: this.path,
120
120
  query,
121
- values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
121
+ values: bindValues ?? [],
122
122
  });
123
123
  return result;
124
124
  }
@@ -142,4 +142,3 @@ class Database {
142
142
  }
143
143
 
144
144
  export { Database as default };
145
- //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,31 +1,27 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-sql",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Interface with SQL databases",
5
5
  "license": "MIT or APACHE-2.0",
6
6
  "authors": [
7
7
  "Tauri Programme within The Commons Conservancy"
8
8
  ],
9
9
  "type": "module",
10
- "browser": "dist-js/index.min.js",
11
- "module": "dist-js/index.mjs",
12
- "types": "dist-js/index.d.ts",
10
+ "types": "./dist-js/index.d.ts",
11
+ "main": "./dist-js/index.cjs",
12
+ "module": "./dist-js/index.js",
13
13
  "exports": {
14
- "import": "./dist-js/index.mjs",
15
14
  "types": "./dist-js/index.d.ts",
16
- "browser": "./dist-js/index.min.js"
15
+ "import": "./dist-js/index.js",
16
+ "require": "./dist-js/index.cjs"
17
17
  },
18
18
  "files": [
19
19
  "dist-js",
20
- "!dist-js/**/*.map",
21
20
  "README.md",
22
21
  "LICENSE"
23
22
  ],
24
- "devDependencies": {
25
- "tslib": "2.6.0"
26
- },
27
23
  "dependencies": {
28
- "@tauri-apps/api": "2.0.0-alpha.9"
24
+ "@tauri-apps/api": "2.0.0-alpha.12"
29
25
  },
30
26
  "scripts": {
31
27
  "build": "rollup -c"