@tauri-apps/plugin-sql 2.0.0-alpha.3 → 2.0.0-alpha.5
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 +16 -0
- package/dist-js/{index.min.js → index.cjs} +9 -47
- package/dist-js/{index.mjs → index.js} +3 -4
- package/package.json +7 -11
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,43 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */
|
|
15
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
19
|
-
var e = new Error(message);
|
|
20
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
21
|
-
};
|
|
1
|
+
'use strict';
|
|
22
2
|
|
|
23
|
-
|
|
24
|
-
* Sends a message to the backend.
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import { invoke } from '@tauri-apps/api/primitives';
|
|
28
|
-
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param cmd The command name.
|
|
32
|
-
* @param args The optional arguments to pass to the command.
|
|
33
|
-
* @param options The request options.
|
|
34
|
-
* @return A promise resolving or rejecting to the backend response.
|
|
35
|
-
*
|
|
36
|
-
* @since 1.0.0
|
|
37
|
-
*/
|
|
38
|
-
async function invoke(cmd, args = {}, options) {
|
|
39
|
-
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
|
|
40
|
-
}
|
|
3
|
+
var core = require('@tauri-apps/api/core');
|
|
41
4
|
|
|
42
5
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
43
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -68,7 +31,7 @@ class Database {
|
|
|
68
31
|
* ```
|
|
69
32
|
*/
|
|
70
33
|
static async load(path) {
|
|
71
|
-
const _path = await invoke("plugin:sql|load", {
|
|
34
|
+
const _path = await core.invoke("plugin:sql|load", {
|
|
72
35
|
db: path,
|
|
73
36
|
});
|
|
74
37
|
return new Database(_path);
|
|
@@ -125,10 +88,10 @@ class Database {
|
|
|
125
88
|
* ```
|
|
126
89
|
*/
|
|
127
90
|
async execute(query, bindValues) {
|
|
128
|
-
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
|
91
|
+
const [rowsAffected, lastInsertId] = await core.invoke("plugin:sql|execute", {
|
|
129
92
|
db: this.path,
|
|
130
93
|
query,
|
|
131
|
-
values: bindValues
|
|
94
|
+
values: bindValues ?? [],
|
|
132
95
|
});
|
|
133
96
|
return {
|
|
134
97
|
lastInsertId,
|
|
@@ -154,10 +117,10 @@ class Database {
|
|
|
154
117
|
* ```
|
|
155
118
|
*/
|
|
156
119
|
async select(query, bindValues) {
|
|
157
|
-
const result = await invoke("plugin:sql|select", {
|
|
120
|
+
const result = await core.invoke("plugin:sql|select", {
|
|
158
121
|
db: this.path,
|
|
159
122
|
query,
|
|
160
|
-
values: bindValues
|
|
123
|
+
values: bindValues ?? [],
|
|
161
124
|
});
|
|
162
125
|
return result;
|
|
163
126
|
}
|
|
@@ -173,12 +136,11 @@ class Database {
|
|
|
173
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.
|
|
174
137
|
*/
|
|
175
138
|
async close(db) {
|
|
176
|
-
const success = await invoke("plugin:sql|close", {
|
|
139
|
+
const success = await core.invoke("plugin:sql|close", {
|
|
177
140
|
db,
|
|
178
141
|
});
|
|
179
142
|
return success;
|
|
180
143
|
}
|
|
181
144
|
}
|
|
182
145
|
|
|
183
|
-
|
|
184
|
-
//# sourceMappingURL=index.min.js.map
|
|
146
|
+
module.exports = Database;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { invoke } from '@tauri-apps/api/
|
|
1
|
+
import { invoke } from '@tauri-apps/api/core';
|
|
2
2
|
|
|
3
3
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -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
|
|
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
|
|
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.
|
|
3
|
+
"version": "2.0.0-alpha.5",
|
|
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
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
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
|
-
"
|
|
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.
|
|
24
|
+
"@tauri-apps/api": "2.0.0-alpha.13"
|
|
29
25
|
},
|
|
30
26
|
"scripts": {
|
|
31
27
|
"build": "rollup -c"
|