A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: run sqlite on another thread
Abdullah Atta9693c8ea5492
diff --git a/apps/desktop/package-lock.json b/apps/desktop/package-lock.jsonindex b474303a4..48c2fdd1d 100644--- a/apps/desktop/package-lock.json+++ b/apps/desktop/package-lock.json@@ -29,6 +29,7 @@"electron": "^29.3.1","electron-builder": "^24.13.3","esbuild": "^0.20.0",+ "kysely": "^0.27.3","node-gyp-build": "^4.8.0","prebuildify": "^6.0.1","tree-kill": "^1.2.2",@@ -112,7 +113,6 @@"version": "2.0.2","resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.2.tgz","integrity": "sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g==",- "dev": true,"dependencies": {"debug": "^4.1.1","env-paths": "^2.2.0",@@ -133,7 +133,6 @@"version": "8.1.0","resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz","integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",- "dev": true,"dependencies": {"graceful-fs": "^4.2.0","jsonfile": "^4.0.0",@@ -147,7 +146,6 @@"version": "4.0.0","resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz","integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",- "dev": true,"optionalDependencies": {"graceful-fs": "^4.1.6"}@@ -156,7 +154,6 @@"version": "6.3.0","resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz","integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",- "dev": true,"bin": {"semver": "bin/semver.js"}@@ -165,7 +162,6 @@"version": "0.1.2","resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz","integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",- "dev": true,"engines": {"node": ">= 4.0.0"}@@ -821,7 +817,6 @@"version": "4.6.0","resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz","integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",- "dev": true,"engines": {"node": ">=10"},@@ -833,7 +828,6 @@"version": "4.0.6","resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz","integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==",- "dev": true,"dependencies": {"defer-to-connect": "^2.0.0"},@@ -878,7 +872,6 @@"version": "6.0.3","resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz","integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==",- "dev": true,"dependencies": {"@types/http-cache-semantics": "*","@types/keyv": "^3.1.4",@@ -907,14 +900,12 @@"node_modules/@types/http-cache-semantics": {"version": "4.0.1","resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz",- "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==",- "dev": true+ "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ=="},"node_modules/@types/keyv": {"version": "3.1.4","resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz","integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==",- "dev": true,"dependencies": {"@types/node": "*"}@@ -928,8 +919,7 @@"node_modules/@types/node": {"version": "18.16.1","resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz",- "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==",- "devOptional": true+ "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA=="},"node_modules/@types/plist": {"version": "3.0.2",@@ -945,7 +935,6 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz","integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==",- "dev": true,"dependencies": {"@types/node": "*"}@@ -975,7 +964,6 @@"version": "2.10.0","resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz","integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",- "dev": true,"optional": true,"dependencies": {"@types/node": "*"@@ -1120,6 +1108,80 @@"node": ">=12.0.0"}},+ "node_modules/archiver": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.2.tgz",+ "integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "archiver-utils": "^2.1.0",+ "async": "^3.2.4",+ "buffer-crc32": "^0.2.1",+ "readable-stream": "^3.6.0",+ "readdir-glob": "^1.1.2",+ "tar-stream": "^2.2.0",+ "zip-stream": "^4.1.0"+ },+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/archiver-utils": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz",+ "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "glob": "^7.1.4",+ "graceful-fs": "^4.2.0",+ "lazystream": "^1.0.0",+ "lodash.defaults": "^4.2.0",+ "lodash.difference": "^4.5.0",+ "lodash.flatten": "^4.4.0",+ "lodash.isplainobject": "^4.0.6",+ "lodash.union": "^4.6.0",+ "normalize-path": "^3.0.0",+ "readable-stream": "^2.0.0"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/archiver-utils/node_modules/readable-stream": {+ "version": "2.3.8",+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "core-util-is": "~1.0.0",+ "inherits": "~2.0.3",+ "isarray": "~1.0.0",+ "process-nextick-args": "~2.0.0",+ "safe-buffer": "~5.1.1",+ "string_decoder": "~1.1.1",+ "util-deprecate": "~1.0.1"+ }+ },+ "node_modules/archiver-utils/node_modules/safe-buffer": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",+ "dev": true,+ "peer": true+ },+ "node_modules/archiver-utils/node_modules/string_decoder": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "safe-buffer": "~5.1.0"+ }+ },"node_modules/argparse": {"version": "2.0.1","resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",@@ -1259,7 +1321,6 @@"version": "3.2.0","resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz","integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",- "dev": true,"optional": true},"node_modules/brace-expansion": {@@ -1310,7 +1371,6 @@"version": "0.2.13","resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz","integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",- "dev": true,"engines": {"node": "*"}@@ -1386,7 +1446,6 @@"version": "5.0.4","resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz","integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==",- "dev": true,"engines": {"node": ">=10.6.0"}@@ -1395,7 +1454,6 @@"version": "7.0.4","resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz","integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==",- "dev": true,"dependencies": {"clone-response": "^1.0.2","get-stream": "^5.1.0",@@ -1515,7 +1573,6 @@"version": "1.0.3","resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz","integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==",- "dev": true,"dependencies": {"mimic-response": "^1.0.0"},@@ -1569,6 +1626,22 @@"node": ">=0.10.0"}},+ "node_modules/compress-commons": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz",+ "integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "buffer-crc32": "^0.2.13",+ "crc32-stream": "^4.0.2",+ "normalize-path": "^3.0.0",+ "readable-stream": "^3.6.0"+ },+ "engines": {+ "node": ">= 10"+ }+ },"node_modules/concat-map": {"version": "0.0.1","resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",@@ -1635,7 +1708,7 @@"version": "1.0.2","resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz","integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",- "optional": true+ "devOptional": true},"node_modules/crc": {"version": "3.8.0",@@ -1646,6 +1719,33 @@"buffer": "^5.1.0"}},+ "node_modules/crc-32": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",+ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",+ "dev": true,+ "peer": true,+ "bin": {+ "crc32": "bin/crc32.njs"+ },+ "engines": {+ "node": ">=0.8"+ }+ },+ "node_modules/crc32-stream": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz",+ "integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "crc-32": "^1.2.0",+ "readable-stream": "^3.4.0"+ },+ "engines": {+ "node": ">= 10"+ }+ },"node_modules/cross-spawn": {"version": "7.0.3","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",@@ -1738,7 +1838,6 @@"version": "2.0.1","resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz","integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==",- "dev": true,"engines": {"node": ">=10"}@@ -1747,7 +1846,6 @@"version": "1.2.0","resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz","integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==",- "dev": true,"optional": true,"dependencies": {"has-property-descriptors": "^1.0.0",@@ -1781,7 +1879,6 @@"version": "2.1.0","resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz","integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",- "dev": true,"optional": true},"node_modules/dir-compare": {@@ -1911,7 +2008,6 @@"version": "29.3.1","resolved": "https://registry.npmjs.org/electron/-/electron-29.3.1.tgz","integrity": "sha512-auge1/6RVqgUd6TgIq88wKdUCJi2cjESi3jy7d+6X4JzvBGprKBqMJ8JSSFpu/Px1YJrFUKAxfy6SC+TQf1uLw==",- "dev": true,"hasInstallScript": true,"dependencies": {"@electron/get": "^2.0.0",@@ -1951,6 +2047,19 @@"node": ">=14.0.0"}},+ "node_modules/electron-builder-squirrel-windows": {+ "version": "24.13.3",+ "resolved": "https://registry.npmjs.org/electron-builder-squirrel-windows/-/electron-builder-squirrel-windows-24.13.3.tgz",+ "integrity": "sha512-oHkV0iogWfyK+ah9ZIvMDpei1m9ZRpdXcvde1wTpra2U8AFDNNpqJdnin5z+PM1GbQ5BoaKCWas2HSjtR0HwMg==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "app-builder-lib": "24.13.3",+ "archiver": "^5.3.1",+ "builder-util": "24.13.1",+ "fs-extra": "^10.1.0"+ }+ },"node_modules/electron-builder/node_modules/builder-util-runtime": {"version": "9.2.4","resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz",@@ -2024,7 +2133,6 @@"version": "20.12.7","resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz","integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",- "dev": true,"dependencies": {"undici-types": "~5.26.4"}@@ -2046,7 +2154,6 @@"version": "2.2.1","resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz","integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",- "dev": true,"engines": {"node": ">=6"}@@ -2061,7 +2168,6 @@"version": "4.1.1","resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz","integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",- "dev": true,"optional": true},"node_modules/esbuild": {@@ -2114,7 +2220,6 @@"version": "4.0.0","resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz","integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",- "dev": true,"optional": true,"engines": {"node": ">=10"@@ -2135,7 +2240,6 @@"version": "2.0.1","resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz","integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",- "dev": true,"dependencies": {"debug": "^4.1.1","get-stream": "^5.1.0",@@ -2176,7 +2280,6 @@"version": "1.1.0","resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz","integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",- "dev": true,"dependencies": {"pend": "~1.2.0"}@@ -2319,7 +2422,6 @@"version": "1.1.1","resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz","integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",- "dev": true,"optional": true},"node_modules/get-caller-file": {@@ -2334,7 +2436,6 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz","integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",- "dev": true,"optional": true,"dependencies": {"function-bind": "^1.1.1",@@ -2350,7 +2451,6 @@"version": "5.2.0","resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz","integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",- "dev": true,"dependencies": {"pump": "^3.0.0"},@@ -2424,7 +2524,6 @@"version": "3.0.0","resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz","integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",- "dev": true,"optional": true,"dependencies": {"boolean": "^3.0.1",@@ -2442,7 +2541,6 @@"version": "1.0.3","resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz","integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==",- "dev": true,"optional": true,"dependencies": {"define-properties": "^1.1.3"@@ -2458,7 +2556,6 @@"version": "11.8.6","resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz","integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==",- "dev": true,"dependencies": {"@sindresorhus/is": "^4.0.0","@szmarczak/http-timer": "^4.0.5",@@ -2488,7 +2585,6 @@"version": "1.0.3","resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz","integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",- "dev": true,"optional": true,"dependencies": {"function-bind": "^1.1.1"@@ -2510,7 +2606,6 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz","integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",- "dev": true,"optional": true,"dependencies": {"get-intrinsic": "^1.1.1"@@ -2523,7 +2618,6 @@"version": "1.0.1","resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz","integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",- "dev": true,"optional": true,"engines": {"node": ">= 0.4"@@ -2536,7 +2630,6 @@"version": "1.0.3","resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz","integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",- "dev": true,"optional": true,"engines": {"node": ">= 0.4"@@ -2560,8 +2653,7 @@"node_modules/http-cache-semantics": {"version": "4.1.1","resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",- "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",- "dev": true+ "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="},"node_modules/http-proxy-agent": {"version": "5.0.0",@@ -2581,7 +2673,6 @@"version": "1.0.3","resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz","integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==",- "dev": true,"dependencies": {"quick-lru": "^5.1.1","resolve-alpn": "^1.0.0"@@ -2748,6 +2839,13 @@"node": ">=0.12.0"}},+ "node_modules/isarray": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",+ "dev": true,+ "peer": true+ },"node_modules/isbinaryfile": {"version": "5.0.2","resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-5.0.2.tgz",@@ -2843,8 +2941,7 @@"node_modules/json-buffer": {"version": "3.0.1","resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",- "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",- "dev": true+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="},"node_modules/json-schema-traverse": {"version": "0.4.1",@@ -2856,7 +2953,6 @@"version": "5.0.1","resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz","integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",- "dev": true,"optional": true},"node_modules/json5": {@@ -2886,37 +2982,125 @@"version": "4.5.2","resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz","integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==",- "dev": true,"dependencies": {"json-buffer": "3.0.1"}},+ "node_modules/kysely": {+ "version": "0.27.3",+ "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.27.3.tgz",+ "integrity": "sha512-lG03Ru+XyOJFsjH3OMY6R/9U38IjDPfnOfDgO3ynhbDr+Dz8fak+X6L62vqu3iybQnj+lG84OttBuU9KY3L9kA==",+ "dev": true,+ "engines": {+ "node": ">=14.0.0"+ }+ },"node_modules/lazy-val": {"version": "1.0.5","resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz","integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q=="},+ "node_modules/lazystream": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz",+ "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "readable-stream": "^2.0.5"+ },+ "engines": {+ "node": ">= 0.6.3"+ }+ },+ "node_modules/lazystream/node_modules/readable-stream": {+ "version": "2.3.8",+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "core-util-is": "~1.0.0",+ "inherits": "~2.0.3",+ "isarray": "~1.0.0",+ "process-nextick-args": "~2.0.0",+ "safe-buffer": "~5.1.1",+ "string_decoder": "~1.1.1",+ "util-deprecate": "~1.0.1"+ }+ },+ "node_modules/lazystream/node_modules/safe-buffer": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",+ "dev": true,+ "peer": true+ },+ "node_modules/lazystream/node_modules/string_decoder": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "safe-buffer": "~5.1.0"+ }+ },"node_modules/lodash": {"version": "4.17.21","resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz","integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==","dev": true},+ "node_modules/lodash.defaults": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",+ "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==",+ "dev": true,+ "peer": true+ },+ "node_modules/lodash.difference": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz",+ "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==",+ "dev": true,+ "peer": true+ },"node_modules/lodash.escaperegexp": {"version": "4.1.2","resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz","integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw=="},+ "node_modules/lodash.flatten": {+ "version": "4.4.0",+ "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",+ "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==",+ "dev": true,+ "peer": true+ },"node_modules/lodash.isequal": {"version": "4.5.0","resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz","integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="},+ "node_modules/lodash.isplainobject": {+ "version": "4.0.6",+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",+ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",+ "dev": true,+ "peer": true+ },+ "node_modules/lodash.union": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz",+ "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==",+ "dev": true,+ "peer": true+ },"node_modules/lowercase-keys": {"version": "2.0.0","resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz","integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==",- "dev": true,"engines": {"node": ">=8"}@@ -2936,7 +3120,6 @@"version": "3.0.0","resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz","integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",- "dev": true,"optional": true,"dependencies": {"escape-string-regexp": "^4.0.0"@@ -2982,7 +3165,6 @@"version": "1.0.1","resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz","integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",- "dev": true,"engines": {"node": ">=4"}@@ -3108,7 +3290,6 @@"version": "6.1.0","resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz","integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==",- "dev": true,"engines": {"node": ">=10"},@@ -3132,7 +3313,6 @@"version": "1.1.1","resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz","integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",- "dev": true,"optional": true,"engines": {"node": ">= 0.4"@@ -3150,7 +3330,6 @@"version": "2.1.1","resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz","integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==",- "dev": true,"engines": {"node": ">=8"}@@ -3213,8 +3392,7 @@"node_modules/pend": {"version": "1.2.0","resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",- "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",- "dev": true+ "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="},"node_modules/picomatch": {"version": "2.3.1",@@ -3291,11 +3469,17 @@"prebuildify": "bin.js"}},+ "node_modules/process-nextick-args": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",+ "dev": true,+ "peer": true+ },"node_modules/progress": {"version": "2.0.3","resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz","integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",- "dev": true,"engines": {"node": ">=0.4.0"}@@ -3335,7 +3519,6 @@"version": "5.1.1","resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz","integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",- "dev": true,"engines": {"node": ">=10"},@@ -3402,6 +3585,16 @@"url": "https://github.com/sponsors/Borewit"}},+ "node_modules/readdir-glob": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz",+ "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "minimatch": "^5.1.0"+ }+ },"node_modules/readdirp": {"version": "3.6.0","resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",@@ -3425,14 +3618,12 @@"node_modules/resolve-alpn": {"version": "1.2.1","resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",- "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==",- "dev": true+ "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g=="},"node_modules/responselike": {"version": "2.0.1","resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz","integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==",- "dev": true,"dependencies": {"lowercase-keys": "^2.0.0"},@@ -3453,7 +3644,6 @@"version": "2.15.4","resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz","integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",- "dev": true,"optional": true,"dependencies": {"boolean": "^3.0.1",@@ -3533,14 +3723,12 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz","integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",- "dev": true,"optional": true},"node_modules/serialize-error": {"version": "7.0.1","resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz","integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",- "dev": true,"optional": true,"dependencies": {"type-fest": "^0.13.1"@@ -3556,7 +3744,6 @@"version": "0.13.1","resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz","integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",- "dev": true,"optional": true,"engines": {"node": ">=10"@@ -3709,7 +3896,6 @@"version": "1.1.3","resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz","integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",- "dev": true,"optional": true},"node_modules/stat-mode": {@@ -3809,7 +3995,6 @@"version": "3.0.1","resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz","integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==",- "dev": true,"dependencies": {"debug": "^4.1.0"},@@ -4011,8 +4196,7 @@"node_modules/undici-types": {"version": "5.26.5","resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",- "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",- "dev": true+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="},"node_modules/universalify": {"version": "2.0.0",@@ -4161,12 +4345,48 @@"version": "2.10.0","resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz","integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",- "dev": true,"dependencies": {"buffer-crc32": "~0.2.3","fd-slicer": "~1.1.0"}},+ "node_modules/zip-stream": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz",+ "integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "archiver-utils": "^3.0.4",+ "compress-commons": "^4.1.2",+ "readable-stream": "^3.6.0"+ },+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/zip-stream/node_modules/archiver-utils": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz",+ "integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==",+ "dev": true,+ "peer": true,+ "dependencies": {+ "glob": "^7.2.3",+ "graceful-fs": "^4.2.0",+ "lazystream": "^1.0.0",+ "lodash.defaults": "^4.2.0",+ "lodash.difference": "^4.5.0",+ "lodash.flatten": "^4.4.0",+ "lodash.isplainobject": "^4.0.6",+ "lodash.union": "^4.6.0",+ "normalize-path": "^3.0.0",+ "readable-stream": "^3.6.0"+ },+ "engines": {+ "node": ">= 10"+ }+ },"node_modules/zod": {"version": "3.21.4","resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 0fd87df39..5fb71b101 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -30,6 +30,7 @@"electron": "^29.3.1","electron-builder": "^24.13.3","esbuild": "^0.20.0",+ "kysely": "^0.27.3","node-gyp-build": "^4.8.0","prebuildify": "^6.0.1","tree-kill": "^1.2.2",diff --git a/apps/desktop/src/api/sqlite-kysely.ts b/apps/desktop/src/api/sqlite-kysely.tsnew file mode 100644index 000000000..9498bd055--- /dev/null+++ b/apps/desktop/src/api/sqlite-kysely.ts@@ -0,0 +1,139 @@+/*+This file is part of the Notesnook project (https://notesnook.com/)++Copyright (C) 2023 Streetwriters (Private) Limited++This program is free software: you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation, either version 3 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++import type { Database, Statement } from "better-sqlite3-multiple-ciphers";+import type { QueryResult } from "kysely";+const rm = require("fs/promises").rm;+const sqlite3 = require("better-sqlite3-multiple-ciphers");++type SQLiteCompatibleType =+ | number+ | string+ | Uint8Array+ | Array<number>+ | bigint+ | null;++export class SQLite {+ sqlite?: Database;+ initialized = false;+ preparedStatements: Map<string, Statement<unknown[]>> = new Map();+ retryCounter: Record<string, number> = {};+ constructor() {+ console.log("new sqlite worker");+ }++ async open(filePath: string) {+ if (this.sqlite) {+ console.error("Database is already initialized");+ return;+ }++ this.sqlite = sqlite3(filePath).unsafeMode(true);+ }++ /**+ * Wrapper function for preparing SQL statements with caching+ * to avoid unnecessary computations.+ */+ async prepare(sql: string): Promise<Statement | undefined> {+ if (!this.sqlite) throw new Error("Database is not initialized.");+ try {+ const cached = this.preparedStatements.get(sql);+ if (cached !== undefined) return cached;++ const prepared = this.sqlite.prepare(sql);+ if (!prepared) return;++ this.preparedStatements.set(sql, prepared);++ // reset retry count on success+ this.retryCounter[sql] = 0;+ return prepared;+ } catch (ex) {+ console.error(ex);++ // statement prepare process can be flaky so retry at least 5 times+ // before giving up.+ if (this.retryCounter[sql] < 5) {+ this.retryCounter[sql] = (this.retryCounter[sql] || 0) + 1;+ console.warn("Failed to prepare statement. Retrying:", sql);+ return this.prepare(sql);+ } else this.retryCounter[sql] = 0;++ if (ex instanceof Error) ex.message += ` (query: ${sql})`;+ throw ex;+ }+ }++ async exec<R>(+ sql: string,+ parameters: SQLiteCompatibleType[] = []+ ): Promise<QueryResult<R>> {+ const prepared = await this.prepare(sql);+ if (!prepared) return { rows: [] };+ try {+ if (prepared.reader) {+ return {+ rows: prepared.all(parameters) as R[]+ };+ } else {+ const { changes, lastInsertRowid } = prepared.run(parameters);+ const numAffectedRows =+ changes !== undefined && changes !== null && !isNaN(changes)+ ? BigInt(changes)+ : undefined;+ return {+ numAffectedRows,+ insertId:+ lastInsertRowid !== undefined && lastInsertRowid !== null+ ? typeof lastInsertRowid === "bigint"+ ? lastInsertRowid+ : BigInt(lastInsertRowid)+ : undefined,+ rows: [] as R[]+ };+ }+ } catch (e) {+ if (e instanceof Error) e.message += ` (query: ${sql})`;+ throw e;+ }+ }++ async run<R>(+ sql: string,+ parameters?: SQLiteCompatibleType[]+ ): Promise<QueryResult<R>> {+ if (!this.sqlite) throw new Error("No database is not opened.");+ return await this.exec(sql, parameters);+ }++ async close() {+ if (!this.sqlite) return;++ this.preparedStatements.clear();+ this.sqlite.close();+ this.sqlite = undefined;+ }++ async delete(filePath: string) {+ await this.close();+ await rm(filePath, { force: true, maxRetries: 5, retryDelay: 500 });+ }+}diff --git a/apps/desktop/src/index.ts b/apps/desktop/src/index.tsindex 5b9734cd6..4b5e8a7f4 100644--- a/apps/desktop/src/index.ts+++ b/apps/desktop/src/index.ts@@ -21,3 +21,4 @@ export * from "./constants";export type { AppRouter } from "./api";export { type UpdateInfo } from "builder-util-runtime";export { type DesktopIntegration } from "./utils/config";+export { SQLite } from "./api/sqlite-kysely.js";diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.tsindex d24770a1c..5ca56e610 100644--- a/apps/desktop/src/main.ts+++ b/apps/desktop/src/main.ts@@ -100,6 +100,7 @@ async function createWindow() {zoomFactor: config.zoomFactor,nodeIntegration: true,contextIsolation: false,+ nodeIntegrationInWorker: true,spellcheck: config.isSpellCheckerEnabled,preload: __dirname + "/preload.js"}diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.tsindex 331383c47..9c3c2082b 100644--- a/apps/desktop/src/preload.ts+++ b/apps/desktop/src/preload.ts@@ -23,13 +23,11 @@ import { type RendererGlobalElectronTRPC } from "electron-trpc/src/types";import type { NNCrypto } from "@notesnook/crypto";import { ipcRenderer } from "electron";import { platform } from "os";-import sqlite3, { Database } from "better-sqlite3-multiple-ciphers";declare global {var os: () => "mas" | ReturnType<typeof platform>;var electronTRPC: RendererGlobalElectronTRPC;var NativeNNCrypto: (new () => NNCrypto) | undefined;- var createSQLite3Database: (filename: string) => Database;}process.once("loaded", async () => {@@ -43,5 +41,4 @@ process.once("loaded", async () => {});globalThis.NativeNNCrypto = require("@notesnook/crypto").NNCrypto;-globalThis.createSQLite3Database = (filename) => sqlite3(filename);globalThis.os = () => (MAC_APP_STORE ? "mas" : platform());diff --git a/apps/web/src/common/db.ts b/apps/web/src/common/db.tsindex ba697ef1a..b13cf9c58 100644--- a/apps/web/src/common/db.ts+++ b/apps/web/src/common/db.ts@@ -26,6 +26,7 @@ import { createDialect } from "./sqlite";import { isFeatureSupported } from "../utils/feature-check";import { generatePassword } from "../utils/password-generator";import { deriveKey } from "../interfaces/key-store";+import { logManager } from "@notesnook/core/dist/logger";const db = database;async function initializeDatabase(persistence: DatabasePersistence) {@@ -99,8 +100,11 @@ async function initializeDatabase(persistence: DatabasePersistence) {await db.init();- window.addEventListener("beforeunload", () => {- if (IS_DESKTOP_APP) db.sql().destroy();+ window.addEventListener("beforeunload", async () => {+ if (IS_DESKTOP_APP) {+ await db.sql().destroy();+ await logManager?.close();+ }});logger.measure("Database initialization");diff --git a/apps/web/src/common/sqlite/index.desktop.ts b/apps/web/src/common/sqlite/index.desktop.tsindex 2cee8e97a..355a68491 100644--- a/apps/web/src/common/sqlite/index.desktop.ts+++ b/apps/web/src/common/sqlite/index.desktop.ts@@ -18,25 +18,85 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.*/import {- SqliteDriver as KSqliteDriver,- SqliteDialectConfig,Dialect,SqliteAdapter,SqliteIntrospector,- SqliteQueryCompiler+ SqliteQueryCompiler,+ DatabaseConnection,+ QueryResult,+ CompiledQuery,+ Driver} from "kysely";import { desktop } from "../desktop-bridge";+import Worker from "./sqlite.worker.desktop.ts?worker";+import type { SQLiteWorker } from "./sqlite.worker.desktop";+import { wrap, Remote } from "comlink";+import { Mutex } from "async-mutex";-class SqliteDriver extends KSqliteDriver {- constructor(private readonly config: SqliteDialectConfig & { name: string }) {- super(config);+class SqliteDriver implements Driver {+ connection?: DatabaseConnection;+ private connectionMutex = new Mutex();+ worker: Remote<SQLiteWorker> = wrap<SQLiteWorker>(new Worker());+ constructor(private readonly config: { name: string }) {}++ async init(): Promise<void> {+ const path = await desktop!.integration.resolvePath.query({+ filePath: `userData/${this.config.name}.sql`+ });+ await this.worker.open(path);+ this.connection = new SqliteWorkerConnection(this.worker);+ }++ async acquireConnection(): Promise<DatabaseConnection> {+ if (!this.connection) throw new Error("Driver not initialized.");++ // SQLite only has one single connection. We use a mutex here to wait+ // until the single connection has been released.+ await this.connectionMutex.waitForUnlock();+ await this.connectionMutex.acquire();+ return this.connection;+ }++ async beginTransaction(connection: DatabaseConnection): Promise<void> {+ await connection.executeQuery(CompiledQuery.raw("begin"));+ }++ async commitTransaction(connection: DatabaseConnection): Promise<void> {+ await connection.executeQuery(CompiledQuery.raw("commit"));+ }++ async rollbackTransaction(connection: DatabaseConnection): Promise<void> {+ await connection.executeQuery(CompiledQuery.raw("rollback"));+ }++ async releaseConnection(): Promise<void> {+ this.connectionMutex.release();}++ async destroy(): Promise<void> {+ await this.worker.close();+ }+async delete() {const path = await desktop!.integration.resolvePath.query({filePath: `userData/${this.config.name}.sql`});- await desktop?.integration.deleteFile.query(path);- await this.destroy();+ await this.worker.delete(path);+ }+}++class SqliteWorkerConnection implements DatabaseConnection {+ constructor(private readonly worker: Remote<SQLiteWorker>) {}++ streamQuery<R>(): AsyncIterableIterator<QueryResult<R>> {+ throw new Error("wasqlite driver doesn't support streaming");+ }++ async executeQuery<R>(+ compiledQuery: CompiledQuery<unknown>+ ): Promise<QueryResult<R>> {+ const { parameters, sql } = compiledQuery;+ return this.worker.run(sql, parameters as any) as unknown as QueryResult<R>;}}@@ -44,13 +104,7 @@ export const createDialect = (name: string, _encrypted: boolean): Dialect => {return {createDriver: () =>new SqliteDriver({- name,- database: async () => {- const path = await desktop!.integration.resolvePath.query({- filePath: `userData/${name}.sql`- });- return window.createSQLite3Database(path).unsafeMode(true);- }+ name}),createAdapter: () => new SqliteAdapter(),createIntrospector: (db) => new SqliteIntrospector(db),diff --git a/apps/web/src/common/sqlite/sqlite.worker.desktop.ts b/apps/web/src/common/sqlite/sqlite.worker.desktop.tsnew file mode 100644index 000000000..ec9cb3f11--- /dev/null+++ b/apps/web/src/common/sqlite/sqlite.worker.desktop.ts@@ -0,0 +1,25 @@+/*+This file is part of the Notesnook project (https://notesnook.com/)++Copyright (C) 2023 Streetwriters (Private) Limited++This program is free software: you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation, either version 3 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program. If not, see <http://www.gnu.org/licenses/>.+*/++import { SQLite } from "@notesnook/desktop";+import { expose } from "comlink";++export type SQLiteWorker = typeof SQLite.prototype;+const db = new SQLite();+expose(db);