@tauri-apps/plugin-sql 2.0.0-alpha.2 → 2.0.0-alpha.3
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/dist-js/index.min.js +43 -6
- package/package.json +2 -2
package/dist-js/index.min.js
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
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
|
+
};
|
|
2
22
|
|
|
3
|
-
|
|
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
|
+
}
|
|
4
41
|
|
|
5
42
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
43
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -31,7 +68,7 @@ class Database {
|
|
|
31
68
|
* ```
|
|
32
69
|
*/
|
|
33
70
|
static async load(path) {
|
|
34
|
-
const _path = await
|
|
71
|
+
const _path = await invoke("plugin:sql|load", {
|
|
35
72
|
db: path,
|
|
36
73
|
});
|
|
37
74
|
return new Database(_path);
|
|
@@ -88,7 +125,7 @@ class Database {
|
|
|
88
125
|
* ```
|
|
89
126
|
*/
|
|
90
127
|
async execute(query, bindValues) {
|
|
91
|
-
const [rowsAffected, lastInsertId] = await
|
|
128
|
+
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
|
92
129
|
db: this.path,
|
|
93
130
|
query,
|
|
94
131
|
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
|
@@ -117,7 +154,7 @@ class Database {
|
|
|
117
154
|
* ```
|
|
118
155
|
*/
|
|
119
156
|
async select(query, bindValues) {
|
|
120
|
-
const result = await
|
|
157
|
+
const result = await invoke("plugin:sql|select", {
|
|
121
158
|
db: this.path,
|
|
122
159
|
query,
|
|
123
160
|
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
|
@@ -136,7 +173,7 @@ class Database {
|
|
|
136
173
|
* @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
174
|
*/
|
|
138
175
|
async close(db) {
|
|
139
|
-
const success = await
|
|
176
|
+
const success = await invoke("plugin:sql|close", {
|
|
140
177
|
db,
|
|
141
178
|
});
|
|
142
179
|
return success;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-sql",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"description": "Interface with SQL databases",
|
|
5
5
|
"license": "MIT or APACHE-2.0",
|
|
6
6
|
"authors": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"tslib": "2.6.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@tauri-apps/api": "2.0.0-alpha.
|
|
28
|
+
"@tauri-apps/api": "2.0.0-alpha.11"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "rollup -c"
|