diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.nvmrc b/.nvmrc index 8783404..32f8c50 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20.12.2 +24.13.1 diff --git a/api-iife.js b/api-iife.js index cf3a7fb..5fdfc7a 100644 --- a/api-iife.js +++ b/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_SQLITE__=function(t){"use strict";function e(t,e,s,i){if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function s(t,e,s,i,a){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var i,a,n,h;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),a.set(this,0),n.set(this,[]),h.set(this,void 0),s(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}(t=>{const r=t.index;if("end"in t)return void(r==e(this,a,"f")?this.cleanupCallback():s(this,h,r));const c=t.message;if(r==e(this,a,"f")){for(e(this,i,"f").call(this,c),s(this,a,e(this,a,"f")+1);e(this,a,"f")in e(this,n,"f");){const t=e(this,n,"f")[e(this,a,"f")];e(this,i,"f").call(this,t),delete e(this,n,"f")[e(this,a,"f")],s(this,a,e(this,a,"f")+1)}e(this,a,"f")===e(this,h,"f")&&this.cleanupCallback()}else e(this,n,"f")[r]=c})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){s(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,a=new WeakMap,n=new WeakMap,h=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function u(t,e={},s){return window.__TAURI_INTERNALS__.invoke(t,e,s)}class _{constructor(t,e){this._dbPath=t,this._transactionId=e}async read(t,e){return await u("plugin:sqlite|transaction_read",{token:{dbPath:this._dbPath,transactionId:this._transactionId},query:t,values:e??[]})}async continueWith(t){const e=await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Continue",statements:t.map(([t,e])=>({query:t,values:e??[]}))}});return new _(e.dbPath,e.transactionId)}async commit(){await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Commit"}})}async rollback(){await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Rollback"}})}}class l{constructor(t){this._subscriptionId=t}get id(){return this._subscriptionId}async unsubscribe(){return await u("plugin:sqlite|unsubscribe",{subscriptionId:this._subscriptionId})}}class o{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_all",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null})}}class d{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_one",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null})}}class b{constructor(t,e,s,i,a){this._db=t,this._query=e,this._bindValues=s,this._keyset=i,this._pageSize=a,this._after=null,this._before=null,this._attached=[]}after(t){return this._after=t,this}before(t){return this._before=t,this}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_page",{db:this._db.path,query:this._query,values:this._bindValues,keyset:this._keyset,pageSize:this._pageSize,after:this._after,before:this._before,attached:this._attached.length>0?this._attached:null})}}class p{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){const[t,e]=await u("plugin:sqlite|execute",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null});return{lastInsertId:e,rowsAffected:t}}}class f{constructor(t,e,s=[]){this._db=t,this._initialStatements=e,this._attached=s}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){const t=await u("plugin:sqlite|begin_interruptible_transaction",{db:this._db.path,initialStatements:this._initialStatements.map(([t,e])=>({query:t,values:e??[]})),attached:this._attached.length>0?this._attached:null});return new _(t.dbPath,t.transactionId)}}class w{constructor(t,e,s=[]){this._db=t,this._statements=e,this._attached=s}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|execute_transaction",{db:this._db.path,statements:this._statements.map(([t,e])=>({query:t,values:e??[]})),attached:this._attached.length>0?this._attached:null})}}class y{constructor(t){this.path=t}static async load(t,e){const s=await u("plugin:sqlite|load",{db:t,customConfig:e});return new y(s)}static get(t){return new y(t)}static async close_all(){await u("plugin:sqlite|close_all")}execute(t,e){return new p(this,t,e??[])}executeTransaction(t){return new w(this,t)}fetchAll(t,e){return new o(this,t,e??[])}fetchOne(t,e){return new d(this,t,e??[])}fetchPage(t,e,s,i){return new b(this,t,e??[],s,i)}async observe(t,e){await u("plugin:sqlite|observe",{db:this.path,tables:t,config:e??null})}async subscribe(t,e){const s=new c;s.onmessage=e;const i=await u("plugin:sqlite|subscribe",{db:this.path,tables:t,onEvent:s});return new l(i)}async unobserve(){await u("plugin:sqlite|unobserve",{db:this.path})}async close(){return await u("plugin:sqlite|close",{db:this.path})}async remove(){return await u("plugin:sqlite|remove",{db:this.path})}beginInterruptibleTransaction(t){return new f(this,t)}async getMigrationEvents(){return await u("plugin:sqlite|get_migration_events",{db:this.path})}}return t.InterruptibleTransaction=_,t.Subscription=l,t.default=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({});Object.defineProperty(window.__TAURI__,"sqlite",{value:__TAURI_PLUGIN_SQLITE__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_SQLITE__=function(t){"use strict";function e(t,e,s,i){if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function s(t,e,s,i,a){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var i,a,n,h;"function"==typeof SuppressedError&&SuppressedError;const r="__TAURI_TO_IPC_KEY__";class c{constructor(t){i.set(this,void 0),a.set(this,0),n.set(this,[]),h.set(this,void 0),s(this,i,t||(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}(t=>{const r=t.index;if("end"in t)return void(r==e(this,a,"f")?this.cleanupCallback():s(this,h,r));const c=t.message;if(r==e(this,a,"f")){for(e(this,i,"f").call(this,c),s(this,a,e(this,a,"f")+1);e(this,a,"f")in e(this,n,"f");){const t=e(this,n,"f")[e(this,a,"f")];e(this,i,"f").call(this,t),delete e(this,n,"f")[e(this,a,"f")],s(this,a,e(this,a,"f")+1)}e(this,a,"f")===e(this,h,"f")&&this.cleanupCallback()}else e(this,n,"f")[r]=c})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){s(this,i,t)}get onmessage(){return e(this,i,"f")}[(i=new WeakMap,a=new WeakMap,n=new WeakMap,h=new WeakMap,r)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[r]()}}async function u(t,e={},s){return window.__TAURI_INTERNALS__.invoke(t,e,s)}class _{constructor(t,e){this._dbPath=t,this._transactionId=e}async read(t,e){return await u("plugin:sqlite|transaction_read",{token:{dbPath:this._dbPath,transactionId:this._transactionId},query:t,values:e??[]})}async continueWith(t){const e=await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Continue",statements:t.map(([t,e])=>({query:t,values:e??[]}))}});return new _(e.dbPath,e.transactionId)}async commit(){await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Commit"}})}async rollback(){await u("plugin:sqlite|transaction_continue",{token:{dbPath:this._dbPath,transactionId:this._transactionId},action:{type:"Rollback"}})}}class l{constructor(t){this._subscriptionId=t}get id(){return this._subscriptionId}async unsubscribe(){return await u("plugin:sqlite|unsubscribe",{subscriptionId:this._subscriptionId})}}class o{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_all",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null})}}class d{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_one",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null})}}class b{constructor(t,e,s,i,a){this._db=t,this._query=e,this._bindValues=s,this._keyset=i,this._pageSize=a,this._after=null,this._before=null,this._attached=[]}after(t){return this._after=t,this}before(t){return this._before=t,this}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|fetch_page",{db:this._db.path,query:this._query,values:this._bindValues,keyset:this._keyset,pageSize:this._pageSize,after:this._after,before:this._before,attached:this._attached.length>0?this._attached:null})}}class p{constructor(t,e,s,i=[]){this._db=t,this._query=e,this._bindValues=s,this._attached=i}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){const[t,e]=await u("plugin:sqlite|execute",{db:this._db.path,query:this._query,values:this._bindValues,attached:this._attached.length>0?this._attached:null});return{lastInsertId:e,rowsAffected:t}}}class f{constructor(t,e,s=[]){this._db=t,this._initialStatements=e,this._attached=s}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){const t=await u("plugin:sqlite|begin_interruptible_transaction",{db:this._db.path,initialStatements:this._initialStatements.map(([t,e])=>({query:t,values:e??[]})),attached:this._attached.length>0?this._attached:null});return new _(t.dbPath,t.transactionId)}}class w{constructor(t,e,s=[]){this._db=t,this._statements=e,this._attached=s}attach(t){return this._attached=t,this}then(t,e){return this._execute().then(t,e)}async _execute(){return await u("plugin:sqlite|execute_transaction",{db:this._db.path,statements:this._statements.map(([t,e])=>({query:t,values:e??[]})),attached:this._attached.length>0?this._attached:null})}}class y{constructor(t){this.path=t}static async load(t,e){const s=await u("plugin:sqlite|load",{db:t,customConfig:e});return new y(s)}static get(t){return new y(t)}static async close_all(){await u("plugin:sqlite|close_all")}execute(t,e){return new p(this,t,e??[])}executeTransaction(t){return new w(this,t)}fetchAll(t,e){return new o(this,t,e??[])}fetchOne(t,e){return new d(this,t,e??[])}fetchPage(t,e,s,i){return new b(this,t,e,s,i)}async observe(t,e){await u("plugin:sqlite|observe",{db:this.path,tables:t,config:e??null})}async subscribe(t,e){const s=new c;s.onmessage=e;const i=await u("plugin:sqlite|subscribe",{db:this.path,tables:t,onEvent:s});return new l(i)}async unobserve(){await u("plugin:sqlite|unobserve",{db:this.path})}async close(){return await u("plugin:sqlite|close",{db:this.path})}async remove(){return await u("plugin:sqlite|remove",{db:this.path})}beginInterruptibleTransaction(t){return new f(this,t)}async getMigrationEvents(){return await u("plugin:sqlite|get_migration_events",{db:this.path})}}return t.InterruptibleTransaction=_,t.Subscription=l,t.default=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({});Object.defineProperty(window.__TAURI__,"sqlite",{value:__TAURI_PLUGIN_SQLITE__})} diff --git a/package-lock.json b/package-lock.json index 8ae03d0..2909aa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "vitest": "3.2.3" }, "peerDependencies": { - "@tauri-apps/api": "2.9.1" + "@tauri-apps/api": "^2.9.0" } }, "node_modules/@asamuzakjp/css-color": { @@ -10056,31 +10056,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/vite-node/node_modules/sugarss": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/sugarss/-/sugarss-5.0.1.tgz", - "integrity": "sha512-ctS5RYCBVvPoZAnzIaX5QSShK8ZiZxD5HUqSxlusvEMC+QZQIPCPOIJg6aceFX+K2rf4+SH89eu++h1Zmsr2nw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=18.0" - }, - "peerDependencies": { - "postcss": "^8.3.3" - } - }, "node_modules/vite-node/node_modules/vite": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.6.tgz", @@ -10156,24 +10131,6 @@ } } }, - "node_modules/vite-node/node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - }, - "funding": { - "url": "https://github.com/sponsors/eemeli" - } - }, "node_modules/vitest": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.3.tgz", @@ -10344,31 +10301,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/vitest/node_modules/sugarss": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/sugarss/-/sugarss-5.0.1.tgz", - "integrity": "sha512-ctS5RYCBVvPoZAnzIaX5QSShK8ZiZxD5HUqSxlusvEMC+QZQIPCPOIJg6aceFX+K2rf4+SH89eu++h1Zmsr2nw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=18.0" - }, - "peerDependencies": { - "postcss": "^8.3.3" - } - }, "node_modules/vitest/node_modules/vite": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.6.tgz", @@ -10444,24 +10376,6 @@ } } }, - "node_modules/vitest/node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - }, - "funding": { - "url": "https://github.com/sponsors/eemeli" - } - }, "node_modules/vue-eslint-parser": { "version": "9.4.3", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz", diff --git a/package.json b/package.json index 575821a..fdfe120 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,6 @@ "vitest": "3.2.3" }, "peerDependencies": { - "@tauri-apps/api": "2.9.1" + "@tauri-apps/api": "^2.9.0" } }