diff --git a/Cargo.lock b/Cargo.lock index 73502cd..87d69e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,7 +29,7 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "ahash", + "ahash 0.7.6", "base64", "bitflags", "brotli", @@ -144,7 +144,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash", + "ahash 0.7.6", "bytes", "bytestring", "cfg-if", @@ -199,6 +199,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -405,6 +416,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "contextual" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e916dad4a946c830c9f199481a03be3e8d45792d5fd228c6bde51195a34d6c7" + [[package]] name = "convert_case" version = "0.4.0" @@ -422,6 +439,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -534,6 +561,23 @@ dependencies = [ "syn", ] +[[package]] +name = "decoded-char" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5440d1dc8ea7cae44cda3c64568db29bfa2434aba51ae66a50c00488841a65a3" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -618,6 +662,15 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + [[package]] name = "flate2" version = "1.0.25" @@ -634,6 +687,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -789,7 +857,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +dependencies = [ + "ahash 0.8.2", ] [[package]] @@ -798,7 +875,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -854,6 +931,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" @@ -875,6 +963,43 @@ dependencies = [ "quick-error", ] +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.53" @@ -916,7 +1041,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -928,6 +1053,22 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" + +[[package]] +name = "iref" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcabecbc10d7b879305b3ef4aacab1d6c3574f48091c3fdc0ad0341cf1b8382f" +dependencies = [ + "pct-str", + "smallvec", +] + [[package]] name = "itertools" version = "0.10.5" @@ -961,6 +1102,160 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-ld" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42bdd89b19778c4b3695a3c71919046fa64f65b6b9bea33240d1711295b49b" +dependencies = [ + "contextual", + "futures", + "json-ld-compaction", + "json-ld-context-processing", + "json-ld-core", + "json-ld-expansion", + "json-ld-syntax", + "json-syntax", + "locspan", + "rdf-types", +] + +[[package]] +name = "json-ld-compaction" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5279f0f8cab0f55a1adf8340f2168b0630dbfdbefe3c7bf86fbfe42bc61d7a" +dependencies = [ + "contextual", + "derivative", + "futures", + "iref", + "json-ld-context-processing", + "json-ld-core", + "json-ld-expansion", + "json-ld-syntax", + "json-syntax", + "langtag", + "locspan", + "mown", + "rdf-types", +] + +[[package]] +name = "json-ld-context-processing" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353b656a3d5af5a18488831d3b732b6997f779ad90d51d731dd2672abd0a9628" +dependencies = [ + "contextual", + "futures", + "iref", + "json-ld-core", + "json-ld-syntax", + "locspan", + "mown", + "rdf-types", +] + +[[package]] +name = "json-ld-core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7dce303cae132e4c8b2ffde5af1928f2b100095c0ad92f8b0bb516ddc1fec78" +dependencies = [ + "bytes", + "contextual", + "derivative", + "futures", + "hashbrown 0.13.1", + "iref", + "json-ld-syntax", + "json-syntax", + "langtag", + "locspan", + "locspan-derive", + "log", + "mime", + "mown", + "once_cell", + "permutohedron", + "pretty_dtoa", + "rdf-types", + "reqwest", + "ryu-js", + "smallvec", + "static-iref", +] + +[[package]] +name = "json-ld-expansion" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b93a40a9308871fd074ac87ff668aba6cc57922a5a27042bbd9dbc47e0b3417" +dependencies = [ + "contextual", + "derivative", + "futures", + "iref", + "json-ld-context-processing", + "json-ld-core", + "json-ld-syntax", + "json-syntax", + "langtag", + "locspan", + "mown", + "rdf-types", +] + +[[package]] +name = "json-ld-syntax" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9295ba958d50a56f2bae109955e7bff7b53078ae0a3e65a5f0ebf4443dbc8ba0" +dependencies = [ + "contextual", + "decoded-char", + "derivative", + "hashbrown 0.13.1", + "indexmap", + "iref", + "json-syntax", + "langtag", + "locspan", + "locspan-derive", + "rdf-types", + "smallvec", +] + +[[package]] +name = "json-number" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c724484d970b5aabe46934b9571980e255fd50a9ef1b13f23ed2b5c2a19bbb69" +dependencies = [ + "lexical", + "ryu-js", + "smallvec", +] + +[[package]] +name = "json-syntax" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "792e31ce68030c1667ef7975f99932a7e8605f80bc34e26aea1ef65bfeff86a5" +dependencies = [ + "contextual", + "decoded-char", + "hashbrown 0.12.3", + "indexmap", + "json-number", + "locspan", + "locspan-derive", + "ryu-js", + "smallstr", + "smallvec", +] + [[package]] name = "jsonwebtoken" version = "8.2.0" @@ -973,12 +1268,97 @@ dependencies = [ "serde_json", ] +[[package]] +name = "langtag" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78b08c3742c6e025dac6db28d42a961411470194bc4ec2ef22ba16bbc38da03" + [[package]] name = "language-tags" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lexical" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" +dependencies = [ + "lexical-core", +] + +[[package]] +name = "lexical-core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.138" @@ -1022,6 +1402,28 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "locspan" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685e26b5a3e4266c351baf3c00793a097e40f4293270ac508b3f4cbc41e72e54" +dependencies = [ + "contextual", + "hashbrown 0.13.1", +] + +[[package]] +name = "locspan-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88991223b049a3d29ca1f60c05639581336a0f3ee4bf8a659dddecc11c4961a" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "log" version = "0.4.17" @@ -1076,7 +1478,31 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "mown" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7627d8bbeb17edbf1c3f74b21488e4af680040da89713b4217d0010e9cbd97e" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -1129,15 +1555,22 @@ dependencies = [ "chrono", "dotenvy", "futures", + "iref", + "json-ld", "jsonwebtoken", + "locspan", "log", "pretty_env_logger", + "rdf-types", + "reqwest", "serde", "serde_json", "serde_test", "sqlx", + "static-iref", "thiserror", "tokio", + "uuid", ] [[package]] @@ -1146,6 +1579,51 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -1191,7 +1669,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1211,12 +1689,24 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +[[package]] +name = "pct-str" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1240e3e7bfdde5660ba0fc3e9e3565d3b30c2ae1973e218e93b869da771ff2e9" + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "permutohedron" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b687ff7b5da449d39e418ad391e5e08da53ec334903ddbb921db208908fc372c" + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -1229,12 +1719,27 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "pretty_dtoa" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a239bcdfda2c685fda1add3b4695c06225f50075e3cfb5b954e91545587edff2" +dependencies = [ + "ryu_floating_decimal", +] + [[package]] name = "pretty_env_logger" version = "0.4.0" @@ -1245,6 +1750,30 @@ dependencies = [ "log", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.47" @@ -1299,6 +1828,19 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rdf-types" +version = "0.12.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83ab225d6a9c3fc881fb7fce5919af6cc67cd695890de13001bcf69fcb8727b1" +dependencies = [ + "contextual", + "iref", + "langtag", + "locspan", + "locspan-derive", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -1336,6 +1878,53 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -1387,6 +1976,28 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "ryu-js" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" + +[[package]] +name = "ryu_floating_decimal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "700de91d5fd6091442d00fdd9ee790af6d4f0f480562b0f5a1e8f59e90aafe73" + +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys 0.36.1", +] + [[package]] name = "scopeguard" version = "1.1.0" @@ -1409,6 +2020,29 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.14" @@ -1507,6 +2141,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallstr" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b1aefdf380735ff8ded0b15f31aab05daf1f70216c01c02a12926badd1df9d" +dependencies = [ + "smallvec", +] + [[package]] name = "smallvec" version = "1.10.0" @@ -1556,7 +2199,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105" dependencies = [ - "ahash", + "ahash 0.7.6", "atoi", "base64", "bitflags", @@ -1600,6 +2243,7 @@ dependencies = [ "thiserror", "tokio-stream", "url", + "uuid", "webpki-roots", "whoami", ] @@ -1634,6 +2278,21 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "static-iref" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9786d4b8e9e5423fe85c57a826d7e0f0774746149a2ccd21e2104ff74b71ce7" +dependencies = [ + "iref", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "stringprep" version = "0.1.2" @@ -1661,6 +2320,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -1759,7 +2432,17 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2", - "windows-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", ] [[package]] @@ -1798,6 +2481,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -1819,6 +2508,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.16.0" @@ -1881,12 +2576,37 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -1924,6 +2644,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.83" @@ -2024,6 +2756,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +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", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -2031,12 +2776,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", + "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", - "windows_x86_64_msvc", + "windows_x86_64_msvc 0.42.0", ] [[package]] @@ -2045,24 +2790,48 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +[[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.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + [[package]] name = "windows_i686_gnu" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +[[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.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + [[package]] name = "windows_x86_64_gnu" version = "0.42.0" @@ -2075,12 +2844,27 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +[[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.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/Cargo.toml b/Cargo.toml index 7aaa32c..8b4c889 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,19 @@ async-trait = "0.1.59" chrono = { version = "0.4", features = [ "alloc", "clock", "serde" ] } dotenvy = "0.15.6" futures = "0.3" +iref = "2.2" +json-ld = { version = "0.10", features = [ "reqwest" ] } jsonwebtoken = { version = "8", default-features = false } +locspan = "0.7" log = "0.4" pretty_env_logger = "0.4" +rdf-types = "0.12" +reqwest = { version = "0.11", features = [ "rustls" ] } serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" serde_test = "1.0" -sqlx = { version = "0.6", features = [ "chrono", "runtime-actix-rustls", "postgres" ] } +sqlx = { version = "0.6", features = [ "chrono", "postgres", "runtime-actix-rustls", "uuid" ] } +static-iref = "2" thiserror = "1.0" tokio = "1.23" +uuid = { version = "1.2", features = [ "v4" ] } diff --git a/migrations/20221225041649_create_objects.sql b/migrations/20221225041649_create_objects.sql new file mode 100644 index 0000000..620faaf --- /dev/null +++ b/migrations/20221225041649_create_objects.sql @@ -0,0 +1,11 @@ +CREATE TABLE objects ( + id UUID PRIMARY KEY, + iri VARCHAR NOT NULL, + data VARCHAR NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT now(), + updated_at TIMESTAMP NOT NULL DEFAULT now() +); + +CREATE UNIQUE INDEX index_objects_on_iri ON objects (iri); +CREATE INDEX index_objects_on_created_at ON objects (created_at); +CREATE INDEX index_objects_on_updated_at ON objects (updated_at); diff --git a/src/data/mod.rs b/src/data/mod.rs index c9c54b8..4e68b81 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -2,12 +2,14 @@ pub mod account; pub mod follow; pub mod like; pub mod note; +pub mod object; pub mod user; pub use account::*; pub use follow::*; pub use like::*; pub use note::*; +pub use object::*; pub use user::*; #[derive(sqlx::FromRow)] diff --git a/src/data/object/mod.rs b/src/data/object/mod.rs new file mode 100644 index 0000000..568fa16 --- /dev/null +++ b/src/data/object/mod.rs @@ -0,0 +1,3 @@ +pub mod pg; + +pub use pg::PgObjectDataSource; diff --git a/src/data/object/pg.rs b/src/data/object/pg.rs new file mode 100644 index 0000000..937212f --- /dev/null +++ b/src/data/object/pg.rs @@ -0,0 +1,55 @@ +use sqlx::types::Uuid; +use sqlx::PgPool; + +use crate::core::*; +use crate::model::object::*; + +pub struct PgObjectDataSource { + pool: PgPool, +} + +impl PgObjectDataSource { + pub fn new(pool: PgPool) -> PgObjectDataSource { + PgObjectDataSource { pool } + } + + pub async fn create(&self, new: NewObject) -> Result { + let object: Object = sqlx::query_as( + "INSERT INTO objects (id, iri, data) + VALUES ($1, $2, $3) + RETURNING *", + ) + .bind(new.id) + .bind(new.iri) + .bind(new.data) + .fetch_one(&self.pool) + .await?; + Ok(object) + } + + pub async fn update(&self, object: &Object) -> Result<()> { + sqlx::query("UPDATE objects SET data = $1, updated_at = $2 WHERE id = $3") + .bind(&object.data) + .bind(&object.updated_at) + .bind(&object.id) + .execute(&self.pool) + .await?; + Ok(()) + } + + pub async fn by_id(&self, id: Uuid) -> Result { + let object: Object = sqlx::query_as("SELECT * FROM objects WHERE id = $1") + .bind(id) + .fetch_one(&self.pool) + .await?; + Ok(object) + } + + pub async fn by_iri(&self, iri: &str) -> Result { + let object: Object = sqlx::query_as("SELECT * FROM objects WHERE iri = $1") + .bind(iri) + .fetch_one(&self.pool) + .await?; + Ok(object) + } +} diff --git a/src/model/mod.rs b/src/model/mod.rs index 7cb1f4d..daf1104 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -2,10 +2,12 @@ pub mod account; pub mod follow; pub mod like; pub mod note; +pub mod object; pub mod user; pub use account::{Account, NewAccount}; pub use follow::{Follow, NewFollow}; pub use like::{Like, NewLike}; pub use note::{NewNote, Note}; +pub use object::{NewObject, Object}; pub use user::{NewUser, User}; diff --git a/src/model/object.rs b/src/model/object.rs new file mode 100644 index 0000000..b30784c --- /dev/null +++ b/src/model/object.rs @@ -0,0 +1,18 @@ +use chrono::NaiveDateTime; +use sqlx::types::Uuid; +use sqlx::FromRow; + +#[derive(FromRow)] +pub struct Object { + pub id: Uuid, + pub iri: String, + pub data: String, + pub created_at: NaiveDateTime, + pub updated_at: NaiveDateTime, +} + +pub struct NewObject { + pub id: Uuid, + pub iri: String, + pub data: String, +} diff --git a/src/repo/mod.rs b/src/repo/mod.rs index 21cf92e..2f362ac 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -4,11 +4,14 @@ pub mod account; pub mod follow; pub mod like; pub mod note; +pub mod object; pub mod user; + use account::AccountRepo; use follow::FollowRepo; use like::LikeRepo; use note::NoteRepo; +use object::ObjectRepo; use user::UserRepo; /// The central collection of all data accessible to the app. @@ -19,6 +22,7 @@ pub struct AppRepo { pub follows: FollowRepo, pub likes: LikeRepo, pub notes: NoteRepo, + pub objects: ObjectRepo, pub users: UserRepo, } @@ -29,6 +33,7 @@ impl AppRepo { follows: FollowRepo::new(db_pool.clone()), likes: LikeRepo::new(db_pool.clone()), notes: NoteRepo::new(db_pool.clone()), + objects: ObjectRepo::new(db_pool.clone()), users: UserRepo::new(db_pool.clone()), } } diff --git a/src/repo/object.rs b/src/repo/object.rs new file mode 100644 index 0000000..c82f79e --- /dev/null +++ b/src/repo/object.rs @@ -0,0 +1,44 @@ +use sqlx::types::Uuid; +use sqlx::PgPool; + +use crate::core::*; +use crate::data::object::PgObjectDataSource; +use crate::model::{NewObject, Object}; + +pub struct ObjectRepo { + db: PgObjectDataSource, +} + +impl ObjectRepo { + pub fn new(db_pool: PgPool) -> ObjectRepo { + ObjectRepo { + db: PgObjectDataSource::new(db_pool), + } + } + + pub async fn create(&self, new: NewObject) -> Result { + self.db.create(new).await + } + + pub async fn update(&self, object: T) -> Result + where + T: TryInto, Error = E>, + E: Into, + { + let mut object = object.try_into().map_err(|e| e.into())?.inner(); + object.updated_at = utc_now(); + self.db.update(&object).await?; + Ok(object) + } + + pub async fn by_id(&self, id: U) -> Result + where + U: Into, + { + self.db.by_id(id.into()).await + } + + pub async fn by_iri(&self, iri: &str) -> Result { + self.db.by_iri(iri).await + } +}