diff --git a/package-lock.json b/package-lock.json index c5882ab52..fa9d403e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "is-svg": "4.3.1", "jimp": "0.16.1", "joplin-turndown-plugin-gfm": "1.0.12", - "jsdom": "16.7.0", + "jsdom": "17.0.0", "mime-types": "2.1.32", "multer": "1.4.3", "node-abi": "2.30.0", @@ -60,7 +60,7 @@ "tmp": "^0.2.1", "turndown": "7.1.1", "unescape": "1.0.1", - "ws": "8.1.0", + "ws": "8.2.0", "yauzl": "2.10.0" }, "bin": { @@ -68,17 +68,17 @@ }, "devDependencies": { "cross-env": "7.0.3", - "electron": "13.1.9", + "electron": "13.2.1", "electron-builder": "22.11.7", "electron-packager": "15.3.0", - "electron-rebuild": "3.1.1", + "electron-rebuild": "3.2.0", "esm": "3.2.25", "jasmine": "3.8.0", "jsdoc": "3.6.7", "lorem-ipsum": "2.0.3", "rcedit": "3.0.1", - "webpack": "5.50.0", - "webpack-cli": "4.7.2" + "webpack": "5.51.1", + "webpack-cli": "4.8.0" }, "optionalDependencies": { "electron-installer-debian": "3.1.0" @@ -1139,9 +1139,9 @@ } }, "node_modules/@webpack-cli/serve": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.1.tgz", - "integrity": "sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.2.tgz", + "integrity": "sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==", "dev": true, "peerDependencies": { "webpack-cli": "4.x.x" @@ -3124,9 +3124,9 @@ } }, "node_modules/cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" }, "node_modules/cssstyle": { "version": "2.3.0", @@ -3190,16 +3190,16 @@ } }, "node_modules/data-urls": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", - "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.0.tgz", + "integrity": "sha512-4AefxbTTdFtxDUdh0BuMBs2qJVL25Mow2zlcuuePegQwgD6GEmQao42LLEeksOui8nL4RcNEugIpFP7eRd33xg==", "dependencies": { "abab": "^2.0.3", "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" + "whatwg-url": "^9.0.0" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/dayjs": { @@ -3231,9 +3231,9 @@ } }, "node_modules/decimal.js": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", + "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==" }, "node_modules/decompress-response": { "version": "3.3.0", @@ -3640,9 +3640,9 @@ } }, "node_modules/electron": { - "version": "13.1.9", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.9.tgz", - "integrity": "sha512-By4Zb72XNQLrPb70BXdIW3NtEHFwybP5DIQjohnCxOYONq5vojuHjNcTuWnBgMvwQ2qwykk6Tw5EwF2Pt0CWjA==", + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/electron/-/electron-13.2.1.tgz", + "integrity": "sha512-/K0Uw+o3+phbHtrVL6qDFVJqmeRF6EIPwVeUHEH5R8JNy13f4X3RouKjQzVyY/Os8fEqYHGFONWhD6q6g750HQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -4309,9 +4309,9 @@ } }, "node_modules/electron-rebuild": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.1.1.tgz", - "integrity": "sha512-RZwfpTKX8secCONpmQk3X0Ryf6GSEzzsqZ4RTrBoae3sMi76DI0ChG90XqdSE775Xpyts3V40VpqJHv3QUAavw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.0.tgz", + "integrity": "sha512-iCR90cKuLZaVsVGpEPp7XASkqLiuoZfpJnBVyKXZy0e6HuE8CtNSSNskkOCzEIcxQXcQAklFr0LJUj/zeFxJMw==", "dev": true, "dependencies": { "@malept/cross-spawn-promise": "^2.0.0", @@ -6489,20 +6489,20 @@ } }, "node_modules/jsdom": { - "version": "16.7.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", - "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-17.0.0.tgz", + "integrity": "sha512-MUq4XdqwtNurZDVeKScENMPHnkgmdIvMzZ1r1NSwHkDuaqI6BouPjr+17COo4/19oLNnmdpFDPOHVpgIZmZ+VA==", "dependencies": { "abab": "^2.0.5", - "acorn": "^8.2.4", + "acorn": "^8.4.1", "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", + "cssom": "^0.5.0", "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", + "data-urls": "^3.0.0", + "decimal.js": "^10.3.1", "domexception": "^2.0.1", "escodegen": "^2.0.0", - "form-data": "^3.0.0", + "form-data": "^4.0.0", "html-encoding-sniffer": "^2.0.1", "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", @@ -6517,12 +6517,12 @@ "webidl-conversions": "^6.1.0", "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.5.0", - "ws": "^7.4.6", + "whatwg-url": "^9.0.0", + "ws": "^8.0.0", "xml-name-validator": "^3.0.0" }, "engines": { - "node": ">=10" + "node": ">=12" }, "peerDependencies": { "canvas": "^2.5.0" @@ -6534,9 +6534,9 @@ } }, "node_modules/jsdom/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -6551,26 +6551,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, - "node_modules/jsdom/node_modules/ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -10178,9 +10158,9 @@ } }, "node_modules/webpack": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz", - "integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==", + "version": "5.51.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.51.1.tgz", + "integrity": "sha512-xsn3lwqEKoFvqn4JQggPSRxE4dhsRcysWTqYABAZlmavcoTmwlOb9b1N36Inbt/eIispSkuHa80/FJkDTPos1A==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.0", @@ -10225,15 +10205,15 @@ } }, "node_modules/webpack-cli": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.7.2.tgz", - "integrity": "sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.8.0.tgz", + "integrity": "sha512-+iBSWsX16uVna5aAYN6/wjhJy1q/GKk4KjKvfg90/6hykCTSgozbfz5iRgDTSJt/LgSbYxdBX3KBHeobIs+ZEw==", "dev": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^1.0.4", "@webpack-cli/info": "^1.3.0", - "@webpack-cli/serve": "^1.5.1", + "@webpack-cli/serve": "^1.5.2", "colorette": "^1.2.1", "commander": "^7.0.0", "execa": "^5.0.0", @@ -10313,16 +10293,15 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "node_modules/whatwg-url": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.5.0.tgz", - "integrity": "sha512-fy+R77xWv0AiqfLl4nuGUlQ3/6b5uNfQ4WAbGQVMYshCTCCPK9psC1nWh3XHuxGVCtlcDDQPQW1csmmIQo+fwg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-9.1.0.tgz", + "integrity": "sha512-CQ0UcrPHyomtlOCot1TL77WyMIm/bCwrJ2D6AOKGwEczU9EpyoqAokfqrf/MioU9kHcMsmJZcg1egXix2KYEsA==", "dependencies": { - "lodash": "^4.7.0", - "tr46": "^2.0.2", + "tr46": "^2.1.0", "webidl-conversions": "^6.1.0" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/which": { @@ -10549,9 +10528,9 @@ } }, "node_modules/ws": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.1.0.tgz", - "integrity": "sha512-0UWlCD2s3RSclw8FN+D0zDTUyMO+1kHwJQQJzkgUh16S8d3NYON0AKCEQPffE0ez4JyRFu76QDA9KR5bOG/7jw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.0.tgz", + "integrity": "sha512-uYhVJ/m9oXwEI04iIVmgLmugh2qrZihkywG9y5FfZV2ATeLIzHf93qs+tUNqlttbQK957/VX3mtwAS+UfIwA4g==", "engines": { "node": ">=10.0.0" }, @@ -11726,9 +11705,9 @@ } }, "@webpack-cli/serve": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.1.tgz", - "integrity": "sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.2.tgz", + "integrity": "sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==", "dev": true, "requires": {} }, @@ -13306,9 +13285,9 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" }, "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" }, "cssstyle": { "version": "2.3.0", @@ -13364,13 +13343,13 @@ } }, "data-urls": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", - "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.0.tgz", + "integrity": "sha512-4AefxbTTdFtxDUdh0BuMBs2qJVL25Mow2zlcuuePegQwgD6GEmQao42LLEeksOui8nL4RcNEugIpFP7eRd33xg==", "requires": { "abab": "^2.0.3", "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" + "whatwg-url": "^9.0.0" } }, "dayjs": { @@ -13400,9 +13379,9 @@ "optional": true }, "decimal.js": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", + "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==" }, "decompress-response": { "version": "3.3.0", @@ -13732,9 +13711,9 @@ } }, "electron": { - "version": "13.1.9", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.1.9.tgz", - "integrity": "sha512-By4Zb72XNQLrPb70BXdIW3NtEHFwybP5DIQjohnCxOYONq5vojuHjNcTuWnBgMvwQ2qwykk6Tw5EwF2Pt0CWjA==", + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/electron/-/electron-13.2.1.tgz", + "integrity": "sha512-/K0Uw+o3+phbHtrVL6qDFVJqmeRF6EIPwVeUHEH5R8JNy13f4X3RouKjQzVyY/Os8fEqYHGFONWhD6q6g750HQ==", "dev": true, "requires": { "@electron/get": "^1.0.1", @@ -14247,9 +14226,9 @@ } }, "electron-rebuild": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.1.1.tgz", - "integrity": "sha512-RZwfpTKX8secCONpmQk3X0Ryf6GSEzzsqZ4RTrBoae3sMi76DI0ChG90XqdSE775Xpyts3V40VpqJHv3QUAavw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.0.tgz", + "integrity": "sha512-iCR90cKuLZaVsVGpEPp7XASkqLiuoZfpJnBVyKXZy0e6HuE8CtNSSNskkOCzEIcxQXcQAklFr0LJUj/zeFxJMw==", "dev": true, "requires": { "@malept/cross-spawn-promise": "^2.0.0", @@ -15928,20 +15907,20 @@ } }, "jsdom": { - "version": "16.7.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", - "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-17.0.0.tgz", + "integrity": "sha512-MUq4XdqwtNurZDVeKScENMPHnkgmdIvMzZ1r1NSwHkDuaqI6BouPjr+17COo4/19oLNnmdpFDPOHVpgIZmZ+VA==", "requires": { "abab": "^2.0.5", - "acorn": "^8.2.4", + "acorn": "^8.4.1", "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", + "cssom": "^0.5.0", "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", + "data-urls": "^3.0.0", + "decimal.js": "^10.3.1", "domexception": "^2.0.1", "escodegen": "^2.0.0", - "form-data": "^3.0.0", + "form-data": "^4.0.0", "html-encoding-sniffer": "^2.0.1", "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", @@ -15956,15 +15935,15 @@ "webidl-conversions": "^6.1.0", "whatwg-encoding": "^1.0.5", "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.5.0", - "ws": "^7.4.6", + "whatwg-url": "^9.0.0", + "ws": "^8.0.0", "xml-name-validator": "^3.0.0" }, "dependencies": { "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -15975,12 +15954,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" - }, - "ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==", - "requires": {} } } }, @@ -18830,9 +18803,9 @@ "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, "webpack": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz", - "integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==", + "version": "5.51.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.51.1.tgz", + "integrity": "sha512-xsn3lwqEKoFvqn4JQggPSRxE4dhsRcysWTqYABAZlmavcoTmwlOb9b1N36Inbt/eIispSkuHa80/FJkDTPos1A==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.0", @@ -18862,15 +18835,15 @@ } }, "webpack-cli": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.7.2.tgz", - "integrity": "sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.8.0.tgz", + "integrity": "sha512-+iBSWsX16uVna5aAYN6/wjhJy1q/GKk4KjKvfg90/6hykCTSgozbfz5iRgDTSJt/LgSbYxdBX3KBHeobIs+ZEw==", "dev": true, "requires": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^1.0.4", "@webpack-cli/info": "^1.3.0", - "@webpack-cli/serve": "^1.5.1", + "@webpack-cli/serve": "^1.5.2", "colorette": "^1.2.1", "commander": "^7.0.0", "execa": "^5.0.0", @@ -18920,12 +18893,11 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.5.0.tgz", - "integrity": "sha512-fy+R77xWv0AiqfLl4nuGUlQ3/6b5uNfQ4WAbGQVMYshCTCCPK9psC1nWh3XHuxGVCtlcDDQPQW1csmmIQo+fwg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-9.1.0.tgz", + "integrity": "sha512-CQ0UcrPHyomtlOCot1TL77WyMIm/bCwrJ2D6AOKGwEczU9EpyoqAokfqrf/MioU9kHcMsmJZcg1egXix2KYEsA==", "requires": { - "lodash": "^4.7.0", - "tr46": "^2.0.2", + "tr46": "^2.1.0", "webidl-conversions": "^6.1.0" } }, @@ -19109,9 +19081,9 @@ } }, "ws": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.1.0.tgz", - "integrity": "sha512-0UWlCD2s3RSclw8FN+D0zDTUyMO+1kHwJQQJzkgUh16S8d3NYON0AKCEQPffE0ez4JyRFu76QDA9KR5bOG/7jw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.0.tgz", + "integrity": "sha512-uYhVJ/m9oXwEI04iIVmgLmugh2qrZihkywG9y5FfZV2ATeLIzHf93qs+tUNqlttbQK957/VX3mtwAS+UfIwA4g==", "requires": {} }, "xdg-basedir": { diff --git a/package.json b/package.json index 1b29e0857..a2647a00a 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "is-svg": "4.3.1", "jimp": "0.16.1", "joplin-turndown-plugin-gfm": "1.0.12", - "jsdom": "16.7.0", + "jsdom": "17.0.0", "mime-types": "2.1.32", "multer": "1.4.3", "node-abi": "2.30.0", @@ -76,22 +76,22 @@ "tmp": "^0.2.1", "turndown": "7.1.1", "unescape": "1.0.1", - "ws": "8.1.0", + "ws": "8.2.0", "yauzl": "2.10.0" }, "devDependencies": { "cross-env": "7.0.3", - "electron": "13.1.9", + "electron": "13.2.1", "electron-builder": "22.11.7", "electron-packager": "15.3.0", - "electron-rebuild": "3.1.1", + "electron-rebuild": "3.2.0", "esm": "3.2.25", "jasmine": "3.8.0", "jsdoc": "3.6.7", "lorem-ipsum": "2.0.3", "rcedit": "3.0.1", - "webpack": "5.50.0", - "webpack-cli": "4.7.2" + "webpack": "5.51.1", + "webpack-cli": "4.8.0" }, "optionalDependencies": { "electron-installer-debian": "3.1.0" diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js index e465062b3..e1e34cbfb 100644 --- a/src/public/app/entities/attribute.js +++ b/src/public/app/entities/attribute.js @@ -22,8 +22,6 @@ class Attribute { this.position = row.position; /** @param {boolean} isInheritable */ this.isInheritable = !!row.isInheritable; - /** @param {boolean} */ - this.isDeleted = !!row.isDeleted; } /** @returns {NoteShort} */ diff --git a/src/public/app/entities/branch.js b/src/public/app/entities/branch.js index 1b346c626..27802623e 100644 --- a/src/public/app/entities/branch.js +++ b/src/public/app/entities/branch.js @@ -21,8 +21,6 @@ class Branch { this.isExpanded = !!row.isExpanded; /** @param {boolean} */ this.fromSearchNote = !!row.fromSearchNote; - /** @param {boolean} */ - this.isDeleted = !!row.isDeleted; } /** @returns {NoteShort} */ diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js index 0ca35b34c..39c0c712e 100644 --- a/src/public/app/entities/note_short.js +++ b/src/public/app/entities/note_short.js @@ -61,8 +61,6 @@ class NoteShort { this.type = row.type; /** @param {string} content-type, e.g. "application/json" */ this.mime = row.mime; - /** @param {boolean} */ - this.isDeleted = !!row.isDeleted; } addParent(parentNoteId, branchId) { diff --git a/src/public/app/services/froca_updater.js b/src/public/app/services/froca_updater.js new file mode 100644 index 000000000..fa8aaa9e1 --- /dev/null +++ b/src/public/app/services/froca_updater.js @@ -0,0 +1,210 @@ +import LoadResults from "./load_results.js"; +import froca from "./froca.js"; +import options from "./options.js"; +import noteAttributeCache from "./note_attribute_cache.js"; +import Branch from "../entities/branch.js"; +import Attribute from "../entities/attribute.js"; + +async function processEntityChanges(entityChanges) { + const loadResults = new LoadResults(entityChanges); + + for (const ec of entityChanges) { + try { + if (ec.entityName === 'notes') { + processNoteChange(loadResults, ec); + } else if (ec.entityName === 'branches') { + processBranchChange(loadResults, ec); + } else if (ec.entityName === 'attributes') { + processAttributeChange(loadResults, ec); + } else if (ec.entityName === 'note_reordering') { + processNoteReordering(loadResults, ec); + } else if (ec.entityName === 'note_contents') { + delete froca.noteComplementPromises[ec.entityId]; + + loadResults.addNoteContent(ec.entityId, ec.sourceId); + } else if (ec.entityName === 'note_revisions') { + loadResults.addNoteRevision(ec.entityId, ec.noteId, ec.sourceId); + } else if (ec.entityName === 'options') { + if (ec.entity.name === 'openTabs') { + continue; // only noise + } + + options.set(ec.entity.name, ec.entity.value); + + loadResults.addOption(ec.entity.name); + } + else { + throw new Error(`Unknown entityName ${ec.entityName}`); + } + } + catch (e) { + throw new Error(`Can't process entity ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`); + } + } + + const missingNoteIds = []; + + for (const {entityName, entity} of entityChanges) { + if (!entity) { // if erased + continue; + } + + if (entityName === 'branches' && !(entity.parentNoteId in froca.notes)) { + missingNoteIds.push(entity.parentNoteId); + } + else if (entityName === 'attributes' + && entity.type === 'relation' + && entity.name === 'template' + && !(entity.value in froca.notes)) { + + missingNoteIds.push(entity.value); + } + } + + if (missingNoteIds.length > 0) { + await froca.reloadNotes(missingNoteIds); + } + + if (!loadResults.isEmpty()) { + if (loadResults.hasAttributeRelatedChanges()) { + noteAttributeCache.invalidate(); + } + + const appContext = (await import("./app_context.js")).default; + await appContext.triggerEvent('entitiesReloaded', {loadResults}); + } +} + +function processNoteChange(loadResults, ec) { + const note = froca.notes[ec.entityId]; + + if (!note) { + return; + } + + if (ec.isErased || ec.entity?.isDeleted) { + delete froca.notes[ec.entityId]; + return; + } + + note.update(ec.entity); + loadResults.addNote(ec.entityId, ec.sourceId); +} + +function processBranchChange(loadResults, ec) { + let branch = froca.branches[ec.entityId]; + + if (ec.isErased || ec.entity?.isDeleted) { + if (branch) { + const childNote = froca.notes[branch.noteId]; + const parentNote = froca.notes[branch.parentNoteId]; + + if (childNote) { + childNote.parents = childNote.parents.filter(parentNoteId => parentNoteId !== branch.parentNoteId); + delete childNote.parentToBranch[branch.parentNoteId]; + } + + if (parentNote) { + parentNote.children = parentNote.children.filter(childNoteId => childNoteId !== branch.noteId); + delete parentNote.childToBranch[branch.noteId]; + } + + delete froca.branches[ec.entityId]; + } + + return; + } + + const childNote = froca.notes[ec.entity.noteId]; + const parentNote = froca.notes[ec.entity.parentNoteId]; + + if (branch) { + branch.update(ec.entity); + } + else if (childNote || parentNote) { + froca.branches[branch.branchId] = branch = new Branch(froca, ec.entity); + } + + loadResults.addBranch(ec.entityId, ec.sourceId); + + if (childNote) { + childNote.addParent(branch.parentNoteId, branch.branchId); + } + + if (parentNote) { + parentNote.addChild(branch.noteId, branch.branchId); + } +} + +function processNoteReordering(loadResults, ec) { + const parentNoteIdsToSort = new Set(); + + for (const branchId in ec.positions) { + const branch = froca.branches[branchId]; + + if (branch) { + branch.notePosition = ec.positions[branchId]; + + parentNoteIdsToSort.add(branch.parentNoteId); + } + } + + for (const parentNoteId of parentNoteIdsToSort) { + const parentNote = froca.notes[parentNoteId]; + + if (parentNote) { + parentNote.sortChildren(); + } + } + + loadResults.addNoteReordering(ec.entityId, ec.sourceId); +} + +function processAttributeChange(loadResults, ec) { + let attribute = froca.attributes[ec.entityId]; + + if (ec.isErased || ec.entity?.isDeleted) { + if (attribute) { + const sourceNote = froca.notes[attribute.noteId]; + const targetNote = attribute.type === 'relation' && froca.notes[attribute.value]; + + if (sourceNote) { + sourceNote.attributes = sourceNote.attributes.filter(attributeId => attributeId !== attribute.attributeId); + } + + if (targetNote) { + targetNote.targetRelations = targetNote.targetRelations.filter(attributeId => attributeId !== attribute.attributeId); + } + + delete froca.attributes[ec.entityId]; + } + + return; + } + + const sourceNote = froca.notes[ec.entity.noteId]; + const targetNote = ec.entity.type === 'relation' && froca.notes[ec.entity.value]; + + if (attribute) { + attribute.update(ec.entity); + loadResults.addAttribute(ec.entityId, ec.sourceId); + } else if (sourceNote || targetNote) { + attribute = new Attribute(froca, ec.entity); + + froca.attributes[attribute.attributeId] = attribute; + + loadResults.addAttribute(ec.entityId, ec.sourceId); + + if (sourceNote && !sourceNote.attributes.includes(attribute.attributeId)) { + sourceNote.attributes.push(attribute.attributeId); + } + + if (targetNote && !targetNote.targetRelations.includes(attribute.attributeId)) { + targetNote.targetRelations.push(attribute.attributeId); + } + } +} + +export default { + processEntityChanges +} diff --git a/src/public/app/services/load_results.js b/src/public/app/services/load_results.js index dba022294..ad613ec4c 100644 --- a/src/public/app/services/load_results.js +++ b/src/public/app/services/load_results.js @@ -1,6 +1,13 @@ export default class LoadResults { - constructor(froca) { - this.froca = froca; + constructor(entityChanges) { + this.entities = {}; + + for (const {entityId, entityName, entity} of entityChanges) { + if (entity) { + this.entities[entityName] = this.entities[entityName] || []; + this.entities[entityName][entityId] = entity; + } + } this.noteIdToSourceId = {}; this.sourceIdToNoteIds = {}; @@ -18,6 +25,10 @@ export default class LoadResults { this.options = []; } + getEntity(entityName, entityId) { + return this.entities[entityName]?.[entityId]; + } + addNote(noteId, sourceId) { this.noteIdToSourceId[noteId] = this.noteIdToSourceId[noteId] || []; @@ -38,7 +49,7 @@ export default class LoadResults { getBranches() { return this.branches - .map(row => this.froca.branches[row.branchId]) + .map(row => this.getEntity("branches", row.branchId)) .filter(branch => !!branch); } @@ -58,7 +69,7 @@ export default class LoadResults { getAttributes(sourceId = 'none') { return this.attributes .filter(row => row.sourceId !== sourceId) - .map(row => this.froca.attributes[row.attributeId]) + .map(row => this.getEntity("attributes", row.attributeId)) .filter(attr => !!attr); } diff --git a/src/public/app/services/ws.js b/src/public/app/services/ws.js index 0b652e6ab..692e92ffb 100644 --- a/src/public/app/services/ws.js +++ b/src/public/app/services/ws.js @@ -1,12 +1,8 @@ import utils from './utils.js'; import toastService from "./toast.js"; import server from "./server.js"; -import LoadResults from "./load_results.js"; -import Branch from "../entities/branch.js"; -import Attribute from "../entities/attribute.js"; import options from "./options.js"; -import froca from "./froca.js"; -import noteAttributeCache from "./note_attribute_cache.js"; +import frocaUpdater from "./froca_updater.js"; const messageHandlers = []; @@ -145,7 +141,7 @@ async function consumeFrontendUpdateData() { const nonProcessedEntityChanges = allEntityChanges.filter(ec => !processedEntityChangeIds.has(ec.id)); try { - await utils.timeLimit(processEntityChanges(nonProcessedEntityChanges), 30000); + await utils.timeLimit(frocaUpdater.processEntityChanges(nonProcessedEntityChanges), 30000); } catch (e) { logError(`Encountered error ${e.message}: ${e.stack}, reloading frontend.`); @@ -212,229 +208,6 @@ setTimeout(() => { setInterval(sendPing, 1000); }, 0); -async function processEntityChanges(entityChanges) { - const loadResults = new LoadResults(froca); - - for (const ec of entityChanges.filter(ec => ec.entityName === 'notes')) { - try { - processNoteChange(loadResults, ec); - } - catch (e) { - throw new Error(`Can't process note ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`); - } - } - - for (const ec of entityChanges.filter(ec => ec.entityName === 'branches')) { - try { - processBranchChange(loadResults, ec); - } - catch (e) { - throw new Error(`Can't process branch ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`); - } - } - - for (const ec of entityChanges.filter(ec => ec.entityName === 'note_reordering')) { - try { - processNoteReordering(loadResults, ec); - } - catch (e) { - throw new Error(`Can't process note reordering ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`); - } - } - - // missing reloading the relation target note - for (const ec of entityChanges.filter(ec => ec.entityName === 'attributes')) { - try { - processAttributeChange(loadResults, ec); - } - catch (e) { - throw new Error(`Can't process attribute ${JSON.stringify(ec)} with error ${e.message} ${e.stack}`); - } - } - - for (const ec of entityChanges.filter(ec => ec.entityName === 'note_contents')) { - delete froca.noteComplementPromises[ec.entityId]; - - loadResults.addNoteContent(ec.entityId, ec.sourceId); - } - - for (const ec of entityChanges.filter(ec => ec.entityName === 'note_revisions')) { - loadResults.addNoteRevision(ec.entityId, ec.noteId, ec.sourceId); - } - - for (const ec of entityChanges.filter(ec => ec.entityName === 'options')) { - if (ec.entity.name === 'openTabs') { - continue; // only noise - } - - options.set(ec.entity.name, ec.entity.value); - - loadResults.addOption(ec.entity.name); - } - - const missingNoteIds = []; - - for (const {entityName, entity} of entityChanges) { - if (!entity) { // if erased - continue; - } - - if (entityName === 'branches' && !(entity.parentNoteId in froca.notes)) { - missingNoteIds.push(entity.parentNoteId); - } - else if (entityName === 'attributes' - && entity.type === 'relation' - && entity.name === 'template' - && !(entity.value in froca.notes)) { - - missingNoteIds.push(entity.value); - } - } - - if (missingNoteIds.length > 0) { - await froca.reloadNotes(missingNoteIds); - } - - if (!loadResults.isEmpty()) { - if (loadResults.hasAttributeRelatedChanges()) { - noteAttributeCache.invalidate(); - } - - const appContext = (await import("./app_context.js")).default; - await appContext.triggerEvent('entitiesReloaded', {loadResults}); - } -} - -function processNoteChange(loadResults, ec) { - const note = froca.notes[ec.entityId]; - - if (!note) { - return; - } - - if (ec.isErased || (ec.entity && ec.isDeleted)) { - delete froca.notes[ec.entityId]; - return; - } - - note.update(ec.entity); - loadResults.addNote(ec.entityId, ec.sourceId); -} - -function processBranchChange(loadResults, ec) { - let branch = froca.branches[ec.entityId]; - - if (ec.isErased || ec.entity?.isDeleted) { - if (branch) { - const childNote = froca.notes[branch.noteId]; - const parentNote = froca.notes[branch.parentNoteId]; - - if (childNote) { - childNote.parents = childNote.parents.filter(parentNoteId => parentNoteId !== branch.parentNoteId); - delete childNote.parentToBranch[branch.parentNoteId]; - } - - if (parentNote) { - parentNote.children = parentNote.children.filter(childNoteId => childNoteId !== branch.noteId); - delete parentNote.childToBranch[branch.noteId]; - } - - delete froca.branches[ec.entityId]; - } - - return; - } - - const childNote = froca.notes[ec.entity.noteId]; - const parentNote = froca.notes[ec.entity.parentNoteId]; - - if (branch) { - branch.update(ec.entity); - } - else if (childNote || parentNote) { - froca.branches[branch.branchId] = branch = new Branch(froca, ec.entity); - } - - loadResults.addBranch(ec.entityId, ec.sourceId); - - if (childNote) { - childNote.addParent(branch.parentNoteId, branch.branchId); - } - - if (parentNote) { - parentNote.addChild(branch.noteId, branch.branchId); - } -} - -function processNoteReordering(loadResults, ec) { - const parentNoteIdsToSort = new Set(); - - for (const branchId in ec.positions) { - const branch = froca.branches[branchId]; - - if (branch) { - branch.notePosition = ec.positions[branchId]; - - parentNoteIdsToSort.add(branch.parentNoteId); - } - } - - for (const parentNoteId of parentNoteIdsToSort) { - const parentNote = froca.notes[parentNoteId]; - - if (parentNote) { - parentNote.sortChildren(); - } - } - - loadResults.addNoteReordering(ec.entityId, ec.sourceId); -} - -function processAttributeChange(loadResults, ec) { - let attribute = froca.attributes[ec.entityId]; - - if (ec.isErased || ec.entity?.isDeleted) { - if (attribute) { - const sourceNote = froca.notes[attribute.noteId]; - const targetNote = attribute.type === 'relation' && froca.notes[attribute.value]; - - if (sourceNote) { - sourceNote.attributes = sourceNote.attributes.filter(attributeId => attributeId !== attribute.attributeId); - } - - if (targetNote) { - targetNote.targetRelations = targetNote.targetRelations.filter(attributeId => attributeId !== attribute.attributeId); - } - - delete froca.attributes[ec.entityId]; - } - - return; - } - - const sourceNote = froca.notes[ec.entity.noteId]; - const targetNote = ec.entity.type === 'relation' && froca.notes[ec.entity.value]; - - if (attribute) { - attribute.update(ec.entity); - loadResults.addAttribute(ec.entityId, ec.sourceId); - } else if (sourceNote || targetNote) { - attribute = new Attribute(froca, ec.entity); - - froca.attributes[attribute.attributeId] = attribute; - - loadResults.addAttribute(ec.entityId, ec.sourceId); - - if (sourceNote && !sourceNote.attributes.includes(attribute.attributeId)) { - sourceNote.attributes.push(attribute.attributeId); - } - - if (targetNote && !targetNote.targetRelations.includes(attribute.attributeId)) { - targetNote.targetRelations.push(attribute.attributeId); - } - } -} - export default { logError, subscribeToMessages,