From eee519811c664be78faa98737e0b8863ec07f4a3 Mon Sep 17 00:00:00 2001 From: Casey Primozic Date: Sun, 11 Feb 2024 22:06:57 -0800 Subject: [PATCH] Saving and loading subgraph presets working E2E! * Build out all the backend stuff (migrations, models, routes) for saving and loading subgraph presets with tags, matching existing preset systems * Wire up graph editor UI actions to save and load presets * Using existing generic preset saver/picker components * Add global toaster to the app * Fixed a couple of bugs with the previously subgraph/subgraph portal implementation * Build out code for saving + loading serialized subgraphs * Handle storing the state of all VCs, FCs, and child subgraphs for the subgraph being saved * Handle updating all the entity IDs to random IDs to avoid conflicts * Handle creating all of the entities into the new context * Handle wiring up subgraph portals with accurate inputs/outputs * Handle connecting everything up * Handle updating special-case FC states (subgraph portal, graph editor) to correct IDs as well * Everything I've tested so far is working as expected --- backend/Cargo.lock | 1241 +++++++++-------- backend/Cargo.toml | 10 +- .../down.sql | 3 + .../2024-02-11-211258_subgraph-presets/up.sql | 15 + backend/src/db_util/login.rs | 3 +- backend/src/db_util/mod.rs | 3 +- backend/src/main.rs | 4 + backend/src/models/looper_preset.rs | 20 - backend/src/models/mod.rs | 21 + backend/src/models/subgraph_presets.rs | 32 + backend/src/routes/looper_preset.rs | 16 +- backend/src/routes/mod.rs | 7 +- backend/src/routes/subgraph_preset.rs | 193 +++ backend/src/schema.rs | 26 + engine/Cargo.lock | 30 +- engine/engine/src/js.rs | 3 +- engine/engine/src/lib.rs | 18 +- engine/engine/src/view_context/manager.rs | 463 +++++- engine/engine/src/view_context/mod.rs | 4 + .../src/views/composition_sharing/mod.rs | 4 +- engine/engine/src/views/control_panel/mod.rs | 4 +- engine/engine/src/views/faust_editor/mod.rs | 4 +- engine/engine/src/views/filter_designer.rs | 4 +- engine/engine/src/views/granulator/mod.rs | 4 +- engine/engine/src/views/graph_editor/mod.rs | 4 +- engine/engine/src/views/looper/mod.rs | 4 +- engine/engine/src/views/midi_editor/mod.rs | 4 +- engine/engine/src/views/midi_keyboard/mod.rs | 4 +- engine/engine/src/views/sample_library/mod.rs | 4 +- engine/engine/src/views/sampler/mod.rs | 4 +- engine/engine/src/views/sequencer/mod.rs | 4 +- .../engine/src/views/signal_analyzer/mod.rs | 4 +- engine/engine/src/views/sinsy/mod.rs | 4 +- engine/engine/src/views/synth_designer/mod.rs | 4 +- engine/engine/src/views/welcome_page/mod.rs | 4 +- engine/noise_gen/Cargo.toml | 1 - index.d.ts | 7 +- package.json | 1 + src/api.ts | 53 +- src/compositionSharing/CompositionSharing.tsx | 18 +- src/graphEditor/GraphEditor.tsx | 135 +- .../Subgraph/SubgraphPortalNode.ts | 3 +- src/index.tsx | 8 +- src/looper/LooperUI/LooperUI.tsx | 8 +- src/misc/GlobalToaster.svelte | 27 + src/misc/GlobalToaster.ts | 26 + src/redux/modules/viewContextManager.ts | 21 + src/vcInterop.ts | 12 +- webpack.base.js | 6 + yarn.lock | 12 + 50 files changed, 1715 insertions(+), 799 deletions(-) create mode 100644 backend/migrations/2024-02-11-211258_subgraph-presets/down.sql create mode 100644 backend/migrations/2024-02-11-211258_subgraph-presets/up.sql create mode 100644 backend/src/models/subgraph_presets.rs create mode 100644 backend/src/routes/subgraph_preset.rs create mode 100644 src/misc/GlobalToaster.svelte create mode 100644 src/misc/GlobalToaster.ts diff --git a/backend/Cargo.lock b/backend/Cargo.lock index c94ba92f..3a09874c 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -10,15 +19,24 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", "version_check", ] +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -34,6 +52,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -43,20 +67,6 @@ dependencies = [ "libc", ] -[[package]] -name = "async-compression" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" -dependencies = [ - "brotli", - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - [[package]] name = "async-compression" version = "0.4.6" @@ -73,43 +83,50 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "async-trait" -version = "0.1.60" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "atomic" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + +[[package]] +name = "atomic" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" dependencies = [ - "autocfg", + "bytemuck", ] [[package]] @@ -145,20 +162,35 @@ dependencies = [ "rust-ini", "serde", "thiserror", - "time 0.3.17", + "time", "url", ] [[package]] name = "aws-region" -version = "0.25.1" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92a8af5850d0ea0916ca3e015ab86951ded0bf4b70fd27896e81ae1dfb0af37" +checksum = "42fed2b9fca70f2908268d057a607f2a906f47edbf856ea8587de9038d264e22" dependencies = [ "serde", "thiserror", ] +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.1" @@ -173,9 +205,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "binascii" @@ -191,24 +223,24 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "brotli" -version = "3.3.4" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -217,9 +249,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.2" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -227,27 +259,36 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytemuck" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -257,39 +298,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.52.0", ] [[package]] name = "cipher" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "cookie" version = "0.18.0" @@ -297,15 +327,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "percent-encoding", - "time 0.3.17", + "time", "version_check", ] [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -313,15 +343,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -346,47 +376,13 @@ dependencies = [ ] [[package]] -name = "cxx" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 1.0.107", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.85" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.107", + "powerfmt", + "serde", ] [[package]] @@ -415,11 +411,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "proc-macro2", - "proc-macro2-diagnostics 0.10.1", + "proc-macro2-diagnostics", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -428,7 +424,7 @@ version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "chrono", "diesel_derives", @@ -447,7 +443,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -456,7 +452,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.48", + "syn", ] [[package]] @@ -504,15 +500,15 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "either" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -524,21 +520,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "fastrand" -version = "1.8.0" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "instant", + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "figment" -version = "0.10.8" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e56602b469b2201400dec66a66aec5a9b8761ee97cd1b8c96ab2483fcc16cc9" +checksum = "2b6e5bc7bd59d60d0d45a6ccab6cf0f4ce28698fb4e81e750ddf229c9b824026" dependencies = [ - "atomic", + "atomic 0.6.0", "pear", "serde", "toml", @@ -548,9 +551,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -579,18 +582,18 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -603,9 +606,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -613,15 +616,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -630,38 +633,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -675,11 +678,20 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generator" -version = "0.7.2" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266041a359dfa931b370ef684cceb84b166beb14f7f0421f4a6a3d0c446d12e" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" dependencies = [ "cc", "libc", @@ -690,9 +702,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -700,20 +712,26 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" @@ -749,15 +767,6 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.5" @@ -781,15 +790,15 @@ dependencies = [ [[package]] name = "hound" -version = "3.5.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d13cdbd5dbb29f9c88095bbdc2590c9cba0d0a1269b983fef6b2cdd7e9f4db1" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" [[package]] name = "http" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -798,9 +807,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -815,15 +824,15 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -858,33 +867,32 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "idna" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -892,9 +900,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -916,20 +924,11 @@ dependencies = [ "generic-array", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "ipnet" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -937,7 +936,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.5", + "hermit-abi", "libc", "windows-sys 0.52.0", ] @@ -953,15 +952,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -974,24 +973,32 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "link-cplusplus" -version = "1.0.8" +name = "libredox" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "cc", + "bitflags 2.4.2", + "libc", + "redox_syscall", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -999,12 +1006,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "loom" @@ -1027,18 +1031,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "maybe-async" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6007f9dad048e0a224f27ca599d669fca8cfa0dac804725aab542b2eb032bce6" +checksum = "afc95a651c82daf7004c824405aa1019723644950d488571bd718e3ed84646ed" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] @@ -1049,51 +1053,50 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minidom" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dddfe21863f8d600ed2bd1096cb9b5cd6ff984be6185cf9d563fb4a107bffc5" +checksum = "f45614075738ce1b77a1768912a60c0227525971b03e09122a05b8a34a2a6278" dependencies = [ "rxml", ] [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.5" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "wasi", + "windows-sys 0.48.0", ] [[package]] name = "multer" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" +checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" dependencies = [ "bytes", "encoding_rs", @@ -1148,47 +1151,52 @@ dependencies = [ ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.60" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -1199,13 +1207,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] @@ -1216,9 +1224,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.96" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -1254,15 +1262,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-targets 0.48.5", ] [[package]] @@ -1288,38 +1296,38 @@ dependencies = [ [[package]] name = "pear" -version = "0.2.3" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e44241c5e4c868e3eaa78b7c1848cadd6344ed4f54d029832d32b415a58702" +checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" dependencies = [ "inlinable_string", "pear_codegen", - "yansi 0.5.1", + "yansi", ] [[package]] name = "pear_codegen" -version = "0.2.3" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a5ca643c2303ecb740d506539deba189e16f2754040a42901cd8105d0282d0" +checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" dependencies = [ "proc-macro2", - "proc-macro2-diagnostics 0.9.1", + "proc-macro2-diagnostics", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1329,9 +1337,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" + +[[package]] +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -1348,19 +1362,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.107", - "version_check", - "yansi 0.5.1", -] - [[package]] name = "proc-macro2-diagnostics" version = "0.10.1" @@ -1369,9 +1370,9 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", "version_check", - "yansi 1.0.0-rc.1", + "yansi", ] [[package]] @@ -1436,51 +1437,54 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall", + "libredox", "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.14" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" +checksum = "c4846d4c50d1721b1a3bef8af76924eef20d5e723647333798c1b519b3a9473f" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.14" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" +checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "regex" -version = "1.7.0" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ - "regex-syntax", + "aho-corasick", + "memchr", + "regex-automata 0.4.5", + "regex-syntax 0.8.2", ] [[package]] @@ -1489,32 +1493,40 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", ] [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex-syntax" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.13" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "async-compression 0.3.15", - "base64 0.13.1", + "async-compression", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -1532,9 +1544,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-util", @@ -1542,6 +1557,7 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", "winreg", ] @@ -1554,7 +1570,7 @@ checksum = "9e7bb57ccb26670d73b6a47396c83139447b9e7878cab627fdfe9ea8da489150" dependencies = [ "async-stream", "async-trait", - "atomic", + "atomic 0.5.3", "binascii", "bytes", "either", @@ -1575,13 +1591,13 @@ dependencies = [ "serde_json", "state", "tempfile", - "time 0.3.17", + "time", "tokio", "tokio-stream", "tokio-util", "ubyte", "version_check", - "yansi 1.0.0-rc.1", + "yansi", ] [[package]] @@ -1590,7 +1606,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50253076f89fd47fa68b1d571f811f188ef90b606d82fa952326c34cd955669e" dependencies = [ - "async-compression 0.4.6", + "async-compression", "futures", "lazy_static", "log", @@ -1609,7 +1625,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.48", + "syn", "unicode-xid", "version_check", ] @@ -1636,7 +1652,7 @@ dependencies = [ "smallvec", "stable-pattern", "state", - "time 0.3.17", + "time", "tokio", "uncased", ] @@ -1703,42 +1719,68 @@ dependencies = [ "serde_derive", "sha2", "thiserror", - "time 0.3.17", + "time", "tokio", "tokio-stream", "url", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +dependencies = [ + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustversion" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rxml" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a071866b8c681dc2cfffa77184adc32b57b0caad4e620b6292609703bceb804" +checksum = "a98f186c7a2f3abbffb802984b7f1dfd65dac8be1aafdaabbca4137f53f0dff7" dependencies = [ "bytes", - "pin-project-lite", "rxml_validation", "smartstring", - "tokio", ] [[package]] name = "rxml_validation" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53bc79743f9a66c2fb1f951cd83735f275d46bfe466259fbc5897bb60a0d00ee" +checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "salsa20" @@ -1751,19 +1793,18 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.52.0", ] [[package]] name = "scheduled-thread-pool" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf" +checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ "parking_lot", ] @@ -1776,15 +1817,9 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scrypt" @@ -1800,9 +1835,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1813,9 +1848,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -1823,35 +1858,44 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1866,9 +1910,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1877,54 +1921,56 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smartstring" -version = "0.2.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e714dff2b33f2321fdcd475b71cec79781a692d846f37f415fb395a1d2bcd48e" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" dependencies = [ + "autocfg", "static_assertions", + "version_check", ] [[package]] name = "socket2" -version = "0.4.7" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1959,15 +2005,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "1.0.107" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1975,86 +2021,84 @@ dependencies = [ ] [[package]] -name = "syn" -version = "2.0.48" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", ] [[package]] -name = "tempfile" -version = "3.3.0" +name = "system-configuration-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ - "cfg-if", - "fastrand", + "core-foundation-sys", "libc", - "redox_syscall", - "remove_dir_all", - "winapi", ] [[package]] -name = "termcolor" -version = "1.1.3" +name = "tempfile" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.17" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ + "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2062,16 +2106,17 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2086,45 +2131,44 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.24.2" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -2132,9 +2176,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", @@ -2143,9 +2187,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2157,11 +2201,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -2172,11 +2241,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2184,20 +2252,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2205,20 +2273,20 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -2234,30 +2302,30 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ubyte" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c81f0dae7d286ad0d9366d7679a77934cfc3cf3a8d67e82669794412b2368fe6" +checksum = "f720def6ce1ee2fc44d40ac9ed6d3a59c361c80a75a7aa8e75bb9baed31cf2ea" dependencies = [ "serde", ] [[package]] name = "uncased" -version = "0.9.7" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" dependencies = [ "serde", "version_check", @@ -2265,15 +2333,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2284,12 +2352,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -2298,9 +2360,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -2309,9 +2371,18 @@ dependencies = [ [[package]] name = "urlencoding" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "serde", +] [[package]] name = "valuable" @@ -2333,20 +2404,13 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2355,9 +2419,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2365,24 +2429,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.107", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -2392,9 +2456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2402,22 +2466,35 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" + +[[package]] +name = "wasm-streams" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] [[package]] name = "web-synth-backend" @@ -2428,6 +2505,7 @@ dependencies = [ "chrono", "diesel", "dotenv", + "fxhash", "hex", "hound", "itertools", @@ -2445,13 +2523,14 @@ dependencies = [ "sha2", "tokio", "urlencoding", + "uuid", ] [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -2473,15 +2552,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2490,43 +2560,29 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.39.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows_aarch64_msvc 0.39.0", - "windows_i686_gnu 0.39.0", - "windows_i686_msvc 0.39.0", - "windows_x86_64_gnu 0.39.0", - "windows_x86_64_msvc 0.39.0", + "windows-targets 0.48.5", ] [[package]] -name = "windows-sys" -version = "0.36.1" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-targets 0.52.0", ] [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows_aarch64_gnullvm 0.42.0", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm 0.42.0", - "windows_x86_64_msvc 0.42.0", + "windows-targets 0.48.5", ] [[package]] @@ -2535,7 +2591,22 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2555,9 +2626,9 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" @@ -2567,21 +2638,9 @@ checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.39.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" @@ -2591,21 +2650,9 @@ checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" @@ -2615,21 +2662,9 @@ checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" @@ -2639,21 +2674,9 @@ checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" @@ -2663,9 +2686,9 @@ checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" @@ -2675,21 +2698,9 @@ checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" @@ -2698,19 +2709,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] -name = "winreg" -version = "0.10.1" +name = "winnow" +version = "0.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" dependencies = [ - "winapi", + "memchr", ] [[package]] -name = "yansi" -version = "0.5.1" +name = "winreg" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] [[package]] name = "yansi" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 2708a964..b8999b2d 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" authors = ["Casey Primozic "] edition = "2021" +# enable debug info in release mode +[profile.release] +debug = true + [dependencies] dotenv = "0.15.0" @@ -11,6 +15,8 @@ diesel = { version = "2.0", features = ["mysql", "chrono"] } hex = "0.4" +fxhash = "0.2" + itertools = "0.12" lazy_static = "1.4.0" @@ -31,10 +37,12 @@ serde_derive = "1.0" sha2 = "0.10" +uuid = { version = "1.0", features = ["serde"] } + tokio = { version = "1.24", features = ["macros", "rt-multi-thread"] } scrypt = "0.11.0" -base64 = "0.21.0" +base64 = "0.21" rust-s3 = { version = "0.33", features = [] } aws-region = { version = "0.25.0", features = ["serde"] } diff --git a/backend/migrations/2024-02-11-211258_subgraph-presets/down.sql b/backend/migrations/2024-02-11-211258_subgraph-presets/down.sql new file mode 100644 index 00000000..ba06d74e --- /dev/null +++ b/backend/migrations/2024-02-11-211258_subgraph-presets/down.sql @@ -0,0 +1,3 @@ +DROP TABLE subgraph_preset_tags_join; +DROP TABLE subgraph_preset_tags; +DROP TABLE subgraph_presets; diff --git a/backend/migrations/2024-02-11-211258_subgraph-presets/up.sql b/backend/migrations/2024-02-11-211258_subgraph-presets/up.sql new file mode 100644 index 00000000..144b7218 --- /dev/null +++ b/backend/migrations/2024-02-11-211258_subgraph-presets/up.sql @@ -0,0 +1,15 @@ +CREATE TABLE subgraph_presets ( + id BIGINT NOT NULL AUTO_INCREMENT UNIQUE, + user_id BIGINT REFERENCES users(id) ON DELETE CASCADE, + title TEXT NOT NULL, + description TEXT NOT NULL, + content LONGTEXT NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE subgraph_preset_tags ( + id BIGINT NOT NULL AUTO_INCREMENT UNIQUE, + subgraph_preset_id BIGINT NOT NULL REFERENCES subgraph_presets(id) ON DELETE CASCADE, + tag_id BIGINT NOT NULL REFERENCES tags(id) ON DELETE CASCADE, + PRIMARY KEY (id) +); diff --git a/backend/src/db_util/login.rs b/backend/src/db_util/login.rs index 3e7008b0..13fe3a74 100644 --- a/backend/src/db_util/login.rs +++ b/backend/src/db_util/login.rs @@ -1,5 +1,6 @@ use std::convert::TryFrom; +use base64::Engine; use diesel::{prelude::*, QueryResult}; use scrypt::{ password_hash::{ @@ -38,7 +39,7 @@ pub fn generate_login_token() -> String { let mut rng = OsRng; let mut bytes = [0u8; 64]; rng.fill_bytes(&mut bytes); - base64::encode(&bytes) + base64::engine::general_purpose::STANDARD.encode(&bytes) } pub async fn get_user_by_username( diff --git a/backend/src/db_util/mod.rs b/backend/src/db_util/mod.rs index aee4222c..cd53959f 100644 --- a/backend/src/db_util/mod.rs +++ b/backend/src/db_util/mod.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use diesel::{prelude::*, QueryResult}; +use fxhash::FxHashMap; use itertools::Itertools; use rocket::serde::json::Json; @@ -70,7 +71,7 @@ pub async fn build_tags_with_counts( String::from("DB error loading preset tags from DB") })?; - let mut counts_by_tag: HashMap = HashMap::new(); + let mut counts_by_tag: FxHashMap = FxHashMap::default(); for looper_preset_tag in all_looper_preset_tags { let tag = looper_preset_tag.tag.clone(); let count = counts_by_tag.entry(tag).or_insert(0); diff --git a/backend/src/main.rs b/backend/src/main.rs index e190a646..d299f5b4 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -92,6 +92,10 @@ async fn main() { routes::get_wavetable_preset_by_id, routes::create_wavetable_preset, routes::get_wavetable_preset_tags, + routes::get_subgraph_presets, + routes::get_subgraph_preset_by_id, + routes::create_subgraph_preset, + routes::get_subgraph_preset_tags, ]) .attach(CorsFairing); diff --git a/backend/src/models/looper_preset.rs b/backend/src/models/looper_preset.rs index 0cde4b8c..91667e79 100644 --- a/backend/src/models/looper_preset.rs +++ b/backend/src/models/looper_preset.rs @@ -29,17 +29,6 @@ pub struct SerializedLooperInstState { pub active_module_ix: usize, } -#[derive(Serialize, Queryable)] -#[serde(rename_all = "camelCase")] -pub struct LooperPresetDescriptor { - pub id: i64, - pub name: String, - pub description: String, - pub tags: Vec, - pub user_id: Option, - pub user_name: Option, -} - #[derive(Insertable)] #[diesel(table_name = looper_presets)] pub struct NewLooperPreset { @@ -55,12 +44,3 @@ pub struct NewLooperPresetTag { pub looper_preset_id: i64, pub tag_id: i64, } - -#[derive(Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SaveLooperPresetRequest { - pub name: String, - pub description: String, - pub tags: Vec, - pub serialized_looper_inst_state: SerializedLooperInstState, -} diff --git a/backend/src/models/mod.rs b/backend/src/models/mod.rs index 129b8c16..1b973771 100644 --- a/backend/src/models/mod.rs +++ b/backend/src/models/mod.rs @@ -4,7 +4,28 @@ pub mod looper_preset; pub mod midi_composition; pub mod private_sample_libraries; pub mod remote_samples; +pub mod subgraph_presets; pub mod synth_preset; pub mod tags; pub mod user; pub mod wavetable_preset; + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SaveGenericPresetRequest { + pub name: String, + pub description: String, + pub tags: Vec, + pub preset: T, +} + +#[derive(Serialize, Queryable)] +#[serde(rename_all = "camelCase")] +pub struct GenericPresetDescriptor { + pub id: i64, + pub name: String, + pub description: String, + pub tags: Vec, + pub user_id: Option, + pub user_name: Option, +} diff --git a/backend/src/models/subgraph_presets.rs b/backend/src/models/subgraph_presets.rs new file mode 100644 index 00000000..f2a6c17d --- /dev/null +++ b/backend/src/models/subgraph_presets.rs @@ -0,0 +1,32 @@ +use uuid::Uuid; + +use crate::schema::{subgraph_preset_tags, subgraph_presets}; + +#[derive(Insertable)] +#[diesel(table_name = subgraph_presets)] +pub struct NewSubgraphPreset { + pub user_id: Option, + pub title: String, + pub description: String, + pub content: String, +} + +#[derive(Insertable)] +#[diesel(table_name = subgraph_preset_tags)] +pub struct NewSubgraphPresetTag { + pub subgraph_preset_id: i64, + pub tag_id: i64, +} + +#[derive(Serialize, Deserialize)] +pub struct SerializedSubgraphPreset { + pub fcs: Vec>, + pub vcs: Vec>, + pub intra_conns: Vec<( + serde_json::Map, + serde_json::Map, + )>, + pub subgraphs: Vec<(Uuid, serde_json::Map)>, + pub base_subgraph_id: Uuid, + pub connnecting_subgraph_id: Uuid, +} diff --git a/backend/src/routes/looper_preset.rs b/backend/src/routes/looper_preset.rs index cd4cb936..741417ce 100644 --- a/backend/src/routes/looper_preset.rs +++ b/backend/src/routes/looper_preset.rs @@ -8,12 +8,10 @@ use crate::{ login::get_logged_in_user_id, }, models::{ - looper_preset::{ - LooperPresetDescriptor, NewLooperPreset, NewLooperPresetTag, SaveLooperPresetRequest, - SerializedLooperInstState, - }, + looper_preset::{NewLooperPreset, NewLooperPresetTag, SerializedLooperInstState}, tags::{EntityIdTag, TagCount}, user::MaybeLoginToken, + GenericPresetDescriptor, SaveGenericPresetRequest, }, WebSynthDbConn, }; @@ -21,7 +19,7 @@ use crate::{ #[get("/looper_presets")] pub async fn get_looper_presets( conn: WebSynthDbConn, -) -> Result>, String> { +) -> Result>, String> { use crate::schema::{looper_presets, looper_presets_tags, tags, users}; let (looper_presets, preset_tags) = conn @@ -64,7 +62,7 @@ pub async fn get_looper_presets( .map(|tag| tag.tag.clone()) .collect_vec(); - LooperPresetDescriptor { + GenericPresetDescriptor { id, name, description, @@ -115,15 +113,15 @@ pub async fn get_looper_preset_by_id( #[post("/looper_preset", data = "")] pub async fn create_looper_preset( conn: WebSynthDbConn, - looper_preset: Json, + looper_preset: Json>, login_token: MaybeLoginToken, ) -> Result, String> { use crate::schema::{looper_presets, looper_presets_tags}; let user_id = get_logged_in_user_id(&conn, login_token).await; - let SaveLooperPresetRequest { - serialized_looper_inst_state, + let SaveGenericPresetRequest { + preset: serialized_looper_inst_state, name, description, tags, diff --git a/backend/src/routes/mod.rs b/backend/src/routes/mod.rs index ef41cde7..26075d13 100644 --- a/backend/src/routes/mod.rs +++ b/backend/src/routes/mod.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; - use diesel::{self, prelude::*}; +use fxhash::FxHashMap; use itertools::Itertools; use rocket::serde::json::Json; @@ -33,6 +32,8 @@ pub use self::{looper_preset::*, midi_composition::*, remote_samples::*}; pub mod login; mod wavetable_preset; pub use self::wavetable_preset::*; +mod subgraph_preset; +pub use self::subgraph_preset::*; #[get("/")] pub fn index() -> &'static str { "Application successfully started!" } @@ -289,7 +290,7 @@ pub async fn get_synth_presets( )?; // build a mapping of voice preset id to voice preset - let mut voice_presets_by_id: HashMap = HashMap::new(); + let mut voice_presets_by_id: FxHashMap = FxHashMap::default(); for (id_, title_, description_, body_, user_id_) in voice_presets_ { let body_ = serde_json::from_str(&body_).map_err(|err| -> String { error!("Error parsing voice preset entry stored in DB: {:?}", err); diff --git a/backend/src/routes/subgraph_preset.rs b/backend/src/routes/subgraph_preset.rs new file mode 100644 index 00000000..fc1e6316 --- /dev/null +++ b/backend/src/routes/subgraph_preset.rs @@ -0,0 +1,193 @@ +use diesel::prelude::*; +use itertools::Itertools; +use rocket::serde::json::Json; + +use crate::{ + db_util::{ + build_tags_with_counts, get_and_create_tag_ids, last_insert_id, + login::get_logged_in_user_id, + }, + models::{ + subgraph_presets::{NewSubgraphPreset, NewSubgraphPresetTag, SerializedSubgraphPreset}, + tags::{EntityIdTag, TagCount}, + user::MaybeLoginToken, + GenericPresetDescriptor, SaveGenericPresetRequest, + }, + WebSynthDbConn, +}; + +#[get("/subgraph_presets")] +pub async fn get_subgraph_presets( + conn: WebSynthDbConn, +) -> Result>, String> { + use crate::schema::{subgraph_preset_tags, subgraph_presets, tags, users}; + + let (subgraph_presets, preset_tags) = conn + .run(|conn| -> QueryResult<(_, _)> { + let presets = subgraph_presets::table + .left_join(users::table) + .select(( + subgraph_presets::dsl::id, + subgraph_presets::dsl::title, + subgraph_presets::dsl::description, + users::dsl::id.nullable(), + users::dsl::username.nullable(), + )) + .load::<(i64, String, String, Option, Option)>(conn)?; + + let preset_tags: Vec = subgraph_preset_tags::table + .inner_join(tags::table) + .select(( + subgraph_preset_tags::dsl::subgraph_preset_id, + tags::dsl::tag, + )) + .load(conn)?; + + Ok((presets, preset_tags)) + }) + .await + .map_err(|err| { + error!("DB error loading subgraph presets from DB: {}", err); + String::from("DB error loading subgraph presets from DB") + })?; + + let mut tags_by_preset_id = preset_tags + .into_iter() + .into_group_map_by(|tag| tag.entity_id); + + let subgraph_presets = subgraph_presets + .into_iter() + .map(|(id, name, description, user_id, user_name)| { + let tags = tags_by_preset_id + .remove(&id) + .unwrap_or_default() + .iter() + .map(|tag| tag.tag.clone()) + .collect_vec(); + + GenericPresetDescriptor { + id, + name, + description, + tags, + user_id, + user_name, + } + }) + .collect_vec(); + + Ok(Json(subgraph_presets)) +} + +#[get("/subgraph_preset/")] +pub async fn get_subgraph_preset_by_id( + conn: WebSynthDbConn, + preset_id: i64, +) -> Result>, String> { + use crate::schema::subgraph_presets; + + let serialized_preset: Option = conn + .run(move |conn| -> QueryResult> { + subgraph_presets::table + .find(preset_id) + .select(subgraph_presets::dsl::content) + .first(conn) + .optional() + }) + .await + .map_err(|err| { + error!("DB error loading subgraph preset from DB: {}", err); + String::from("DB error loading subgraph preset from DB") + })?; + + let serialized_preset = match serialized_preset { + Some(serialized_preset) => serialized_preset, + None => return Ok(None), + }; + let preset: SerializedSubgraphPreset = + serde_json::from_str(&serialized_preset).map_err(|_err| { + error!( + "Invalid subgraph preset JSON found in DB: {}", + serialized_preset + ); + String::from("Invalid subgraph preset JSON found in DB") + })?; + + Ok(Some(Json(preset))) +} + +#[post("/subgraph_preset", data = "")] +pub async fn create_subgraph_preset( + conn: WebSynthDbConn, + subgraph_preset: Json>, + login_token: MaybeLoginToken, +) -> Result, String> { + use crate::schema::{subgraph_preset_tags, subgraph_presets}; + + let user_id = get_logged_in_user_id(&conn, login_token).await; + + let SaveGenericPresetRequest { + preset, + name, + description, + tags, + } = subgraph_preset.into_inner(); + let serialized_subgraph: String = serde_json::to_string(&preset).unwrap(); + + let created_preset_id = conn + .run(move |conn| -> QueryResult { + conn.transaction(move |conn| { + diesel::insert_into(subgraph_presets::table) + .values(NewSubgraphPreset { + user_id, + title: name, + description, + content: serialized_subgraph, + }) + .execute(conn)?; + let created_preset_id = diesel::select(last_insert_id()).first(conn)?; + + // Insert tags + let tag_count = tags.len(); + let tag_ids = get_and_create_tag_ids(conn, tags)?; + assert_eq!(tag_count, tag_ids.len()); + + let new_tags: Vec = tag_ids + .into_iter() + .map(|tag_id| NewSubgraphPresetTag { + subgraph_preset_id: created_preset_id, + tag_id, + }) + .collect(); + + diesel::insert_into(subgraph_preset_tags::table) + .values(new_tags) + .execute(conn)?; + + Ok(created_preset_id) + }) + }) + .await + .map_err(|err| { + error!("DB error inserting subgraph preset into DB: {}", err); + String::from("DB error inserting subgraph preset into DB") + })?; + + Ok(Json(created_preset_id)) +} + +#[get("/subgraph_preset_tags")] +pub async fn get_subgraph_preset_tags(conn: WebSynthDbConn) -> Result>, String> { + use crate::schema::{subgraph_preset_tags, tags}; + + build_tags_with_counts(conn, move |conn| -> QueryResult> { + subgraph_preset_tags::table + .inner_join(tags::table) + .select(( + subgraph_preset_tags::dsl::subgraph_preset_id, + tags::dsl::tag, + )) + .load(conn) + }) + .await +} diff --git a/backend/src/schema.rs b/backend/src/schema.rs index b05c53a1..3b443292 100644 --- a/backend/src/schema.rs +++ b/backend/src/schema.rs @@ -21,6 +21,7 @@ diesel::table! { diesel::table! { effects (id) { id -> Bigint, + #[max_length = 255] title -> Varchar, description -> Text, code -> Text, @@ -88,12 +89,32 @@ diesel::table! { diesel::table! { remote_sample_urls (id, name) { + #[max_length = 100] id -> Varchar, + #[max_length = 668] name -> Varchar, sample_url -> Text, } } +diesel::table! { + subgraph_preset_tags (id) { + id -> Bigint, + subgraph_preset_id -> Bigint, + tag_id -> Bigint, + } +} + +diesel::table! { + subgraph_presets (id) { + id -> Bigint, + user_id -> Nullable, + title -> Text, + description -> Text, + content -> Longtext, + } +} + diesel::table! { synth_presets (id) { id -> Bigint, @@ -160,6 +181,9 @@ diesel::joinable!(midi_compositions -> users (user_id)); diesel::joinable!(midi_compositions_tags -> midi_compositions (midi_composition_id)); diesel::joinable!(midi_compositions_tags -> tags (tag_id)); diesel::joinable!(private_sample_libraries -> users (user_id)); +diesel::joinable!(subgraph_preset_tags -> subgraph_presets (subgraph_preset_id)); +diesel::joinable!(subgraph_preset_tags -> tags (tag_id)); +diesel::joinable!(subgraph_presets -> users (user_id)); diesel::joinable!(synth_presets -> users (user_id)); diesel::joinable!(voice_presets -> users (user_id)); diesel::joinable!(wavetable_presets -> users (user_id)); @@ -177,6 +201,8 @@ diesel::allow_tables_to_appear_in_same_query!( midi_compositions_tags, private_sample_libraries, remote_sample_urls, + subgraph_preset_tags, + subgraph_presets, synth_presets, tags, users, diff --git a/engine/Cargo.lock b/engine/Cargo.lock index 2bc6f25d..6053a1fc 100644 --- a/engine/Cargo.lock +++ b/engine/Cargo.lock @@ -83,7 +83,7 @@ name = "common" version = "0.1.0" dependencies = [ "rand", - "rand_pcg 0.2.1", + "rand_pcg", "uuid", ] @@ -213,7 +213,7 @@ dependencies = [ "fxhash", "log", "rand", - "rand_pcg 0.2.1", + "rand_pcg", "serde", "serde_json", "uuid", @@ -583,7 +583,6 @@ dependencies = [ "common", "dsp", "rand", - "rand_pcg 0.3.1", ] [[package]] @@ -807,9 +806,9 @@ dependencies = [ "getrandom", "libc", "rand_chacha", - "rand_core 0.5.1", + "rand_core", "rand_hc", - "rand_pcg 0.2.1", + "rand_pcg", ] [[package]] @@ -819,7 +818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core 0.5.1", + "rand_core", ] [[package]] @@ -831,19 +830,13 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core", ] [[package]] @@ -852,16 +845,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" -dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] diff --git a/engine/engine/src/js.rs b/engine/engine/src/js.rs index 1cc8c5a1..6a75cf92 100644 --- a/engine/engine/src/js.rs +++ b/engine/engine/src/js.rs @@ -13,7 +13,8 @@ extern "C" { subgraphs_by_id_json: &str, ); pub fn add_view_context(id: &str, name: &str, subgraph_id: &str); - pub fn add_foreign_connectable(fc_json: &str); + pub fn add_foreign_connectable(fc_json: &str) -> String; + pub fn set_connections(connections_json: &str); pub fn delete_foreign_connectable(id: &str); pub fn delete_view_context(id: &str); pub fn set_active_vc_id(new_id: &str); diff --git a/engine/engine/src/lib.rs b/engine/engine/src/lib.rs index 22521748..8cea5720 100644 --- a/engine/engine/src/lib.rs +++ b/engine/engine/src/lib.rs @@ -10,7 +10,7 @@ use std::{ptr, str::FromStr}; use common::uuid_v4; use js::js_random; use uuid::Uuid; -use view_context::manager::{ConnectionDescriptor, ViewContextManager}; +use view_context::manager::{ConnectionDescriptor, SerializedSubgraph, ViewContextManager}; use wasm_bindgen::prelude::*; pub mod js; @@ -116,6 +116,22 @@ pub fn rename_subgraph(subgraph_id: &str, new_name: String) { get_vcm().rename_subgraph(uuid, new_name); } +#[wasm_bindgen] +pub fn serialize_subgraph(subgraph_id: &str) -> String { + let uuid = + Uuid::from_str(subgraph_id).expect("Invalid UUID string passed to `serialize_subgraph`!"); + let serialized = get_vcm().serialize_subgraph(uuid); + serde_json::to_string(&serialized).unwrap() +} + +#[wasm_bindgen] +pub fn load_serialized_subgraph(serialized: &str) -> String { + let deserialized: SerializedSubgraph = + serde_json::from_str(serialized).expect("Failed to deserialize provided subgraph JSON"); + + get_vcm().load_serialized_subgraph(deserialized).to_string() +} + #[wasm_bindgen] pub fn undo_view_change() { get_vcm().undo_view_change(); } diff --git a/engine/engine/src/view_context/manager.rs b/engine/engine/src/view_context/manager.rs index 6719a802..e19b61ab 100644 --- a/engine/engine/src/view_context/manager.rs +++ b/engine/engine/src/view_context/manager.rs @@ -35,7 +35,7 @@ pub const VCM_STATE_KEY: &str = "vcmState"; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct MinimalViewContextDefinition { pub name: String, - pub uuid: String, + pub uuid: Uuid, pub title: Option, #[serde(default = "Uuid::nil", rename = "subgraphId")] pub subgraph_id: Uuid, @@ -110,7 +110,7 @@ pub struct ViewContextDefinition { /// Represents a connection between two `ViewContext`s. It holds the ID of the src and dst VC along /// with the name of the input and output that are connected. -#[derive(Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConnectionDescriptor { #[serde(rename = "vcId")] pub vc_id: String, @@ -123,7 +123,7 @@ pub struct ConnectionDescriptor { struct ViewContextManagerState { /// This contains the IDs of all managed VCs. The actual `ViewContextDefinition`s for each of /// them are found in separate `localStorage` entries. - pub view_context_ids: Vec, + pub view_context_ids: Vec, #[serde(rename = "active_view_ix")] pub deprecated_active_view_ix: usize, #[serde(default = "Uuid::nil")] @@ -139,6 +139,30 @@ struct ViewContextManagerState { pub active_view_history: ActiveViewHistory, } +#[derive(Debug)] +struct SubgraphConn { + pub tx: Uuid, + pub rx: Uuid, + pub portal_id: String, +} + +#[derive(Serialize, Deserialize)] +pub struct SerializedVCD { + pub def: MinimalViewContextDefinition, + pub localstorage_val: Option, +} + +#[derive(Serialize, Deserialize)] +pub struct SerializedSubgraph { + pub fcs: Vec, + pub vcs: Vec, + pub intra_conns: Vec<(ConnectionDescriptor, ConnectionDescriptor)>, + pub subgraphs: Vec<(Uuid, SubgraphDescriptor)>, + pub base_subgraph_id: Uuid, + /// ID of the subgraph which links to the subgraph being serialized + pub connnecting_subgraph_id: Uuid, +} + fn get_vc_key(uuid: Uuid) -> String { format!("vc_{}", uuid) } impl ViewContextManager { @@ -149,7 +173,7 @@ impl ViewContextManager { view_context: Box, ) -> usize { self.contexts.push(ViewContextEntry { - id: Uuid::from_str(&definition.uuid).expect("Invalid UUID in `ViewContextEntry`"), + id: definition.uuid, definition, context: view_context, touched: false, @@ -171,7 +195,7 @@ impl ViewContextManager { let created_ix = self.add_view_context_inner( MinimalViewContextDefinition { - uuid: uuid.to_string(), + uuid, name: name.clone(), title: None, subgraph_id, @@ -222,10 +246,7 @@ impl ViewContextManager { }, }; - let mut view_context = build_view( - &definition.minimal_def.name, - Uuid::from_str(&definition.minimal_def.uuid).unwrap(), - ); + let mut view_context = build_view(&definition.minimal_def.name, definition.minimal_def.uuid); view_context.init(); view_context.hide(); @@ -345,6 +366,35 @@ impl ViewContextManager { self.save_all() } + fn add_subgraph_portal( + &mut self, + tx_subgraph_id: Uuid, + rx_subgraph_id: Uuid, + inputs: Option, + outputs: Option, + ) { + let mut serialized_state = + json!({ "txSubgraphID": tx_subgraph_id, "rxSubgraphID": rx_subgraph_id }); + if let Some(inputs) = inputs { + serialized_state["registeredInputs"] = inputs; + } + if let Some(outputs) = outputs { + serialized_state["registeredOutputs"] = outputs; + } + + self.add_foreign_connectable(ForeignConnectable { + _type: "customAudio/subgraphPortal".to_owned(), + id: String::new(), + serialized_state: Some(serialized_state), + subgraph_id: tx_subgraph_id, + }); + } + + fn add_bidirectional_subgraph_portal(&mut self, tx_subgraph_id: Uuid, rx_subgraph_id: Uuid) { + self.add_subgraph_portal(tx_subgraph_id, rx_subgraph_id, None, None); + self.add_subgraph_portal(rx_subgraph_id, tx_subgraph_id, None, None); + } + /// Creates a new subgraph that contains a graph editor as its single view context pub fn add_subgraph(&mut self) -> Uuid { let new_subgraph_id = uuid_v4(); @@ -370,23 +420,8 @@ impl ViewContextManager { new_subgraph_id, ); - // Add ssubgraph portals to and from the subgraph so the user can navigate between them - self.add_foreign_connectable(ForeignConnectable { - _type: "customAudio/subgraphPortal".to_owned(), - id: String::new(), - serialized_state: Some( - json!({ "txSubgraphID": self.active_subgraph_id, "rxSubgraphID": new_subgraph_id }), - ), - subgraph_id: self.active_subgraph_id, - }); - self.add_foreign_connectable(ForeignConnectable { - _type: "customAudio/subgraphPortal".to_owned(), - id: String::new(), - serialized_state: Some( - json!({ "txSubgraphID": new_subgraph_id, "rxSubgraphID": self.active_subgraph_id }), - ), - subgraph_id: new_subgraph_id, - }); + // Add subgraph portals to and from the subgraph so the user can navigate between them + self.add_bidirectional_subgraph_portal(new_subgraph_id, self.active_subgraph_id); new_subgraph_id } @@ -435,16 +470,11 @@ impl ViewContextManager { ); } - /// Recursively deletes the specified subgraph, all VCs and foreign connectables within it, and - /// all child subgraphs as determined by subgraph portals. - pub fn delete_subgraph(&mut self, subgraph_id_to_delete: Uuid) { - struct SubgraphConn { - pub tx: Uuid, - pub rx: Uuid, - pub portal_id: String, - } - - // First, we determine the hierarchy of all subgraphs based on the subgraph portals + /// Using subgraph portals, creates an edge list of all connections between subgraphs in the VCM. + /// + /// Since all subgraph portals are bidirectional, this returns both the forward and reverse + /// connections. + fn get_all_subgraph_conns(&self) -> Vec { let mut all_subgraph_connections: Vec = Vec::new(); for fc in &self.foreign_connectables { if fc._type == "customAudio/subgraphPortal" { @@ -469,52 +499,87 @@ impl ViewContextManager { } } - // Now, we need to find all subgraphs that are children of the subgraph we're deleting + all_subgraph_connections + } + + /// Returns `(all_subgraph_connections, child_subgraphs)`, where `all_subgraph_connections` is + /// a list of all subgraph portals in the VCM, and `child_subgraphs` is a list of all subgraphs + /// that are children of the subgraph with the specified ID - including the subgraph itself. + fn get_child_subgraph_ids( + &self, + target_subgraph_id: Uuid, + ) -> (Vec, FxHashSet) { + if target_subgraph_id.is_nil() { + panic!("This function doesn't work for getting the children of the root subgraph"); + } + + // First, we determine the hierarchy of all subgraphs based on the subgraph portals + let all_subgraph_connections = self.get_all_subgraph_conns(); + + // Now, we need to find all subgraphs that are children of the target subgraph // // However, there's a complication. All subgraph portals are bidirectional. We only want to - // delete subgraphs that are children of the subgraph we're deleting, not siblings or parents. + // delete subgraphs that are children of the target subgraph, not siblings or parents. // // To achieve this, we first do a BFS starting from the root subgraph to identify all subgraphs - // that are above the subgraph we're deleting. + // that are above the target subgraph. // - // Then, we do a BFS starting from the subgraph we're deleting to identify all subgraphs that - // are below it. - let mut safe_subgraphs: FxHashSet = FxHashSet::default(); - safe_subgraphs.insert(Uuid::nil()); - let mut subgraphs_to_delete: FxHashSet = FxHashSet::default(); + // Then, we do a BFS starting from the target subgraph to identify all subgraphs that are below + // it. + let mut excluded_subgraphs: FxHashSet = FxHashSet::default(); + excluded_subgraphs.insert(Uuid::nil()); + let mut child_subgraphs: FxHashSet = FxHashSet::default(); let mut queue: Vec = vec![Uuid::nil()]; while !queue.is_empty() { let subgraph_id = queue.pop().unwrap(); - for conn in &all_subgraph_connections { - if conn.tx == subgraph_id { - if conn.rx == subgraph_id_to_delete { - continue; - } - let is_new = safe_subgraphs.insert(conn.rx); - if is_new { - queue.push(conn.rx); - } + let conns_from_subgraph = all_subgraph_connections + .iter() + .filter(|conn| conn.tx == subgraph_id); + + for conn in conns_from_subgraph { + if conn.rx == subgraph_id { + error!( + "Subgraph portal with tx=rx={:?} is a self-loop", + subgraph_id + ); + continue; + } else if conn.rx == target_subgraph_id { + continue; + } + + let is_new = excluded_subgraphs.insert(conn.rx); + if is_new { + queue.push(conn.rx); } } } - subgraphs_to_delete.insert(subgraph_id_to_delete); - queue.push(subgraph_id_to_delete); + child_subgraphs.insert(target_subgraph_id); + queue.push(target_subgraph_id); while !queue.is_empty() { let subgraph_id = queue.pop().unwrap(); for conn in &all_subgraph_connections { if conn.tx == subgraph_id { - if subgraphs_to_delete.contains(&conn.rx) || safe_subgraphs.contains(&conn.rx) { + if child_subgraphs.contains(&conn.rx) || excluded_subgraphs.contains(&conn.rx) { continue; } - subgraphs_to_delete.insert(conn.rx); + child_subgraphs.insert(conn.rx); queue.push(conn.rx); } } } + (all_subgraph_connections, child_subgraphs) + } + + /// Recursively deletes the specified subgraph, all VCs and foreign connectables within it, and + /// all child subgraphs as determined by subgraph portals. + pub fn delete_subgraph(&mut self, subgraph_id_to_delete: Uuid) { + let (all_subgraph_connections, subgraphs_to_delete) = + self.get_child_subgraph_ids(subgraph_id_to_delete); + // Find all VCs and FCs that are in the subgraphs we're deleting let vcs_to_delete: Vec = self .contexts @@ -578,6 +643,290 @@ impl ViewContextManager { self.save_all(); } + /// Assumes all frontend state has been committed to the backend already (`onBeforeUnload()`) + pub fn serialize_subgraph(&self, subgraph_id: Uuid) -> SerializedSubgraph { + let (_all_subgraph_connections, included_subgraph_ids) = + self.get_child_subgraph_ids(subgraph_id); + + let fcs = self + .foreign_connectables + .iter() + .filter(|fc| included_subgraph_ids.contains(&fc.subgraph_id)) + .cloned() + .collect::>(); + let vcs = self + .contexts + .iter() + .filter(|vc| included_subgraph_ids.contains(&vc.definition.subgraph_id)) + .map(|vc| { + let state_key = vc.context.get_state_key(); + let state = js::get_localstorage_key(&state_key); + + SerializedVCD { + def: vc.definition.clone(), + localstorage_val: state, + } + }) + .collect::>(); + // Connections that are fully within the subgraph and its children, so will be included in the + // serialized state + let intra_conns = self + .connections + .iter() + .filter(|(src, dst)| { + let get_subgraph_id = |vc_id: &str| -> Option { + self + .foreign_connectables + .iter() + .find_map(|fc| { + if fc.id == *vc_id { + Some(fc.subgraph_id) + } else { + None + } + }) + .or_else(|| { + self.contexts.iter().find_map(|vc| { + if vc.id.to_string() == *vc_id { + Some(vc.definition.subgraph_id) + } else { + None + } + }) + }) + }; + + let Some(tx_subgraph_id) = get_subgraph_id(&src.vc_id) else { + error!("Couldn't find subgraph ID for VC ID {}", src.vc_id); + return false; + }; + if !included_subgraph_ids.contains(&tx_subgraph_id) { + return false; + }; + let Some(rx_subgraph_id) = get_subgraph_id(&dst.vc_id) else { + error!("Couldn't find subgraph ID for VC ID {}", dst.vc_id); + return false; + }; + if !included_subgraph_ids.contains(&rx_subgraph_id) { + return false; + }; + + true + }) + .cloned() + .collect::>(); + let subgraphs = self + .subgraphs_by_id + .iter() + .filter(|(id, _)| included_subgraph_ids.contains(id)) + .map(|(id, desc)| (*id, desc.clone())) + .collect::>(); + + SerializedSubgraph { + fcs, + vcs, + intra_conns, + subgraphs, + base_subgraph_id: subgraph_id, + connnecting_subgraph_id: self.active_subgraph_id, + } + } + + /// Given a `SerializedSubgraph` containing the state for a subgraph any 0 or more child + /// subgraphs, creates all entities (VCs, FCs, and subgraphs) and connections in the VCM. + /// + /// Handles generating new random IDs for all entities to avoid conflicts when loading the same + /// saved subgraph multiple times. + /// + /// Creates subgraph portals between the current active subgraph and the new subgraph. + /// + /// Returns the ID of the new subgraph. + pub fn load_serialized_subgraph(&mut self, mut serialized: SerializedSubgraph) -> Uuid { + let mut new_uuid_by_old_uuid = FxHashMap::default(); + let mut new_sid_by_old_sid = FxHashMap::default(); + + for (id, desc) in &mut serialized.subgraphs { + let new_id = uuid_v4(); + new_uuid_by_old_uuid.insert(*id, new_id); + self.subgraphs_by_id.insert(new_id, desc.clone()); + desc.id = new_id; + *id = new_id; + } + serialized.base_subgraph_id = new_uuid_by_old_uuid[&serialized.base_subgraph_id]; + js::set_subgraphs( + &self.active_subgraph_id.to_string(), + &serde_json::to_string(&self.subgraphs_by_id).unwrap(), + ); + + let mut base_portal_state = None; + for fc in &mut serialized.fcs { + fc.subgraph_id = new_uuid_by_old_uuid[&fc.subgraph_id]; + + // If this is a subgraph portal linking to the connecting subgraph, we need to re-point it to + // link with the current active subgraph instead + if fc._type == "customAudio/subgraphPortal" { + // TODO: Create a struct for this + if let Some(serde_json::Value::Object(state)) = &mut fc.serialized_state { + let mapped_tx_subgraph_id = if let Some(serde_json::Value::String(tx_subgraph_id)) = + state.get_mut("txSubgraphID") + { + let mapped_id = new_uuid_by_old_uuid[&Uuid::from_str(tx_subgraph_id).unwrap()]; + *tx_subgraph_id = mapped_id.to_string(); + Some(mapped_id) + } else { + error!( + "Mising/invalid `txSubgraphID` in serialized state for subgraph portal FC {:?}", + state + ); + None + }; + if let Some(serde_json::Value::String(rx_subgraph_id)) = state.get_mut("rxSubgraphID") { + let rx_subgraph_uuid = Uuid::from_str(rx_subgraph_id).unwrap(); + if fc.subgraph_id == serialized.base_subgraph_id + && mapped_tx_subgraph_id == Some(serialized.base_subgraph_id) + && rx_subgraph_uuid == serialized.connnecting_subgraph_id + { + info!( + "Re-pointing subgraph portal rx to active subgraph. Old ID: {}, new ID: {}", + rx_subgraph_uuid, self.active_subgraph_id + ); + *rx_subgraph_id = self.active_subgraph_id.to_string(); + + if base_portal_state.is_some() { + error!("Found more than one subgraph portal linking to the connecting subgraph"); + } + base_portal_state = Some(state.clone()); + } else { + *rx_subgraph_id = new_uuid_by_old_uuid[&rx_subgraph_uuid].to_string(); + } + } else { + error!( + "Mising/invalid `rxSubgraphID` in serialized state for subgraph portal FC {:?}", + state + ); + } + } else { + error!( + "Mising/invalid serialized state for subgraph portal FC {:?}", + fc + ); + } + } + + let new_id = js::add_foreign_connectable(&serde_json::to_string(fc).unwrap()); + new_sid_by_old_sid.insert(fc.id.clone(), new_id.clone()); + fc.id = new_id; + self.foreign_connectables.push(fc.clone()); + } + + fn map_id( + new_uuid_by_old_uuid: &FxHashMap, + new_sid_by_old_sid: &FxHashMap, + old_id: &str, + ) -> String { + if let Ok(uuid) = Uuid::from_str(old_id) { + new_uuid_by_old_uuid[&uuid].to_string() + } else { + new_sid_by_old_sid[old_id].clone() + } + } + + for vc in &mut serialized.vcs { + vc.def.subgraph_id = new_uuid_by_old_uuid[&vc.def.subgraph_id]; + let new_id = uuid_v4(); + new_uuid_by_old_uuid.insert(vc.def.uuid, new_id); + vc.def.uuid = new_id; + } + + for vc in &mut serialized.vcs { + let ctx = build_view(&vc.def.name, vc.def.uuid); + if let Some(val) = &mut vc.localstorage_val { + // Another special case we have to update is graph editors. + // + // Graph editors have to hold IDs of the nodes in their state, and since we're mapping the + // state around, this causes the positions of nodes to get messed up. + if vc.def.name == "graph_editor" { + let mut state: serde_json::Map = + serde_json::from_str(val).unwrap(); + + // Keys to update: `last_node_id`, `nodes`, `selectedNodeVcId` + if let Some(serde_json::Value::String(last_node_id)) = state.get_mut("last_node_id") { + *last_node_id = map_id(&new_uuid_by_old_uuid, &new_sid_by_old_sid, last_node_id); + } + if let Some(serde_json::Value::String(selected_node_vc_id)) = + state.get_mut("selectedNodeVcId") + { + *selected_node_vc_id = map_id( + &new_uuid_by_old_uuid, + &new_sid_by_old_sid, + selected_node_vc_id, + ); + } + if let Some(serde_json::Value::Array(nodes)) = state.get_mut("nodes") { + for node in nodes { + if let Some(serde_json::Value::String(vc_id)) = node.get_mut("id") { + *vc_id = map_id(&new_uuid_by_old_uuid, &new_sid_by_old_sid, vc_id); + } + } + } + + *val = serde_json::to_string(&state).unwrap(); + } + + let new_localstorage_key = ctx.get_state_key(); + js::set_localstorage_key(&new_localstorage_key, val); + } + + self.add_view_context(vc.def.uuid, vc.def.name.clone(), ctx, vc.def.subgraph_id); + } + + for (id, mut desc) in serialized.subgraphs { + let new_id = new_uuid_by_old_uuid[&desc.active_vc_id]; + desc.active_vc_id = new_id; + self.subgraphs_by_id.insert(id, desc.clone()); + } + js::set_subgraphs( + &self.active_subgraph_id.to_string(), + &serde_json::to_string(&self.subgraphs_by_id).unwrap(), + ); + + for conn in &mut serialized.intra_conns { + let new_tx_id = map_id(&new_uuid_by_old_uuid, &new_sid_by_old_sid, &conn.0.vc_id); + let new_rx_id = map_id(&new_uuid_by_old_uuid, &new_sid_by_old_sid, &conn.1.vc_id); + + self.connections.push(( + ConnectionDescriptor { + vc_id: new_tx_id.clone(), + name: conn.0.name.clone(), + }, + ConnectionDescriptor { + vc_id: new_rx_id.clone(), + name: conn.1.name.clone(), + }, + )); + } + js::set_connections(&serde_json::to_string(&self.connections).unwrap()); + + // Finally, add a subgraph portal in the active subgraph pointing to the new subgraph with its + // inputs set to correspond to the one we re-pointed ealier + if let Some(base_portal_state) = base_portal_state { + let tx_subgraph_id = self.active_subgraph_id; + let rx_subgraph_id = serialized.base_subgraph_id; + let inputs = base_portal_state.get("registeredOutputs").cloned(); + let outputs = base_portal_state.get("registeredInputs").cloned(); + info!( + "Creating subgraph portal from active subgraph to new subgraph; tx={}, rx={}, \ + inputs={:?}, outputs={:?}", + tx_subgraph_id, rx_subgraph_id, inputs, outputs + ); + self.add_subgraph_portal(tx_subgraph_id, rx_subgraph_id, inputs, outputs); + } + + self.save_all(); + + serialized.base_subgraph_id + } + fn set_view(&mut self, subgraph_id: Uuid, vc_id: Uuid) -> Result<(), ()> { if self.subgraphs_by_id.contains_key(&subgraph_id) && self.contexts.iter().any(|vc| vc.id == vc_id) diff --git a/engine/engine/src/view_context/mod.rs b/engine/engine/src/view_context/mod.rs index a84e85c1..0147d18b 100644 --- a/engine/engine/src/view_context/mod.rs +++ b/engine/engine/src/view_context/mod.rs @@ -13,8 +13,12 @@ pub trait ViewContext { /// things like subscribing to/loading external data sources, creating DOM nodes, etc. fn init(&mut self) {} + /// Returns the VC ID as a string. This should be a UUID. fn get_id(&self) -> String; + /// Returns the `localStorage` key under which this VC's serialized state should be stored. + fn get_state_key(&self) -> String; + /// Clean up any external resources such as DOM elements that were created by the view context, /// making the application ready for the creation of a new one. This does not mean that the /// `ViewContext` is being deleted, merely that it is being "un-rendered." diff --git a/engine/engine/src/views/composition_sharing/mod.rs b/engine/engine/src/views/composition_sharing/mod.rs index b10889c9..90ee37b0 100644 --- a/engine/engine/src/views/composition_sharing/mod.rs +++ b/engine/engine/src/views/composition_sharing/mod.rs @@ -13,8 +13,6 @@ pub struct CompositionSharing { impl CompositionSharing { pub fn new(uuid: Uuid) -> Self { CompositionSharing { uuid } } - - pub fn get_state_key(&self) -> String { format!("compositionSharing_{}", self.uuid) } } impl ViewContext for CompositionSharing { @@ -22,6 +20,8 @@ impl ViewContext for CompositionSharing { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("compositionSharing_{}", self.uuid) } + fn cleanup(&mut self) { js::cleanup_composition_sharing(&self.get_state_key()); } fn hide(&mut self) { js::hide_composition_sharing(&self.get_state_key()); } diff --git a/engine/engine/src/views/control_panel/mod.rs b/engine/engine/src/views/control_panel/mod.rs index c95610fe..0afd795b 100644 --- a/engine/engine/src/views/control_panel/mod.rs +++ b/engine/engine/src/views/control_panel/mod.rs @@ -9,8 +9,6 @@ pub struct ControlPanel { impl ControlPanel { pub fn new(uuid: Uuid) -> Self { ControlPanel { uuid } } - - pub fn get_state_key(&self) -> String { format!("controlPanel_{}", self.uuid) } } impl ViewContext for ControlPanel { @@ -20,6 +18,8 @@ impl ViewContext for ControlPanel { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("controlPanel_{}", self.uuid) } + fn hide(&mut self) { js::hide_control_panel(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_control_panel(&self.get_state_key()); } diff --git a/engine/engine/src/views/faust_editor/mod.rs b/engine/engine/src/views/faust_editor/mod.rs index 7a3ae981..52f4c39b 100644 --- a/engine/engine/src/views/faust_editor/mod.rs +++ b/engine/engine/src/views/faust_editor/mod.rs @@ -14,8 +14,6 @@ pub struct FaustEditor { impl FaustEditor { pub fn new(uuid: Uuid) -> Self { FaustEditor { uuid } } - - pub fn get_state_key(&self) -> String { format!("faustEditor_{}", self.uuid) } } impl ViewContext for FaustEditor { @@ -29,6 +27,8 @@ impl ViewContext for FaustEditor { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("faustEditor_{}", self.uuid) } + fn dispose(&mut self) { js::delete_localstorage_key(&self.get_state_key()); } fn get_audio_connectables(&self) -> JsValue { js::get_faust_editor_connectables(&self.get_id()) } diff --git a/engine/engine/src/views/filter_designer.rs b/engine/engine/src/views/filter_designer.rs index 1bfdfa4a..cd010cc8 100644 --- a/engine/engine/src/views/filter_designer.rs +++ b/engine/engine/src/views/filter_designer.rs @@ -9,8 +9,6 @@ pub struct FilterDesigner { impl FilterDesigner { pub fn new(uuid: Uuid) -> Self { FilterDesigner { uuid } } - - pub fn get_state_key(&self) -> String { format!("filterDesigner_{}", self.uuid) } } impl ViewContext for FilterDesigner { @@ -27,6 +25,8 @@ impl ViewContext for FilterDesigner { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("filterDesigner_{}", self.uuid) } + fn hide(&mut self) { js::hide_filter_designer(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_filter_designer(&self.get_state_key()); } diff --git a/engine/engine/src/views/granulator/mod.rs b/engine/engine/src/views/granulator/mod.rs index d1d1ca1f..d6bb5033 100644 --- a/engine/engine/src/views/granulator/mod.rs +++ b/engine/engine/src/views/granulator/mod.rs @@ -9,8 +9,6 @@ pub struct Granulator { impl Granulator { pub fn new(uuid: Uuid) -> Self { Granulator { uuid } } - - pub fn get_state_key(&self) -> String { format!("granulator_{}", self.uuid) } } impl ViewContext for Granulator { @@ -20,6 +18,8 @@ impl ViewContext for Granulator { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("granulator_{}", self.uuid) } + fn hide(&mut self) { js::hide_granulator(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_granulator(&self.get_state_key()); } diff --git a/engine/engine/src/views/graph_editor/mod.rs b/engine/engine/src/views/graph_editor/mod.rs index 4f196a3c..d2a35887 100644 --- a/engine/engine/src/views/graph_editor/mod.rs +++ b/engine/engine/src/views/graph_editor/mod.rs @@ -13,8 +13,6 @@ pub struct GraphEditor { impl GraphEditor { pub fn new(uuid: Uuid) -> Self { GraphEditor { uuid } } - - pub fn get_state_key(&self) -> String { format!("graphEditor_{}", self.uuid) } } impl ViewContext for GraphEditor { @@ -24,6 +22,8 @@ impl ViewContext for GraphEditor { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("graphEditor_{}", self.uuid) } + fn hide(&mut self) { js::hide_graph_editor(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_graph_editor(&self.get_state_key()); } diff --git a/engine/engine/src/views/looper/mod.rs b/engine/engine/src/views/looper/mod.rs index 028310ed..7749c578 100644 --- a/engine/engine/src/views/looper/mod.rs +++ b/engine/engine/src/views/looper/mod.rs @@ -9,8 +9,6 @@ pub struct Looper { impl Looper { pub fn new(uuid: Uuid) -> Self { Looper { uuid } } - - pub fn get_state_key(&self) -> String { format!("looper_{}", self.uuid) } } impl ViewContext for Looper { @@ -27,6 +25,8 @@ impl ViewContext for Looper { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("looper_{}", self.uuid) } + fn hide(&mut self) { js::hide_looper(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_looper(&self.get_state_key()); } diff --git a/engine/engine/src/views/midi_editor/mod.rs b/engine/engine/src/views/midi_editor/mod.rs index 10194697..39a2bca8 100644 --- a/engine/engine/src/views/midi_editor/mod.rs +++ b/engine/engine/src/views/midi_editor/mod.rs @@ -10,8 +10,6 @@ pub struct MIDIEditor { impl MIDIEditor { pub fn new(vc_id: Uuid) -> Self { MIDIEditor { vc_id } } - - pub fn get_state_key(&self) -> String { format!("midiEditor_{}", self.vc_id) } } impl ViewContext for MIDIEditor { @@ -21,6 +19,8 @@ impl ViewContext for MIDIEditor { fn get_id(&self) -> String { self.vc_id.to_string() } + fn get_state_key(&self) -> String { format!("midiEditor_{}", self.vc_id) } + fn hide(&mut self) { js::hide_midi_editor(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_midi_editor(&self.get_state_key()); } diff --git a/engine/engine/src/views/midi_keyboard/mod.rs b/engine/engine/src/views/midi_keyboard/mod.rs index e8182c02..9ba2e88f 100644 --- a/engine/engine/src/views/midi_keyboard/mod.rs +++ b/engine/engine/src/views/midi_keyboard/mod.rs @@ -11,8 +11,6 @@ pub struct MIDIKeyboard { impl MIDIKeyboard { pub fn new(uuid: Uuid) -> Self { MIDIKeyboard { uuid } } - - pub fn get_state_key(&self) -> String { format!("MIDIKeyboard_{}", self.uuid) } } impl ViewContext for MIDIKeyboard { @@ -25,6 +23,8 @@ impl ViewContext for MIDIKeyboard { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("MIDIKeyboard_{}", self.uuid) } + fn hide(&mut self) { js::hide_midi_keyboard(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_midi_keyboard(&self.get_state_key()); } diff --git a/engine/engine/src/views/sample_library/mod.rs b/engine/engine/src/views/sample_library/mod.rs index 5ed008be..36197885 100644 --- a/engine/engine/src/views/sample_library/mod.rs +++ b/engine/engine/src/views/sample_library/mod.rs @@ -10,8 +10,6 @@ pub struct SampleLibrary { impl SampleLibrary { pub fn new(uuid: Uuid) -> Self { SampleLibrary { uuid } } - - pub fn get_state_key(&self) -> String { format!("SampleLibrary_{}", self.uuid) } } impl ViewContext for SampleLibrary { @@ -21,6 +19,8 @@ impl ViewContext for SampleLibrary { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("SampleLibrary_{}", self.uuid) } + fn hide(&mut self) { js::hide_sample_library(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_sample_library(&self.get_state_key()); } diff --git a/engine/engine/src/views/sampler/mod.rs b/engine/engine/src/views/sampler/mod.rs index 3b99c239..3f246a00 100644 --- a/engine/engine/src/views/sampler/mod.rs +++ b/engine/engine/src/views/sampler/mod.rs @@ -10,8 +10,6 @@ pub struct Sampler { impl Sampler { pub fn new(uuid: Uuid) -> Self { Sampler { uuid } } - - pub fn get_state_key(&self) -> String { format!("sampler_{}", self.uuid) } } impl ViewContext for Sampler { @@ -21,6 +19,8 @@ impl ViewContext for Sampler { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("sampler_{}", self.uuid) } + fn hide(&mut self) { js::hide_sampler(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_sampler(&self.get_state_key()); } diff --git a/engine/engine/src/views/sequencer/mod.rs b/engine/engine/src/views/sequencer/mod.rs index 9f7fd8ef..6cb9e75f 100644 --- a/engine/engine/src/views/sequencer/mod.rs +++ b/engine/engine/src/views/sequencer/mod.rs @@ -10,8 +10,6 @@ pub struct Sequencer { impl Sequencer { pub fn new(uuid: Uuid) -> Self { Sequencer { uuid } } - - pub fn get_state_key(&self) -> String { format!("sequencer_{}", self.uuid) } } impl ViewContext for Sequencer { @@ -21,6 +19,8 @@ impl ViewContext for Sequencer { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("sequencer_{}", self.uuid) } + fn hide(&mut self) { js::hide_sequencer(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_sequencer(&self.get_state_key()); } diff --git a/engine/engine/src/views/signal_analyzer/mod.rs b/engine/engine/src/views/signal_analyzer/mod.rs index c46a018e..b2053060 100644 --- a/engine/engine/src/views/signal_analyzer/mod.rs +++ b/engine/engine/src/views/signal_analyzer/mod.rs @@ -10,8 +10,6 @@ pub struct SignalAnalyzer { impl SignalAnalyzer { pub fn new(uuid: Uuid) -> Self { SignalAnalyzer { uuid } } - - pub fn get_state_key(&self) -> String { format!("SignalAnalyzer_{}", self.uuid) } } impl ViewContext for SignalAnalyzer { @@ -21,6 +19,8 @@ impl ViewContext for SignalAnalyzer { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("SignalAnalyzer_{}", self.uuid) } + fn hide(&mut self) { js::hide_signal_analyzer(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_signal_analyzer(&self.get_state_key()); } diff --git a/engine/engine/src/views/sinsy/mod.rs b/engine/engine/src/views/sinsy/mod.rs index 818e91e4..a9addd92 100644 --- a/engine/engine/src/views/sinsy/mod.rs +++ b/engine/engine/src/views/sinsy/mod.rs @@ -10,8 +10,6 @@ pub struct Sinsy { impl Sinsy { pub fn new(uuid: Uuid) -> Self { Sinsy { uuid } } - - pub fn get_state_key(&self) -> String { format!("Sinsy_{}", self.uuid) } } impl ViewContext for Sinsy { @@ -21,6 +19,8 @@ impl ViewContext for Sinsy { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("Sinsy_{}", self.uuid) } + fn hide(&mut self) { js::hide_sinsy(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_sinsy(&self.get_state_key()); } diff --git a/engine/engine/src/views/synth_designer/mod.rs b/engine/engine/src/views/synth_designer/mod.rs index 32622096..d1a16813 100644 --- a/engine/engine/src/views/synth_designer/mod.rs +++ b/engine/engine/src/views/synth_designer/mod.rs @@ -14,8 +14,6 @@ pub struct SynthDesigner { impl SynthDesigner { pub fn new(uuid: Uuid) -> Self { SynthDesigner { uuid } } - - pub fn get_state_key(&self) -> String { format!("synthDesigner_{}", self.uuid) } } impl ViewContext for SynthDesigner { @@ -33,6 +31,8 @@ impl ViewContext for SynthDesigner { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("synthDesigner_{}", self.uuid) } + fn hide(&mut self) { js::hide_synth_designer(&self.get_state_key()); } fn unhide(&mut self) { js::unhide_synth_designer(&self.get_state_key()); } diff --git a/engine/engine/src/views/welcome_page/mod.rs b/engine/engine/src/views/welcome_page/mod.rs index f3eb477f..7d78e490 100644 --- a/engine/engine/src/views/welcome_page/mod.rs +++ b/engine/engine/src/views/welcome_page/mod.rs @@ -11,8 +11,6 @@ pub struct WelcomePage { impl WelcomePage { pub fn new(uuid: Uuid) -> Self { WelcomePage { uuid } } - - pub fn get_state_key(&self) -> String { format!("welcomePage_{}", self.uuid) } } impl ViewContext for WelcomePage { @@ -20,6 +18,8 @@ impl ViewContext for WelcomePage { fn get_id(&self) -> String { self.uuid.to_string() } + fn get_state_key(&self) -> String { format!("welcomePage_{}", self.uuid) } + fn cleanup(&mut self) { js::cleanup_welcome_page(&self.get_state_key()); } fn hide(&mut self) { js::hide_welcome_page(&self.get_state_key()); } diff --git a/engine/noise_gen/Cargo.toml b/engine/noise_gen/Cargo.toml index 47f71c21..1e1bc5e1 100644 --- a/engine/noise_gen/Cargo.toml +++ b/engine/noise_gen/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -rand_pcg = "0.3" rand = "0.7" common = { path = "../common" } dsp = { path = "../dsp" } diff --git a/index.d.ts b/index.d.ts index cf7aac24..41e7a74e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,8 @@ import type { AudioConnectables } from 'src/patchNetwork'; +import type { Renderable, ToastOptions } from 'svelte-french-toast'; declare module 'litegraph.js' { - import { + import type { LiteGraphNode, LiteGraph as LiteGraphInstance, LiteGraphLink, @@ -52,6 +53,10 @@ declare const process: { declare global { declare function dbg(arg: T): T; + declare function toast(msg: Renderable, options?: ToastOptions): void; + declare function toastSuccess(msg: Renderable, options?: ToastOptions): void; + declare function toastError(msg: Renderable, options?: ToastOptions): void; + declare function updateConnectables(vcId: string, newConnectables: AudioConnectables): void; declare function genRandomStringID(): string; diff --git a/package.json b/package.json index 209490ac..fb1abbab 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,7 @@ "showdown": "^2.1.0", "showdown-xss-filter": "^0.2.0", "svelte": "^4.2.10", + "svelte-french-toast": "^1.2.0", "svelte-loading-spinners": "^0.3.4" } } diff --git a/src/api.ts b/src/api.ts index 2edf7ad4..9308d14a 100644 --- a/src/api.ts +++ b/src/api.ts @@ -195,7 +195,7 @@ export const getExistingMIDICompositionTags = async (): Promise< return res.json(); }); -export interface LooperPreset { +export interface GenericPresetDescriptor { id: number; name: string; description: string; @@ -204,7 +204,7 @@ export interface LooperPreset { userName: string | null | undefined; } -export const fetchLooperPresets = async (): Promise => +export const fetchLooperPresets = async (): Promise => fetch(`${BACKEND_BASE_URL}/looper_presets`).then(async res => { if (!res.ok) { throw await res.text(); @@ -216,7 +216,7 @@ export const saveLooperPreset = async (preset: { name: string; description: string; tags: string[]; - serializedLooperInstState: SerializedLooperInstState; + preset: SerializedLooperInstState; }) => { const maybeLoginToken = await getLoginToken(); return fetch(`${BACKEND_BASE_URL}/looper_preset`, { @@ -249,6 +249,53 @@ export const getLooperPreset = async (id: number): Promise { + const maybeLoginToken = await getLoginToken(); + return fetch(`${BACKEND_BASE_URL}/subgraph_preset`, { + body: JSON.stringify(preset), + method: 'POST', + headers: { + Authorization: maybeLoginToken, + }, + }).then(async res => { + if (!res.ok) { + throw await res.text(); + } + return res.json(); + }); +}; + +export const fetchSubgraphPresets = async (): Promise => + fetch(`${BACKEND_BASE_URL}/subgraph_presets`).then(async res => { + if (!res.ok) { + throw await res.text(); + } + return res.json(); + }); + +export const getExistingSubgraphPresetTags = async (): Promise<{ name: string; count: number }[]> => + fetch(`${BACKEND_BASE_URL}/subgraph_preset_tags`).then(async res => { + if (!res.ok) { + throw await res.text(); + } + return res.json(); + }); + +export const getSubgraphPreset = async (id: number | string): Promise => + fetch(`${BACKEND_BASE_URL}/subgraph_preset/${id}`).then(async res => { + if (!res.ok) { + throw await res.text(); + } + return res.json(); + }); + export interface WavetablePreset { waveforms: { instState: BuildWavetableInstanceState; diff --git a/src/compositionSharing/CompositionSharing.tsx b/src/compositionSharing/CompositionSharing.tsx index 9c204cc3..0a82dd03 100644 --- a/src/compositionSharing/CompositionSharing.tsx +++ b/src/compositionSharing/CompositionSharing.tsx @@ -78,14 +78,17 @@ const uploadLocalSamples = async (localSamples: SampleDescriptor[]) => { const checkForLocalSamples = async () => { const activeSamples: SampleDescriptor[] = getEngine()!.get_active_samples(); - const activeLocalSamples = activeSamples.reduce((acc, descriptor) => { - if (!descriptor.isLocal) { - return acc; - } + const activeLocalSamples = activeSamples.reduce( + (acc, descriptor) => { + if (!descriptor.isLocal) { + return acc; + } - acc.set(descriptor.name, descriptor); - return acc; - }, new Map() as Map); + acc.set(descriptor.name, descriptor); + return acc; + }, + new Map() as Map + ); if (activeLocalSamples.size === 0) { return null; @@ -267,6 +270,7 @@ const ShareComposition: React.FC = () => { description: description ?? '', tags: tags ?? [], }); + toastSuccess(`Successfully saved as composition ${savedCompositionID}`); setSavedCompositionID(savedCompositionID); } catch (err) { if (!err) { diff --git a/src/graphEditor/GraphEditor.tsx b/src/graphEditor/GraphEditor.tsx index bf40daed..4718123e 100644 --- a/src/graphEditor/GraphEditor.tsx +++ b/src/graphEditor/GraphEditor.tsx @@ -34,29 +34,83 @@ import { audioNodeGetters, buildNewForeignConnectableID } from 'src/graphEditor/ import { removeNode } from 'src/patchNetwork/interface'; import { handleGlobalMouseDown } from 'src'; import { SubgraphPortalNode } from 'src/graphEditor/nodes/CustomAudio/Subgraph/SubgraphPortalNode'; -import { renderSvelteModalWithControls } from 'src/controls/Modal'; +import { renderModalWithControls, renderSvelteModalWithControls } from 'src/controls/Modal'; import ConfirmReset from 'src/sampler/SamplerUI/ConfirmReset.svelte'; import type { SveltePropTypesOf } from 'src/svelteUtils'; +import { onBeforeUnload } from 'src/persistance'; +import { renderGenericPresetSaverWithModal } from 'src/controls/GenericPresetPicker/GenericPresetSaver'; +import { + fetchSubgraphPresets, + getExistingSubgraphPresetTags, + getSubgraphPreset, + saveSubgraphPreset as saveSubgraphPresetAPI, +} from 'src/api'; +import { logError } from 'src/sentry'; +import { + mkGenericPresetPicker, + type PresetDescriptor, +} from 'src/controls/GenericPresetPicker/GenericPresetPicker'; const ctx = new AudioContext(); const confirmAndDeleteSubgraph = async (subgraphID: string) => { const subgraphName = getState().viewContextManager.subgraphsByID[subgraphID]?.name ?? 'Unknown'; - try { - await renderSvelteModalWithControls>( - ConfirmReset, - true, - { - message: `Are you sure you want to delete the subgraph "${subgraphName}"?`, - cancelMessage: 'Cancel', - resetMessage: 'Delete', - } + const isEmpty = + getState().viewContextManager.activeViewContexts.every( + vc => vc.name === 'graph_editor' || vc.subgraphId !== subgraphID + ) && + getState().viewContextManager.foreignConnectables.every( + fc => fc.type === 'customAudio/subgraphPortal' || fc.subgraphId !== subgraphID ); + + if (!isEmpty) { + try { + await renderSvelteModalWithControls>( + ConfirmReset, + true, + { + message: `Are you sure you want to delete the subgraph "${subgraphName}"?`, + cancelMessage: 'Cancel', + resetMessage: 'Delete', + } + ); + } catch (_err) { + return; // cancelled + } + } + + getEngine()!.delete_subgraph(subgraphID); +}; + +const saveSubgraphPreset = async (subgraphID: string) => { + let desc; + try { + desc = await renderGenericPresetSaverWithModal({ + description: true, + getExistingTags: getExistingSubgraphPresetTags, + }); } catch (_err) { return; // cancelled } - getEngine()!.delete_subgraph(subgraphID); + // Commit all state to the engine + const engine = getEngine()!; + onBeforeUnload(engine); + const serializedSubgraph = getEngine()!.serialize_subgraph(subgraphID); + engine.init(); + + try { + await saveSubgraphPresetAPI({ + description: desc.description ?? '', + name: desc.name, + preset: JSON.parse(serializedSubgraph), + tags: desc.tags ?? [], + }); + toastSuccess('Subgraph preset saved'); + } catch (err) { + logError('Error saving subgraph preset', err); + toastError('Error saving subgraph preset: ' + `${err}`); + } }; LGraphCanvas.prototype.getCanvasMenuOptions = () => []; @@ -111,6 +165,17 @@ LGraphCanvas.prototype.getNodeMenuOptions = function (node: LGraphNode) { removeOption.content = 'Delete Subgraph'; removeOption.callback = () => void confirmAndDeleteSubgraph((innerNode as SubgraphPortalNode).rxSubgraphID); + + // Add a "Save Subgraph" option after the "Delete Subgraph" option + filteredOptions.splice( + filteredOptions.indexOf(removeOption) + 1, + 0, + { + content: 'Save Subgraph', + callback: () => void saveSubgraphPreset(innerNode.rxSubgraphID), + }, + null + ); } } else { // Patch the remove option to delete the node directly from the patch network @@ -356,6 +421,27 @@ const createNode = (nodeType: string, subgraphId: string, params?: Record getEngine()!.add_subgraph(); +const addSavedSubgraph = async () => { + let pickedPreset: PresetDescriptor; + try { + pickedPreset = await renderModalWithControls( + mkGenericPresetPicker(() => + fetchSubgraphPresets().then(presets => presets.map(p => ({ ...p, preset: p.id }))) + ) + ); + } catch (_err) { + return; // cancelled + } + + try { + const preset = await getSubgraphPreset(pickedPreset.id); + getEngine()!.load_serialized_subgraph(JSON.stringify(preset)); + } catch (err) { + logError('Error fetching subgraph preset', err); + toastError('Error fetching subgraph preset: ' + `${err}`); + } +}; + interface GraphControlsProps { lGraphInstance: LGraph | null; } @@ -557,7 +643,12 @@ const GraphEditor: React.FC<{ stateKey: string }> = ({ stateKey }) => { }); }; - const sortedNodeEntries = [['Add Subgraph', 'ADD_SUBGRAPH'], ...buildSortedNodeEntries()]; + const sortedNodeEntries = [ + ['Add Empty Subgraph', 'ADD_SUBGRAPH'], + ['Add Saved Subgraph', 'ADD_SAVED_SUBGRAPH'], + ['---', '---'], + ...buildSortedNodeEntries(), + ]; const displayNames = sortedNodeEntries.map(([displayName]) => displayName); const lowerDisplayNames = displayNames.map(displayName => displayName.toLowerCase()); canvas.onSearchBox = (_helper, value, _graphCanvas) => { @@ -574,8 +665,12 @@ const GraphEditor: React.FC<{ stateKey: string }> = ({ stateKey }) => { throw new Error(`No entry found for node type "${name}"`); } const [, nodeType] = entry; - if (nodeType === 'ADD_SUBGRAPH') { + if (!nodeType || nodeType === '---') { + return; + } else if (nodeType === 'ADD_SUBGRAPH') { addSubgraph(); + } else if (nodeType === 'ADD_SAVED_SUBGRAPH') { + addSavedSubgraph(); } else { if (!subgraphID) { throw new Error('No subgraph ID'); @@ -661,11 +756,17 @@ const GraphEditor: React.FC<{ stateKey: string }> = ({ stateKey }) => { if (state.selectedNodeVcId) { const node = (lGraphInstance as any as LiteGraphInstance)._nodes.find( node => node.connectables?.vcId === state.selectedNodeVcId - ) as any; + ) as any as LGraphNode | undefined; setCurSelectedNode(node); - setSelectedNodeVCID(state.selectedNodeVcId); - lGraphInstance.list_of_graphcanvas?.[0]?.selectNodes([node]); - lGraphInstance.list_of_graphcanvas?.[0]?.onNodeSelected?.(node); + setSelectedNodeVCID(node ? state.selectedNodeVcId : null); + if (node) { + lGraphInstance.list_of_graphcanvas?.[0]?.selectNodes([node]); + lGraphInstance.list_of_graphcanvas?.[0]?.onNodeSelected?.(node); + } else { + console.warn( + `Failed to find node with ID=${state.selectedNodeVcId} which was marked as selected in the serialized state` + ); + } } state.nodes.forEach(({ id, pos }) => { diff --git a/src/graphEditor/nodes/CustomAudio/Subgraph/SubgraphPortalNode.ts b/src/graphEditor/nodes/CustomAudio/Subgraph/SubgraphPortalNode.ts index be31a83a..8c268bad 100644 --- a/src/graphEditor/nodes/CustomAudio/Subgraph/SubgraphPortalNode.ts +++ b/src/graphEditor/nodes/CustomAudio/Subgraph/SubgraphPortalNode.ts @@ -63,7 +63,8 @@ const maybeInitSubgraphConnectablesWatcher = () => { c => !!c.node && c.node instanceof SubgraphPortalNode && - c.node.rxSubgraphID === txSubgraphNode.txSubgraphID + c.node.rxSubgraphID === txSubgraphNode.txSubgraphID && + c.node.txSubgraphID === txSubgraphNode.rxSubgraphID ); const matchingConns: { diff --git a/src/index.tsx b/src/index.tsx index 83c44619..2d446925 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -16,6 +16,7 @@ import { getEngine, initGlobals, setEngine } from 'src/util'; import { registerMainReduxGetState } from 'src/ViewContextManager/VcHideStatusRegistry'; import { getState, store } from './redux'; import { ViewContextManager, ViewContextSwitcher } from './ViewContextManager'; +import { createGlobalToaster } from 'src/misc/GlobalToaster'; initGlobals(); @@ -47,6 +48,11 @@ const createViewContextManagerUI = (engine: typeof import('./engine')) => { ); }; +const createGlobalUI = (engine: typeof import('./engine')) => { + createViewContextManagerUI(engine); + createGlobalToaster(); +}; + export const handleGlobalMouseDown = (evt: MouseEvent) => { if (evt.button === 3) { evt.preventDefault(); @@ -97,6 +103,6 @@ if (typeof AudioWorkletNode === 'undefined') { window.addEventListener('beforeunload', () => onBeforeUnload(engine)); - createViewContextManagerUI(engine); + createGlobalUI(engine); }); } diff --git a/src/looper/LooperUI/LooperUI.tsx b/src/looper/LooperUI/LooperUI.tsx index 82054d0e..e72894a0 100644 --- a/src/looper/LooperUI/LooperUI.tsx +++ b/src/looper/LooperUI/LooperUI.tsx @@ -9,7 +9,7 @@ import { getExistingLooperPresetTags, getLooperPreset, saveLooperPreset, - type LooperPreset, + type GenericPresetDescriptor, } from 'src/api'; import { pickPresetWithModal, @@ -339,7 +339,7 @@ const LooperTabSwitcher: React.FC = ({ vcId }) => { const wrappedFetchLooperPresets = () => fetchLooperPresets().then(presets => presets.map( - (preset): PresetDescriptor => ({ + (preset): PresetDescriptor => ({ id: preset.id, name: preset.name, description: preset.description, @@ -377,9 +377,7 @@ const LooperTabSwitcher: React.FC = ({ vcId }) => { name: preset.name, description: preset.description ?? '', tags: preset.tags ?? [], - serializedLooperInstState: deserializeLooper( - serializeLooper(getState().looper.stateByVcId[vcId]) - ), + preset: deserializeLooper(serializeLooper(getState().looper.stateByVcId[vcId])), }); console.log('Successfully created preset with id: ', id); } catch (err) { diff --git a/src/misc/GlobalToaster.svelte b/src/misc/GlobalToaster.svelte new file mode 100644 index 00000000..3a6f4513 --- /dev/null +++ b/src/misc/GlobalToaster.svelte @@ -0,0 +1,27 @@ + + + diff --git a/src/misc/GlobalToaster.ts b/src/misc/GlobalToaster.ts new file mode 100644 index 00000000..1ba71d9c --- /dev/null +++ b/src/misc/GlobalToaster.ts @@ -0,0 +1,26 @@ +import GlobalToaster from 'src/misc/GlobalToaster.svelte'; +import { mkSvelteContainerRenderHelper } from 'src/svelteUtils'; +import type { Renderable, ToastOptions } from 'svelte-french-toast'; +import { writable } from 'svelte/store'; + +const CurToast = writable<{ + message: Renderable; + options?: ToastOptions; + variant?: 'success' | 'error'; +} | null>(null); + +(window as any).toast = (message: Renderable, options?: ToastOptions) => + void CurToast.set({ message, options }); +(window as any).toastSuccess = (message: Renderable, options?: ToastOptions) => + void CurToast.set({ message, options, variant: 'success' }); +(window as any).toastError = (message: Renderable, options?: ToastOptions) => + void CurToast.set({ message, options, variant: 'error' }); + +export const createGlobalToaster = () => { + const globalToasterRoot = document.createElement('div'); + globalToasterRoot.id = 'global-toaster-root'; + document.body.appendChild(globalToasterRoot); + mkSvelteContainerRenderHelper({ Comp: GlobalToaster, getProps: () => ({ curToast: CurToast }) })( + 'global-toaster-root' + ); +}; diff --git a/src/redux/modules/viewContextManager.ts b/src/redux/modules/viewContextManager.ts index b043d250..a2e27fb0 100644 --- a/src/redux/modules/viewContextManager.ts +++ b/src/redux/modules/viewContextManager.ts @@ -69,6 +69,27 @@ const actionGroups = { return { ...newState, patchNetwork: newPatchNetwork, isLoaded: true, activeSubgraphID }; }, }), + SET_CONNECTIONS: buildActionGroup({ + actionCreator: (connections: [ConnectableDescriptor, ConnectableDescriptor][]) => ({ + type: 'SET_CONNECTIONS', + connections, + }), + subReducer: (state: VCMState, { connections }) => { + const engine = getEngine(); + if (!engine) { + console.error('Engine handle was not set when trying to set connections'); + return state; + } + + const newPatchNetwork = { + ...state.patchNetwork, + connections, + }; + maybeUpdateVCM(engine, state.patchNetwork, newPatchNetwork); + + return { ...state, patchNetwork: newPatchNetwork }; + }, + }), CONNECT: buildActionGroup({ actionCreator: (from: ConnectableDescriptor, to: ConnectableDescriptor) => ({ type: 'CONNECT', diff --git a/src/vcInterop.ts b/src/vcInterop.ts index 44fea300..eec651e1 100644 --- a/src/vcInterop.ts +++ b/src/vcInterop.ts @@ -86,7 +86,7 @@ export const add_view_context = (id: string, name: string, subgraphID: string) = ); }; -export const add_foreign_connectable = (fcJSON: string) => { +export const add_foreign_connectable = (fcJSON: string): string => { const fc: ForeignConnectable = JSON.parse(fcJSON); const id = buildNewForeignConnectableID().toString(); const node = new audioNodeGetters[fc.type]!.nodeGetter(ctx, id, fc.serializedState); @@ -94,6 +94,16 @@ export const add_foreign_connectable = (fcJSON: string) => { dispatch( actionCreators.viewContextManager.ADD_PATCH_NETWORK_NODE(id, connectables, fc.subgraphId) ); + return id; +}; + +export const set_connections = (connectionsJson: string) => { + const connections = tryParseJson<[ConnectableDescriptor, ConnectableDescriptor][]>( + connectionsJson, + [], + 'Failed to parse provided connections out of JSON' + ); + dispatch(actionCreators.viewContextManager.SET_CONNECTIONS(connections)); }; export const delete_foreign_connectable = (id: string) => { diff --git a/webpack.base.js b/webpack.base.js index da526551..07b56fee 100644 --- a/webpack.base.js +++ b/webpack.base.js @@ -20,6 +20,12 @@ const config = { exclude: /node_modules/, loader: 'babel-loader', }, + { + test: /\.m?js/, + resolve: { + fullySpecified: false, + }, + }, { test: /\.hbs$/, use: 'handlebars-loader', diff --git a/yarn.lock b/yarn.lock index 7973eab2..326f6183 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6349,6 +6349,13 @@ svelte-dev-helper@^1.1.9: resolved "https://registry.yarnpkg.com/svelte-dev-helper/-/svelte-dev-helper-1.1.9.tgz#7d187db5c6cdbbd64d75a32f91b8998bde3273c3" integrity sha512-oU+Xv7Dl4kRU2kdFjsoPLfJfnt5hUhsFUZtuzI3Ku/f2iAFZqBoEuXOqK3N9ngD4dxQOmN4OKWPHVi3NeAeAfQ== +svelte-french-toast@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/svelte-french-toast/-/svelte-french-toast-1.2.0.tgz#bfe3696ee1e3cbdee2a300e0153dede7d6d802eb" + integrity sha512-5PW+6RFX3xQPbR44CngYAP1Sd9oCq9P2FOox4FZffzJuZI2mHOB7q5gJBVnOiLF5y3moVGZ7u2bYt7+yPAgcEQ== + dependencies: + svelte-writable-derived "^3.1.0" + svelte-hmr@^0.14.2: version "0.14.12" resolved "https://registry.yarnpkg.com/svelte-hmr/-/svelte-hmr-0.14.12.tgz#a127aec02f1896500b10148b2d4d21ddde39973f" @@ -6379,6 +6386,11 @@ svelte-preprocess@^5.1.3: sorcery "^0.11.0" strip-indent "^3.0.0" +svelte-writable-derived@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/svelte-writable-derived/-/svelte-writable-derived-3.1.0.tgz#ea114125805a9d18398577f2431d1e8cdd4d8d69" + integrity sha512-cTvaVFNIJ036vSDIyPxJYivKC7ZLtcFOPm1Iq6qWBDo1fOHzfk6ZSbwaKrxhjgy52Rbl5IHzRcWgos6Zqn9/rg== + svelte@^4.2.10: version "4.2.10" resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.10.tgz#3bef8d79ca75eb53cc4d03f9fac1546e60393f77"