diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lock index af3fd0917..d7a550d47 100644 --- a/apps/desktop/src-tauri/Cargo.lock +++ b/apps/desktop/src-tauri/Cargo.lock @@ -133,6 +133,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + [[package]] name = "asn1_der" version = "0.7.5" @@ -194,7 +200,7 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.2", + "socket2 0.4.4", "waker-fn", "winapi 0.3.9", ] @@ -217,6 +223,18 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-native-tls" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d57d4cec3c647232e1094dc013546c0b33ce785d8aeb251e1f20dfaf8a9a13fe" +dependencies = [ + "futures-util", + "native-tls", + "thiserror", + "url", +] + [[package]] name = "async-process" version = "1.3.0" @@ -256,7 +274,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils", + "crossbeam-utils 0.8.5", "futures-channel", "futures-core", "futures-io", @@ -325,6 +343,19 @@ dependencies = [ "syn", ] +[[package]] +name = "asynchronous-codec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite 0.2.7", +] + [[package]] name = "asynchronous-codec" version = "0.6.0" @@ -449,12 +480,40 @@ dependencies = [ "syn", ] +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bigdecimal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1e50562e37200edf7c6c43e54a08e64a5553bfb59d9c297d5572512aa517256" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "bigdecimal" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" +dependencies = [ + "num-bigint 0.4.3", + "num-integer", + "num-traits", +] + [[package]] name = "bimap" version = "0.6.2" @@ -470,6 +529,31 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bit_field" version = "0.10.1" @@ -488,6 +572,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2" version = "0.10.4" @@ -595,6 +691,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bson" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41539b5c502b7c4e7b8af8ef07e5c442fe79ceba62a2aad8e62bd589b9454745" +dependencies = [ + "ahash 0.7.6", + "base64 0.13.0", + "chrono", + "hex", + "indexmap", + "lazy_static", + "rand 0.8.4", + "serde", + "serde_bytes", + "serde_json", + "uuid", +] + [[package]] name = "bstr" version = "0.2.17" @@ -760,6 +875,15 @@ dependencies = [ "jobserver", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfb" version = "0.4.0" @@ -841,7 +965,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", "winapi 0.3.9", ] @@ -860,6 +984,17 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "clang-sys" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "2.34.0" @@ -876,6 +1011,24 @@ dependencies = [ "vec_map", ] +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "cmake" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +dependencies = [ + "cc", +] + [[package]] name = "cocoa" version = "0.24.0" @@ -913,6 +1066,30 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colored" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +dependencies = [ + "atty", + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + [[package]] name = "combine" version = "4.6.2" @@ -951,6 +1128,16 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "connection-string" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4ecb0dc8c35d2c626e45ae70bbfcb1050b302f42bcdf025d913cc0c5a0b443" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -1105,6 +1292,20 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue 0.3.2", + "crossbeam-utils 0.8.5", +] + [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -1112,7 +1313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1123,7 +1324,7 @@ checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-utils 0.8.5", ] [[package]] @@ -1133,12 +1334,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.5", "lazy_static", "memoffset", "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + [[package]] name = "crossbeam-queue" version = "0.3.2" @@ -1146,7 +1358,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.5", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", ] [[package]] @@ -1185,6 +1408,26 @@ dependencies = [ "subtle", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + [[package]] name = "cssparser" version = "0.27.2" @@ -1248,6 +1491,17 @@ dependencies = [ "rand 0.7.3", ] +[[package]] +name = "cuid" +version = "0.1.0" +source = "git+https://github.com/prisma/cuid-rust#4ffb2e47c772af62fed3ddc92bb7fc444d19e159" +dependencies = [ + "hostname 0.1.5", + "lazy_static", + "parking_lot 0.10.2", + "rand 0.7.3", +] + [[package]] name = "curve25519-dalek" version = "3.2.1" @@ -1280,8 +1534,18 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.10.2", + "darling_macro 0.10.2", +] + +[[package]] +name = "darling" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +dependencies = [ + "darling_core 0.13.1", + "darling_macro 0.13.1", ] [[package]] @@ -1298,13 +1562,38 @@ dependencies = [ "syn", ] +[[package]] +name = "darling_core" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn", +] + [[package]] name = "darling_macro" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ - "darling_core", + "darling_core 0.10.2", + "quote", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +dependencies = [ + "darling_core 0.13.1", "quote", "syn", ] @@ -1315,6 +1604,41 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +[[package]] +name = "datamodel" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "chrono", + "datamodel-connector", + "diagnostics", + "dml", + "enumflags2 0.7.3", + "itertools 0.10.3", + "mongodb-datamodel-connector", + "once_cell", + "parser-database", + "pest", + "regex", + "schema-ast", + "serde", + "serde_json", + "sql-datamodel-connector", +] + +[[package]] +name = "datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "enumflags2 0.7.3", + "parser-database", + "serde_json", + "url", +] + [[package]] name = "deflate" version = "0.7.20" @@ -1368,6 +1692,16 @@ dependencies = [ "syn", ] +[[package]] +name = "diagnostics" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "colored", + "pest", + "thiserror", +] + [[package]] name = "digest" version = "0.8.1" @@ -1444,6 +1778,33 @@ dependencies = [ "rand 0.8.4", ] +[[package]] +name = "dml" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "chrono", + "cuid", + "enumflags2 0.7.3", + "indoc", + "native-types", + "prisma-value", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "dmmf" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "datamodel", + "serde", + "serde_json", +] + [[package]] name = "dns-parser" version = "0.8.0" @@ -1522,6 +1883,70 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99" +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +dependencies = [ + "encoding-index-japanese", + "encoding-index-korean", + "encoding-index-simpchinese", + "encoding-index-singlebyte", + "encoding-index-tradchinese", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" + [[package]] name = "enum-as-inner" version = "0.3.3" @@ -1540,10 +1965,19 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" dependencies = [ - "enumflags2_derive", + "enumflags2_derive 0.6.4", "serde", ] +[[package]] +name = "enumflags2" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25c90b056b3f84111cf183cbeddef0d3a0bbe9a674f057e1a1533c315f24def" +dependencies = [ + "enumflags2_derive 0.7.3", +] + [[package]] name = "enumflags2_derive" version = "0.6.4" @@ -1555,6 +1989,17 @@ dependencies = [ "syn", ] +[[package]] +name = "enumflags2_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" version = "0.9.0" @@ -1659,6 +2104,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" + [[package]] name = "fixedbitset" version = "0.4.1" @@ -1722,6 +2173,70 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frunk" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd67cf7d54b7e72d0ea76f3985c3747d74aee43e0218ad993b7903ba7a5395e" +dependencies = [ + "frunk_core", + "frunk_derives", + "frunk_proc_macros", +] + +[[package]] +name = "frunk_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1246cf43ec80bf8b2505b5c360b8fb999c97dabd17dbb604d85558d5cbc25482" + +[[package]] +name = "frunk_derives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dbc4f084ec5a3f031d24ccedeb87ab2c3189a2f33b8d070889073837d5ea09e" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99f11257f106c6753f5ffcb8e601fb39c390a088017aaa55b70c526bff15f63e" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a078bd8459eccbb85e0b007b8f756585762a72a9efc53f359b371c3b6351dbcc" +dependencies = [ + "frunk_core", + "frunk_proc_macros_impl", + "proc-macro-hack", +] + +[[package]] +name = "frunk_proc_macros_impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffba99f0fa4f57e42f57388fbb9a0ca863bc2b4261f3c5570fed579d5df6c32" +dependencies = [ + "frunk_core", + "frunk_proc_macro_helpers", + "proc-macro-hack", + "quote", + "syn", +] + [[package]] name = "fsevent" version = "0.4.0" @@ -1757,6 +2272,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" + [[package]] name = "futf" version = "0.1.4" @@ -1817,7 +2338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e" dependencies = [ "futures-core", - "lock_api", + "lock_api 0.4.6", "parking_lot 0.11.2", ] @@ -2181,6 +2702,16 @@ dependencies = [ "system-deps 3.2.0", ] +[[package]] +name = "graphql-parser" +version = "0.3.0" +source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3" +dependencies = [ + "combine 3.8.1", + "indexmap", + "thiserror", +] + [[package]] name = "gtk" version = "0.14.3" @@ -2315,7 +2846,27 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac", + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", "digest 0.9.0", ] @@ -2327,7 +2878,7 @@ checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", "generic-array 0.14.4", - "hmac", + "hmac 0.8.1", ] [[package]] @@ -2339,6 +2890,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "hostname" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +dependencies = [ + "libc", + "winutil", +] + [[package]] name = "hostname" version = "0.3.1" @@ -2464,7 +3025,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.5", "globset", "lazy_static", "log", @@ -2476,6 +3037,17 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "im" +version = "13.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8db49f8bc08d5cc4e2bb0f7d25a6d1db2c79bc6f7d7c86c96c657eb3d214125f" +dependencies = [ + "rustc_version 0.2.3", + "sized-chunks", + "typenum", +] + [[package]] name = "image" version = "0.24.1" @@ -2497,13 +3069,43 @@ dependencies = [ ] [[package]] -name = "indexmap" -version = "1.7.0" +name = "include_dir" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "482a2e29200b7eed25d7fdbd14423326760b7f6658d21a4cf12d55a50713c69f" +dependencies = [ + "glob", + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e074c19deab2501407c91ba1860fa3d6820bfde307db6d8cb851b55a10be89b" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indexmap" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown 0.11.2", + "serde", +] + +[[package]] +name = "indoc" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" +dependencies = [ + "unindent", ] [[package]] @@ -2694,9 +3296,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] @@ -2768,10 +3370,83 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff" [[package]] -name = "libc" -version = "0.2.112" +name = "lexical" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "c34e981f88d060a67815388470172638f1af16b3a12e581cb75142f190161bf9" +dependencies = [ + "lexical-core", +] + +[[package]] +name = "lexical-core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3926d8f156019890be4abe5fd3785e0cff1001e06f59c597641fd513a5a284" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d066d004fa762d9da995ed21aa8845bb9f6e4265f540d716fb4b315197bf0e" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c92badda8cc0fc4f3d3cc1c30aaefafb830510c8781ce4e8669881f3ed53ac" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff669ccaae16ee33af90dc51125755efed17f1309626ba5c12052512b11e291" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b5186948c7b297abaaa51560f2581dae625e5ce7dfc2d8fdc56345adb6dc576" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece956492e0e40fd95ef8658a34d53a3b8c2015762fdcaaff2167b28de1f56ef" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" [[package]] name = "libgit2-sys" @@ -2787,6 +3462,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + [[package]] name = "libp2p" version = "0.43.0" @@ -2935,8 +3620,8 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f62943fba0b0dae02b87868620c52a581c54ec9fb04b5e195cf20313fc510c3" dependencies = [ - "asynchronous-codec", - "base64", + "asynchronous-codec 0.6.0", + "base64 0.13.0", "byteorder", "bytes", "fnv", @@ -2981,7 +3666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aead5ee2322a7b825c7633065370909c8383046f955cda5b56797e6904db7a72" dependencies = [ "arrayvec 0.5.2", - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "either", "fnv", @@ -3019,7 +3704,7 @@ dependencies = [ "log", "rand 0.8.4", "smallvec", - "socket2 0.4.2", + "socket2 0.4.4", "void", ] @@ -3045,7 +3730,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures", "libp2p-core", @@ -3101,7 +3786,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures", "libp2p-core", @@ -3132,7 +3817,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "517be90a2ce60b6c3bdfe88f34cc789c61dafe6f694a7b45e644af7353880fa3" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "either", "futures", @@ -3158,7 +3843,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597e4a022dd2e168ce1218faf6b3aead5c427fb828eb4f982cef7c40d4b7f49e" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bimap", "futures", "futures-timer", @@ -3237,7 +3922,7 @@ dependencies = [ "libc", "libp2p-core", "log", - "socket2 0.4.2", + "socket2 0.4.4", ] [[package]] @@ -3304,7 +3989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" dependencies = [ "arrayref", - "base64", + "base64 0.13.0", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -3397,6 +4082,15 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.6" @@ -3517,6 +4211,29 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "md-5" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "md5" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d" + [[package]] name = "memchr" version = "2.4.1" @@ -3532,6 +4249,21 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metrics" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b70227ece8711a1aa2f99655efd795d0cff297a5b9fe39645a93aacf6ad39d" +dependencies = [ + "metrics-core", +] + +[[package]] +name = "metrics-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c064b3a1ff41f4bf6c91185c8a0caeccf8a8a27e9d0f92cc54cf3dbec812f48" + [[package]] name = "mime" version = "0.3.16" @@ -3591,12 +4323,25 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +dependencies = [ + "libc", + "log", + "miow 0.3.7", + "ntapi", + "winapi 0.3.9", +] + [[package]] name = "mio-extras" version = "2.0.6" @@ -3605,7 +4350,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", "log", - "mio", + "mio 0.6.23", "slab", ] @@ -3621,6 +4366,133 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "mobc" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f76d2f2e2dcbb00a8d3b2b09f026a74a82693ea52cd071647aa6cfa7f1ff37e" +dependencies = [ + "async-trait", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "log", + "tokio", +] + +[[package]] +name = "mongodb" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bacb6f8cee6bf010d7bc57550d859f6a4ffe255eb8c9a7014637fe988eaece64" +dependencies = [ + "async-trait", + "base64 0.13.0", + "bitflags 1.3.2", + "bson", + "chrono", + "derivative", + "futures-core", + "futures-executor", + "futures-io", + "futures-util", + "hex", + "hmac 0.11.0", + "lazy_static", + "md-5", + "os_info", + "pbkdf2", + "percent-encoding", + "rand 0.8.4", + "rustls 0.19.1", + "rustls-pemfile", + "serde", + "serde_bytes", + "serde_with", + "sha-1 0.9.8", + "sha2 0.9.8", + "socket2 0.4.4", + "stringprep", + "strsim 0.10.0", + "take_mut", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "trust-dns-proto", + "trust-dns-resolver", + "typed-builder", + "uuid", + "version_check", + "webpki 0.21.4", + "webpki-roots 0.21.1", +] + +[[package]] +name = "mongodb-client" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "mongodb", + "once_cell", + "percent-encoding", + "thiserror", +] + +[[package]] +name = "mongodb-datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "datamodel-connector", + "enumflags2 0.7.3", + "native-types", + "once_cell", + "serde_json", +] + +[[package]] +name = "mongodb-query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "futures", + "indexmap", + "itertools 0.10.3", + "mongodb", + "mongodb-client", + "native-types", + "prisma-models", + "prisma-value", + "query-connector", + "rand 0.7.3", + "regex", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "user-facing-errors", + "uuid", +] + [[package]] name = "multiaddr" version = "0.14.0" @@ -3686,6 +4558,75 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "mysql_async" +version = "0.29.0" +source = "git+https://github.com/prisma/mysql_async?branch=vendored-openssl#650f07121681ada8a5baec3669197e5ce7e0e6d7" +dependencies = [ + "bytes", + "crossbeam", + "flate2", + "futures-core", + "futures-sink", + "futures-util", + "lazy_static", + "lru", + "mio 0.8.0", + "mysql_common", + "native-tls", + "once_cell", + "pem", + "percent-encoding", + "pin-project 1.0.10", + "serde", + "serde_json", + "socket2 0.4.4", + "thiserror", + "tokio", + "tokio-native-tls", + "tokio-util", + "twox-hash", + "url", + "uuid", +] + +[[package]] +name = "mysql_common" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4140827f2d12750de1e8755442577e4292a835f26ff2f659f0a380d1d71020b0" +dependencies = [ + "base64 0.13.0", + "bigdecimal 0.3.0", + "bindgen", + "bitflags 1.3.2", + "bitvec", + "byteorder", + "bytes", + "cc", + "cmake", + "crc32fast", + "flate2", + "frunk", + "lazy_static", + "lexical", + "num-bigint 0.4.3", + "num-traits", + "rand 0.8.4", + "regex", + "rust_decimal", + "saturating", + "serde", + "serde_json", + "sha-1 0.10.0", + "sha2 0.10.2", + "smallvec", + "subprocess", + "thiserror", + "time 0.3.7", + "uuid", +] + [[package]] name = "nanorand" version = "0.6.1" @@ -3713,6 +4654,15 @@ dependencies = [ "tempfile", ] +[[package]] +name = "native-types" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "nb-connect" version = "1.2.0" @@ -3720,7 +4670,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" dependencies = [ "libc", - "socket2 0.4.2", + "socket2 0.4.4", ] [[package]] @@ -3756,7 +4706,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" dependencies = [ - "darling", + "darling 0.10.2", "proc-macro-crate 0.1.5", "proc-macro2", "quote", @@ -3912,7 +4862,7 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.6.23", "mio-extras", "walkdir", "winapi 0.3.9", @@ -3932,6 +4882,15 @@ dependencies = [ "zvariant_derive", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-bigint" version = "0.3.3" @@ -3943,6 +4902,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -4016,6 +4986,15 @@ dependencies = [ "syn", ] +[[package]] +name = "num_threads" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -4115,6 +5094,38 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf9b1c4e9a6c4de793c632496fa490bdc0e1eea73f0c91394f7b6990935d22" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project 1.0.10", + "rand 0.8.4", + "thiserror", + "tokio", +] + +[[package]] +name = "opentls" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f561874f8d6ecfb674fc08863414040c93cc90c0b6963fe679895fab8b65560" +dependencies = [ + "futures-util", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "url", +] + [[package]] name = "ordered-multimap" version = "0.3.1" @@ -4125,6 +5136,12 @@ dependencies = [ "hashbrown 0.9.1", ] +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" + [[package]] name = "os_info" version = "3.0.9" @@ -4216,6 +5233,16 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -4223,7 +5250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api", + "lock_api 0.4.6", "parking_lot_core 0.8.5", ] @@ -4233,10 +5260,24 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ - "lock_api", + "lock_api 0.4.6", "parking_lot_core 0.9.1", ] +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi 0.3.9", +] + [[package]] name = "parking_lot_core" version = "0.8.5" @@ -4264,6 +5305,17 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "parser-database" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "enumflags2 0.7.3", + "indexmap", + "schema-ast", +] + [[package]] name = "paste" version = "1.0.6" @@ -4276,6 +5328,30 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pem" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -4325,13 +5401,23 @@ dependencies = [ "sha-1 0.8.2", ] +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +dependencies = [ + "fixedbitset 0.1.9", + "ordermap", +] + [[package]] name = "petgraph" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ - "fixedbitset", + "fixedbitset 0.4.1", "indexmap", ] @@ -4605,6 +5691,50 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "postgres-native-tls" +version = "0.5.0" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "futures", + "native-tls", + "tokio", + "tokio-native-tls", + "tokio-postgres", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "base64 0.13.0", + "byteorder", + "bytes", + "fallible-iterator", + "hmac 0.10.1", + "md-5", + "memchr", + "rand 0.8.4", + "sha2 0.9.8", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "bit-vec", + "bytes", + "chrono", + "fallible-iterator", + "postgres-protocol", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -4617,6 +5747,75 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "pretty-hex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c" + +[[package]] +name = "prisma-client-rust" +version = "0.3.0" +source = "git+https://github.com/Brendonovich/prisma-client-rust.git?branch=master#5a10f2e92d335e04f6b6853a6d0061dc2404f204" +dependencies = [ + "chrono", + "datamodel", + "graphql-parser", + "prisma-models", + "query-core", + "request-handlers", + "serde", + "serde_json", +] + +[[package]] +name = "prisma-inflector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "once_cell", + "regex", + "unicode-segmentation", +] + +[[package]] +name = "prisma-models" +version = "0.0.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "itertools 0.10.3", + "once_cell", + "prisma-value", + "quaint", + "rand 0.7.3", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "uuid", +] + +[[package]] +name = "prisma-value" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "base64 0.12.3", + "bigdecimal 0.2.2", + "chrono", + "once_cell", + "quaint", + "regex", + "serde", + "serde_derive", + "serde_json", + "uuid", +] + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -4720,7 +5919,7 @@ dependencies = [ "lazy_static", "log", "multimap", - "petgraph", + "petgraph 0.6.0", "prost", "prost-types", "regex", @@ -4760,6 +5959,104 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "quaint" +version = "0.2.0-alpha.13" +source = "git+https://github.com/prisma/quaint#0b9aa168f5d25b1f752db075ee500e336c31301a" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal 0.2.2", + "bit-vec", + "byteorder", + "bytes", + "chrono", + "connection-string", + "either", + "futures", + "hex", + "libsqlite3-sys", + "lru-cache", + "metrics", + "mobc", + "mysql_async", + "native-tls", + "num_cpus", + "percent-encoding", + "postgres-native-tls", + "postgres-types", + "rusqlite", + "serde_json", + "thiserror", + "tiberius", + "tokio", + "tokio-postgres", + "tokio-util", + "tracing", + "tracing-core", + "url", + "uuid", +] + +[[package]] +name = "query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "indexmap", + "itertools 0.10.3", + "prisma-models", + "prisma-value", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid", +] + +[[package]] +name = "query-core" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal 0.2.2", + "chrono", + "connection-string", + "crossbeam-queue 0.2.3", + "cuid", + "datamodel", + "datamodel-connector", + "futures", + "im", + "indexmap", + "itertools 0.10.3", + "mongodb-client", + "mongodb-query-connector", + "once_cell", + "petgraph 0.4.13", + "pin-utils", + "prisma-inflector", + "prisma-models", + "prisma-value", + "query-connector", + "serde", + "serde_json", + "sql-query-connector", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "user-facing-errors", + "uuid", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -4786,6 +6083,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + [[package]] name = "rand" version = "0.7.3" @@ -4916,7 +6219,7 @@ checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils", + "crossbeam-utils 0.8.5", "lazy_static", "num_cpus", ] @@ -5049,13 +6352,35 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "request-handlers" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "connection-string", + "datamodel", + "dmmf", + "futures", + "graphql-parser", + "indexmap", + "itertools 0.10.3", + "query-core", + "serde", + "serde_json", + "thiserror", + "tracing", + "url", + "user-facing-errors", +] + [[package]] name = "resolv-conf" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname", + "hostname 0.3.1", "quick-error", ] @@ -5118,7 +6443,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b861ecaade43ac97886a512b360d01d66be9f41f3c61088b42cedf92e03d678" dependencies = [ - "base64", + "base64 0.13.0", "bitflags 1.3.2", "serde", ] @@ -5145,6 +6470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152" dependencies = [ "bitflags 1.3.2", + "chrono", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -5159,10 +6485,10 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ - "base64", + "base64 0.13.0", "blake2b_simd", "constant_time_eq", - "crossbeam-utils", + "crossbeam-utils 0.8.5", ] [[package]] @@ -5192,12 +6518,27 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-serialize" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.3.3" @@ -5222,7 +6563,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64", + "base64 0.13.0", "log", "ring 0.16.20", "sct 0.6.1", @@ -5241,6 +6582,15 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -5282,6 +6632,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + [[package]] name = "schannel" version = "0.1.19" @@ -5292,6 +6648,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "schema-ast" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "pest", + "pest_derive", +] + [[package]] name = "scoped-tls" version = "1.0.0" @@ -5335,7 +6701,7 @@ name = "sdcorelib" version = "0.1.0" dependencies = [ "anyhow", - "base64", + "base64 0.13.0", "bytesize", "cargo-edit", "chrono", @@ -5343,14 +6709,16 @@ dependencies = [ "data-encoding", "env_logger", "futures", - "hostname", + "hostname 0.3.1", "hotwatch", + "include_dir", "int-enum", "lazy_static", "libp2p", "log", "mime", "once_cell", + "prisma-client-rust", "rebind", "refinery", "ring 0.17.0-alpha.11", @@ -5498,13 +6866,22 @@ dependencies = [ "thin-slice", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser", + "semver-parser 0.10.2", ] [[package]] @@ -5516,6 +6893,12 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "semver-parser" version = "0.10.2" @@ -5527,18 +6910,27 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.132" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] [[package]] -name = "serde_derive" -version = "1.0.132" +name = "serde_bytes" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" +checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -5547,9 +6939,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.73" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ "indexmap", "itoa 1.0.1", @@ -5580,6 +6972,29 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc" +dependencies = [ + "rustversion", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" +dependencies = [ + "darling 0.13.1", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "servo_arc" version = "0.1.1" @@ -5615,6 +7030,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha-1" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + [[package]] name = "sha2" version = "0.9.8" @@ -5686,6 +7112,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook" version = "0.3.13" @@ -5717,6 +7149,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" +[[package]] +name = "sized-chunks" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f01db57d7ee89c8e053245deb77040a6cc8508311f381c88749c33d4b9b78785" +dependencies = [ + "typenum", +] + [[package]] name = "slab" version = "0.4.5" @@ -5769,9 +7210,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi 0.3.9", @@ -5795,7 +7236,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "flate2", "futures", @@ -5825,7 +7266,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-std", - "base64", + "base64 0.13.0", "cargo-edit", "chrono", "data-encoding", @@ -5843,7 +7284,6 @@ dependencies = [ "swift-rs", "tauri", "tauri-build", - "tauri-plugin-shadows", "tokio", ] @@ -5859,7 +7299,51 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" dependencies = [ - "lock_api", + "lock_api 0.4.6", +] + +[[package]] +name = "sql-datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "datamodel-connector", + "enumflags2 0.7.3", + "native-types", + "once_cell", + "regex", + "serde_json", +] + +[[package]] +name = "sql-query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "futures", + "itertools 0.10.3", + "once_cell", + "opentelemetry", + "prisma-models", + "prisma-value", + "quaint", + "query-connector", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-opentelemetry", + "user-facing-errors", + "uuid", ] [[package]] @@ -5897,8 +7381,8 @@ dependencies = [ "chrono", "crc", "crossbeam-channel", - "crossbeam-queue", - "crossbeam-utils", + "crossbeam-queue 0.3.2", + "crossbeam-utils 0.8.5", "either", "futures-channel", "futures-core", @@ -5912,7 +7396,7 @@ dependencies = [ "libsqlite3-sys", "log", "memchr", - "num-bigint", + "num-bigint 0.3.3", "once_cell", "parking_lot 0.11.2", "percent-encoding", @@ -6032,6 +7516,12 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "structopt" version = "0.3.25" @@ -6120,7 +7610,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e31aa5c69d3be879a07d9a0eb0ad1a424301849061fff96294569b61dd137d2f" dependencies = [ - "base64", + "base64 0.13.0", "serde", "serde_json", ] @@ -6200,6 +7690,12 @@ dependencies = [ "version-compare", ] +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" + [[package]] name = "tao" version = "0.5.2" @@ -6239,6 +7735,12 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tar" version = "0.4.38" @@ -6256,7 +7758,7 @@ version = "1.0.0-beta.8" source = "git+https://github.com/tauri-apps/tauri?branch=next#e784ebca9f5513ce07b63c15ccac4f51c14efe2f" dependencies = [ "attohttpc", - "base64", + "base64 0.13.0", "bincode", "cfg_aliases", "dirs-next", @@ -6341,17 +7843,6 @@ dependencies = [ "tauri-codegen", ] -[[package]] -name = "tauri-plugin-shadows" -version = "0.0.0" -source = "git+https://github.com/tauri-apps/tauri-plugin-shadows#bf34e300d238ea4519dab3220ff8c76f07701a93" -dependencies = [ - "cocoa", - "objc", - "tauri", - "windows 0.29.0", -] - [[package]] name = "tauri-runtime" version = "0.2.1" @@ -6535,6 +8026,38 @@ dependencies = [ "webp", ] +[[package]] +name = "tiberius" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00035fdbcee3e791e756d1831a1b9a89e414c320d3eccdae65aba4f388216c30" +dependencies = [ + "async-native-tls", + "async-trait", + "asynchronous-codec 0.5.0", + "bigdecimal 0.2.2", + "byteorder", + "bytes", + "chrono", + "connection-string", + "encoding", + "enumflags2 0.7.3", + "futures", + "futures-sink", + "futures-util", + "num-traits", + "once_cell", + "opentls", + "pin-project-lite 0.2.7", + "pretty-hex", + "thiserror", + "tokio", + "tokio-util", + "tracing", + "uuid", + "winauth", +] + [[package]] name = "tiff" version = "0.7.1" @@ -6556,6 +8079,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +dependencies = [ + "libc", + "num_threads", +] + [[package]] name = "tinyvec" version = "1.5.1" @@ -6573,14 +8106,87 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ "bytes", + "libc", "memchr", + "mio 0.8.0", "num_cpus", "pin-project-lite 0.2.7", + "socket2 0.4.4", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "git+https://github.com/pimeys/tls?branch=vendored-openssl#6d0e6fc7a4bf6f290b1033764b47cb3f26d7fceb" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-postgres" +version = "0.7.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures", + "log", + "parking_lot 0.11.2", + "percent-encoding", + "phf 0.8.0", + "pin-project-lite 0.2.7", + "postgres-protocol", + "postgres-types", + "socket2 0.4.4", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls 0.19.1", + "tokio", + "webpki 0.21.4", +] + +[[package]] +name = "tokio-util" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "log", + "pin-project-lite 0.2.7", + "tokio", ] [[package]] @@ -6598,7 +8204,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30834716e93eef7db510648299f647427858e7e2c0beeec2699ea2289c7739" dependencies = [ - "combine", + "combine 4.6.2", "indexmap", "itertools 0.10.3", "serde", @@ -6638,6 +8244,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project 1.0.10", + "tracing", +] + [[package]] name = "tracing-log" version = "0.1.2" @@ -6649,6 +8265,19 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ffbf13a0f8b054a4e59df3a173b818e9c6177c02789871f2073977fd0062076" +dependencies = [ + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + [[package]] name = "tracing-subscriber" version = "0.3.5" @@ -6688,6 +8317,7 @@ dependencies = [ "smallvec", "thiserror", "tinyvec", + "tokio", "url", ] @@ -6707,6 +8337,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", + "tokio", "trust-dns-proto", ] @@ -6733,6 +8364,28 @@ dependencies = [ "termcolor", ] +[[package]] +name = "twox-hash" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" +dependencies = [ + "cfg-if 1.0.0", + "rand 0.8.4", + "static_assertions", +] + +[[package]] +name = "typed-builder" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a46ee5bd706ff79131be9c94e7edcb82b703c487766a114434e5790361cf08c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "typenum" version = "1.15.0" @@ -6796,6 +8449,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unindent" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8" + [[package]] name = "universal-hash" version = "0.4.1" @@ -6806,13 +8465,22 @@ dependencies = [ "subtle", ] +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + [[package]] name = "unsigned-varint" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures-io", "futures-util", @@ -6830,7 +8498,7 @@ version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b8b063c2d59218ae09f22b53c42eaad0d53516457905f5235ca4bc9e99daa71" dependencies = [ - "base64", + "base64 0.13.0", "chunked_transfer", "log", "once_cell", @@ -6857,6 +8525,30 @@ dependencies = [ "serde", ] +[[package]] +name = "user-facing-error-macros" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "user-facing-errors" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "backtrace", + "indoc", + "quaint", + "serde", + "serde_json", + "tracing", + "user-facing-error-macros", +] + [[package]] name = "utf-8" version = "0.7.6" @@ -6950,9 +8642,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -6960,9 +8652,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -6987,9 +8679,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6997,9 +8689,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -7010,9 +8702,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "wasm-timer" @@ -7261,6 +8953,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winauth" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f820cd208ce9c6b050812dc2d724ba98c6c1e9db5ce9b3f58d925ae5723a5e6" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "md5", + "rand 0.7.3", + "winapi 0.3.9", +] + [[package]] name = "windows" version = "0.24.0" @@ -7456,6 +9161,15 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "winutil" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "wry" version = "0.12.2" @@ -7495,6 +9209,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129e027ad65ce1453680623c3fb5163cbf7107bfe1aa32257e7d0e63f9ced188" +dependencies = [ + "tap", +] + [[package]] name = "x11-dl" version = "2.19.1" @@ -7564,7 +9287,7 @@ dependencies = [ "async-io", "byteorder", "derivative", - "enumflags2", + "enumflags2 0.6.4", "fastrand", "futures", "nb-connect", @@ -7622,7 +9345,7 @@ dependencies = [ "crc32fast", "flate2", "thiserror", - "time", + "time 0.1.43", ] [[package]] @@ -7661,7 +9384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525" dependencies = [ "byteorder", - "enumflags2", + "enumflags2 0.6.4", "libc", "serde", "static_assertions", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 2fe95eaaf..86a2f7563 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -18,7 +18,7 @@ swift-rs = "0.2.3" tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["api-all"] } swift-rs = "0.2.3" sdcorelib = { path = "../../../packages/core" } -tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] } +# tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] } # Universal Dependencies anyhow = "1.0.44" @@ -37,7 +37,7 @@ sha256 = "1.0.2" once_cell = "1.8.0" int-enum = "0.4.0" async-std = "1.10.0" -tokio = {version = "1.15.0", features= ["sync"] } +tokio = { version = "1.17.0", features = ["sync"] } [features] default = [ "custom-protocol" ] diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs index 781f121b5..246cff8f7 100644 --- a/apps/desktop/src-tauri/src/main.rs +++ b/apps/desktop/src-tauri/src/main.rs @@ -1,17 +1,18 @@ use sdcorelib; use tauri::api::path; use tauri::Manager; -use tauri_plugin_shadows::Shadows; +// use tauri_plugin_shadows::Shadows; mod commands; mod menu; -fn main() { +#[tokio::main] +async fn main() { + let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./")); + let mut core_receiver = sdcorelib::configure(data_dir).await; + tauri::Builder::default() .setup(|app| { - let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./")); - let mut core_receiver = sdcorelib::configure(data_dir); - let app = app.handle(); tauri::async_runtime::spawn(async move { diff --git a/packages/core/.gitignore b/packages/core/.gitignore index ea8c4bf7f..8742b31ae 100644 --- a/packages/core/.gitignore +++ b/packages/core/.gitignore @@ -1 +1,2 @@ /target +*.db* \ No newline at end of file diff --git a/packages/core/Cargo.lock b/packages/core/Cargo.lock index 57f63f251..cc01dfb90 100644 --- a/packages/core/Cargo.lock +++ b/packages/core/Cargo.lock @@ -129,6 +129,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + [[package]] name = "asn1_der" version = "0.7.5" @@ -213,6 +219,18 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-native-tls" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d57d4cec3c647232e1094dc013546c0b33ce785d8aeb251e1f20dfaf8a9a13fe" +dependencies = [ + "futures-util", + "native-tls", + "thiserror", + "url", +] + [[package]] name = "async-process" version = "1.3.0" @@ -252,7 +270,7 @@ dependencies = [ "async-io", "async-lock", "async-process", - "crossbeam-utils", + "crossbeam-utils 0.8.7", "futures-channel", "futures-core", "futures-io", @@ -321,6 +339,19 @@ dependencies = [ "syn", ] +[[package]] +name = "asynchronous-codec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite 0.2.8", +] + [[package]] name = "asynchronous-codec" version = "0.6.0" @@ -403,18 +434,71 @@ dependencies = [ "syn", ] +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "bigdecimal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1e50562e37200edf7c6c43e54a08e64a5553bfb59d9c297d5572512aa517256" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "bigdecimal" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" +dependencies = [ + "num-bigint 0.4.3", + "num-integer", + "num-traits", +] + [[package]] name = "bimap" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bit_field" version = "0.10.1" @@ -433,6 +517,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2" version = "0.10.4" @@ -508,6 +604,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bson" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41539b5c502b7c4e7b8af8ef07e5c442fe79ceba62a2aad8e62bd589b9454745" +dependencies = [ + "ahash 0.7.6", + "base64 0.13.0", + "chrono", + "hex", + "indexmap", + "lazy_static", + "rand 0.8.5", + "serde", + "serde_bytes", + "serde_json", + "uuid", +] + [[package]] name = "bumpalo" version = "3.9.1" @@ -576,7 +691,7 @@ dependencies = [ "hex", "pathdiff", "regex", - "semver", + "semver 1.0.5", "serde", "serde_derive", "serde_json", @@ -605,7 +720,7 @@ checksum = "ba2ae6de944143141f6155a473a6b02f66c7c3f9f47316f802f80204ebfe6e12" dependencies = [ "camino", "cargo-platform", - "semver", + "semver 1.0.5", "serde", "serde_json", ] @@ -619,6 +734,15 @@ dependencies = [ "jobserver", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -666,7 +790,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", "winapi 0.3.9", ] @@ -685,6 +809,17 @@ dependencies = [ "generic-array 0.14.5", ] +[[package]] +name = "clang-sys" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "2.34.0" @@ -694,19 +829,61 @@ dependencies = [ "ansi_term", "atty", "bitflags 1.3.2", - "strsim", + "strsim 0.8.0", "term_size", "textwrap", "unicode-width", "vec_map", ] +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "cmake" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +dependencies = [ + "cc", +] + [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colored" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +dependencies = [ + "atty", + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + [[package]] name = "combine" version = "4.6.3" @@ -745,6 +922,16 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "connection-string" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4ecb0dc8c35d2c626e45ae70bbfcb1050b302f42bcdf025d913cc0c5a0b443" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -790,7 +977,7 @@ dependencies = [ "hex", "home", "memchr", - "semver", + "semver 1.0.5", "serde", "serde_derive", "serde_json", @@ -821,6 +1008,20 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue 0.3.4", + "crossbeam-utils 0.8.7", +] + [[package]] name = "crossbeam-channel" version = "0.5.2" @@ -828,7 +1029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.7", ] [[package]] @@ -839,7 +1040,7 @@ checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-utils 0.8.7", ] [[package]] @@ -849,12 +1050,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.7", "lazy_static", "memoffset", "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + [[package]] name = "crossbeam-queue" version = "0.3.4" @@ -862,7 +1074,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd435b205a4842da59efd07628f921c096bc1cc0a156835b4fa0bcb9a19bcce" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils", + "crossbeam-utils 0.8.7", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", ] [[package]] @@ -901,6 +1124,26 @@ dependencies = [ "subtle", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array 0.14.5", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.5", + "subtle", +] + [[package]] name = "ctor" version = "0.1.21" @@ -931,6 +1174,17 @@ dependencies = [ "rand 0.7.3", ] +[[package]] +name = "cuid" +version = "0.1.0" +source = "git+https://github.com/prisma/cuid-rust#4ffb2e47c772af62fed3ddc92bb7fc444d19e159" +dependencies = [ + "hostname 0.1.5", + "lazy_static", + "parking_lot 0.10.2", + "rand 0.7.3", +] + [[package]] name = "curve25519-dalek" version = "3.2.1" @@ -957,12 +1211,82 @@ dependencies = [ "zeroize", ] +[[package]] +name = "darling" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +[[package]] +name = "datamodel" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "chrono", + "datamodel-connector", + "diagnostics", + "dml", + "enumflags2", + "itertools 0.10.3", + "mongodb-datamodel-connector", + "once_cell", + "parser-database", + "pest", + "regex", + "schema-ast", + "serde", + "serde_json", + "sql-datamodel-connector", +] + +[[package]] +name = "datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "enumflags2", + "parser-database", + "serde_json", + "url", +] + [[package]] name = "deflate" version = "1.0.0" @@ -972,6 +1296,27 @@ dependencies = [ "adler32", ] +[[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 = "diagnostics" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "colored", + "pest", + "thiserror", +] + [[package]] name = "digest" version = "0.8.1" @@ -1031,6 +1376,33 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "dml" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "chrono", + "cuid", + "enumflags2", + "indoc", + "native-types", + "prisma-value", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "dmmf" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "datamodel", + "serde", + "serde_json", +] + [[package]] name = "dns-parser" version = "0.8.0" @@ -1088,6 +1460,70 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +dependencies = [ + "encoding-index-japanese", + "encoding-index-korean", + "encoding-index-simpchinese", + "encoding-index-singlebyte", + "encoding-index-tradchinese", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" + [[package]] name = "enum-as-inner" version = "0.3.3" @@ -1100,6 +1536,26 @@ dependencies = [ "syn", ] +[[package]] +name = "enumflags2" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25c90b056b3f84111cf183cbeddef0d3a0bbe9a674f057e1a1533c315f24def" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" version = "0.9.0" @@ -1190,10 +1646,16 @@ checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.10", "winapi 0.3.9", ] +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" + [[package]] name = "fixedbitset" version = "0.4.1" @@ -1232,6 +1694,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.0.1" @@ -1242,6 +1719,70 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frunk" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd67cf7d54b7e72d0ea76f3985c3747d74aee43e0218ad993b7903ba7a5395e" +dependencies = [ + "frunk_core", + "frunk_derives", + "frunk_proc_macros", +] + +[[package]] +name = "frunk_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1246cf43ec80bf8b2505b5c360b8fb999c97dabd17dbb604d85558d5cbc25482" + +[[package]] +name = "frunk_derives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dbc4f084ec5a3f031d24ccedeb87ab2c3189a2f33b8d070889073837d5ea09e" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99f11257f106c6753f5ffcb8e601fb39c390a088017aaa55b70c526bff15f63e" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a078bd8459eccbb85e0b007b8f756585762a72a9efc53f359b371c3b6351dbcc" +dependencies = [ + "frunk_core", + "frunk_proc_macros_impl", + "proc-macro-hack", +] + +[[package]] +name = "frunk_proc_macros_impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffba99f0fa4f57e42f57388fbb9a0ca863bc2b4261f3c5570fed579d5df6c32" +dependencies = [ + "frunk_core", + "frunk_proc_macro_helpers", + "proc-macro-hack", + "quote", + "syn", +] + [[package]] name = "fsevent" version = "0.4.0" @@ -1277,6 +1818,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" + [[package]] name = "futures" version = "0.3.21" @@ -1327,7 +1874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e" dependencies = [ "futures-core", - "lock_api", + "lock_api 0.4.6", "parking_lot 0.11.2", ] @@ -1512,6 +2059,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "graphql-parser" +version = "0.3.0" +source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3" +dependencies = [ + "combine 3.8.1", + "indexmap", + "thiserror", +] + [[package]] name = "half" version = "1.8.2" @@ -1584,7 +2141,27 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac", + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", "digest 0.9.0", ] @@ -1596,7 +2173,7 @@ checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", "generic-array 0.14.5", - "hmac", + "hmac 0.8.1", ] [[package]] @@ -1608,6 +2185,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "hostname" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +dependencies = [ + "libc", + "winutil", +] + [[package]] name = "hostname" version = "0.3.1" @@ -1641,6 +2228,12 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -1680,6 +2273,17 @@ dependencies = [ "windows", ] +[[package]] +name = "im" +version = "13.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8db49f8bc08d5cc4e2bb0f7d25a6d1db2c79bc6f7d7c86c96c657eb3d214125f" +dependencies = [ + "rustc_version 0.2.3", + "sized-chunks", + "typenum", +] + [[package]] name = "image" version = "0.24.1" @@ -1700,6 +2304,26 @@ dependencies = [ "tiff", ] +[[package]] +name = "include_dir" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482a2e29200b7eed25d7fdbd14423326760b7f6658d21a4cf12d55a50713c69f" +dependencies = [ + "glob", + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e074c19deab2501407c91ba1860fa3d6820bfde307db6d8cb851b55a10be89b" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "indexmap" version = "1.8.0" @@ -1708,6 +2332,16 @@ checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown 0.11.2", + "serde", +] + +[[package]] +name = "indoc" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" +dependencies = [ + "unindent", ] [[package]] @@ -1912,6 +2546,79 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff" +[[package]] +name = "lexical" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34e981f88d060a67815388470172638f1af16b3a12e581cb75142f190161bf9" +dependencies = [ + "lexical-core", +] + +[[package]] +name = "lexical-core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3926d8f156019890be4abe5fd3785e0cff1001e06f59c597641fd513a5a284" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d066d004fa762d9da995ed21aa8845bb9f6e4265f540d716fb4b315197bf0e" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c92badda8cc0fc4f3d3cc1c30aaefafb830510c8781ce4e8669881f3ed53ac" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff669ccaae16ee33af90dc51125755efed17f1309626ba5c12052512b11e291" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b5186948c7b297abaaa51560f2581dae625e5ce7dfc2d8fdc56345adb6dc576" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece956492e0e40fd95ef8658a34d53a3b8c2015762fdcaaff2167b28de1f56ef" +dependencies = [ + "lexical-util", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.117" @@ -1932,6 +2639,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + [[package]] name = "libp2p" version = "0.43.0" @@ -2080,8 +2797,8 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f62943fba0b0dae02b87868620c52a581c54ec9fb04b5e195cf20313fc510c3" dependencies = [ - "asynchronous-codec", - "base64", + "asynchronous-codec 0.6.0", + "base64 0.13.0", "byteorder", "bytes", "fnv", @@ -2126,7 +2843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aead5ee2322a7b825c7633065370909c8383046f955cda5b56797e6904db7a72" dependencies = [ "arrayvec 0.5.2", - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "either", "fnv", @@ -2190,7 +2907,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures", "libp2p-core", @@ -2246,7 +2963,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures", "libp2p-core", @@ -2277,7 +2994,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "517be90a2ce60b6c3bdfe88f34cc789c61dafe6f694a7b45e644af7353880fa3" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "either", "futures", @@ -2303,7 +3020,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597e4a022dd2e168ce1218faf6b3aead5c427fb828eb4f982cef7c40d4b7f49e" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bimap", "futures", "futures-timer", @@ -2449,7 +3166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" dependencies = [ "arrayref", - "base64", + "base64 0.13.0", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -2542,6 +3259,15 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.6" @@ -2597,6 +3323,29 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "md-5" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "md5" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d" + [[package]] name = "memchr" version = "2.4.1" @@ -2612,6 +3361,21 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metrics" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b70227ece8711a1aa2f99655efd795d0cff297a5b9fe39645a93aacf6ad39d" +dependencies = [ + "metrics-core", +] + +[[package]] +name = "metrics-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c064b3a1ff41f4bf6c91185c8a0caeccf8a8a27e9d0f92cc54cf3dbec812f48" + [[package]] name = "mime" version = "0.3.16" @@ -2656,12 +3420,25 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +dependencies = [ + "libc", + "log", + "miow 0.3.7", + "ntapi", + "winapi 0.3.9", +] + [[package]] name = "mio-extras" version = "2.0.6" @@ -2670,7 +3447,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ "lazycell", "log", - "mio", + "mio 0.6.23", "slab", ] @@ -2686,6 +3463,133 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "mobc" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f76d2f2e2dcbb00a8d3b2b09f026a74a82693ea52cd071647aa6cfa7f1ff37e" +dependencies = [ + "async-trait", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "log", + "tokio", +] + +[[package]] +name = "mongodb" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bacb6f8cee6bf010d7bc57550d859f6a4ffe255eb8c9a7014637fe988eaece64" +dependencies = [ + "async-trait", + "base64 0.13.0", + "bitflags 1.3.2", + "bson", + "chrono", + "derivative", + "futures-core", + "futures-executor", + "futures-io", + "futures-util", + "hex", + "hmac 0.11.0", + "lazy_static", + "md-5", + "os_info", + "pbkdf2", + "percent-encoding", + "rand 0.8.5", + "rustls 0.19.1", + "rustls-pemfile", + "serde", + "serde_bytes", + "serde_with", + "sha-1 0.9.8", + "sha2 0.9.9", + "socket2 0.4.4", + "stringprep", + "strsim 0.10.0", + "take_mut", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "trust-dns-proto", + "trust-dns-resolver", + "typed-builder", + "uuid", + "version_check", + "webpki 0.21.4", + "webpki-roots 0.21.1", +] + +[[package]] +name = "mongodb-client" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "mongodb", + "once_cell", + "percent-encoding", + "thiserror", +] + +[[package]] +name = "mongodb-datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "datamodel-connector", + "enumflags2", + "native-types", + "once_cell", + "serde_json", +] + +[[package]] +name = "mongodb-query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "futures", + "indexmap", + "itertools 0.10.3", + "mongodb", + "mongodb-client", + "native-types", + "prisma-models", + "prisma-value", + "query-connector", + "rand 0.7.3", + "regex", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "user-facing-errors", + "uuid", +] + [[package]] name = "multiaddr" version = "0.14.0" @@ -2751,6 +3655,75 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "mysql_async" +version = "0.29.0" +source = "git+https://github.com/prisma/mysql_async?branch=vendored-openssl#650f07121681ada8a5baec3669197e5ce7e0e6d7" +dependencies = [ + "bytes", + "crossbeam", + "flate2", + "futures-core", + "futures-sink", + "futures-util", + "lazy_static", + "lru", + "mio 0.8.0", + "mysql_common", + "native-tls", + "once_cell", + "pem", + "percent-encoding", + "pin-project 1.0.10", + "serde", + "serde_json", + "socket2 0.4.4", + "thiserror", + "tokio", + "tokio-native-tls", + "tokio-util", + "twox-hash", + "url", + "uuid", +] + +[[package]] +name = "mysql_common" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4140827f2d12750de1e8755442577e4292a835f26ff2f659f0a380d1d71020b0" +dependencies = [ + "base64 0.13.0", + "bigdecimal 0.3.0", + "bindgen", + "bitflags 1.3.2", + "bitvec", + "byteorder", + "bytes", + "cc", + "cmake", + "crc32fast", + "flate2", + "frunk", + "lazy_static", + "lexical", + "num-bigint 0.4.3", + "num-traits", + "rand 0.8.5", + "regex", + "rust_decimal", + "saturating", + "serde", + "serde_json", + "sha-1 0.10.0", + "sha2 0.10.2", + "smallvec", + "subprocess", + "thiserror", + "time 0.3.7", + "uuid", +] + [[package]] name = "nanorand" version = "0.6.1" @@ -2760,6 +3733,33 @@ dependencies = [ "getrandom 0.2.4", ] +[[package]] +name = "native-tls" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "native-types" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "net2" version = "0.2.37" @@ -2878,12 +3878,21 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.6.23", "mio-extras", "walkdir", "winapi 0.3.9", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-bigint" version = "0.3.3" @@ -2895,6 +3904,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -2946,6 +3966,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.27.1" @@ -2973,6 +4002,20 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +dependencies = [ + "bitflags 1.3.2", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + [[package]] name = "openssl-probe" version = "0.1.5" @@ -2992,6 +4035,38 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf9b1c4e9a6c4de793c632496fa490bdc0e1eea73f0c91394f7b6990935d22" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project 1.0.10", + "rand 0.8.5", + "thiserror", + "tokio", +] + +[[package]] +name = "opentls" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f561874f8d6ecfb674fc08863414040c93cc90c0b6963fe679895fab8b65560" +dependencies = [ + "futures-util", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "url", +] + [[package]] name = "ordered-multimap" version = "0.3.1" @@ -3002,6 +4077,22 @@ dependencies = [ "hashbrown 0.9.1", ] +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" + +[[package]] +name = "os_info" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023df84d545ef479cf67fd2f4459a613585c9db4852c2fad12ab70587859d340" +dependencies = [ + "log", + "winapi 0.3.9", +] + [[package]] name = "ouroboros" version = "0.14.2" @@ -3047,6 +4138,16 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -3054,7 +4155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api", + "lock_api 0.4.6", "parking_lot_core 0.8.5", ] @@ -3064,10 +4165,24 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ - "lock_api", + "lock_api 0.4.6", "parking_lot_core 0.9.1", ] +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi 0.3.9", +] + [[package]] name = "parking_lot_core" version = "0.8.5" @@ -3077,7 +4192,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.10", "smallvec", "winapi 0.3.9", ] @@ -3090,11 +4205,22 @@ checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.10", "smallvec", "windows-sys", ] +[[package]] +name = "parser-database" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "enumflags2", + "indexmap", + "schema-ast", +] + [[package]] name = "paste" version = "1.0.6" @@ -3107,6 +4233,30 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pem" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -3156,16 +4306,44 @@ dependencies = [ "sha-1 0.8.2", ] +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +dependencies = [ + "fixedbitset 0.1.9", + "ordermap", +] + [[package]] name = "petgraph" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ - "fixedbitset", + "fixedbitset 0.4.1", "indexmap", ] +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "0.4.29" @@ -3314,12 +4492,125 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "postgres-native-tls" +version = "0.5.0" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "futures", + "native-tls", + "tokio", + "tokio-native-tls", + "tokio-postgres", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "base64 0.13.0", + "byteorder", + "bytes", + "fallible-iterator", + "hmac 0.10.1", + "md-5", + "memchr", + "rand 0.8.5", + "sha2 0.9.9", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "bit-vec", + "bytes", + "chrono", + "fallible-iterator", + "postgres-protocol", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "ppv-lite86" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +[[package]] +name = "pretty-hex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c" + +[[package]] +name = "prisma-client-rust" +version = "0.3.0" +source = "git+https://github.com/Brendonovich/prisma-client-rust.git?branch=master#5a10f2e92d335e04f6b6853a6d0061dc2404f204" +dependencies = [ + "chrono", + "datamodel", + "graphql-parser", + "prisma-models", + "query-core", + "request-handlers", + "serde", + "serde_json", +] + +[[package]] +name = "prisma-inflector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "once_cell", + "regex", + "unicode-segmentation", +] + +[[package]] +name = "prisma-models" +version = "0.0.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "itertools 0.10.3", + "once_cell", + "prisma-value", + "quaint", + "rand 0.7.3", + "serde", + "serde_derive", + "serde_json", + "thiserror", + "uuid", +] + +[[package]] +name = "prisma-value" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "base64 0.12.3", + "bigdecimal 0.2.2", + "chrono", + "once_cell", + "quaint", + "regex", + "serde", + "serde_derive", + "serde_json", + "uuid", +] + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -3363,6 +4654,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + [[package]] name = "proc-macro2" version = "1.0.36" @@ -3417,7 +4714,7 @@ dependencies = [ "lazy_static", "log", "multimap", - "petgraph", + "petgraph 0.6.0", "prost", "prost-types", "regex", @@ -3457,6 +4754,104 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "quaint" +version = "0.2.0-alpha.13" +source = "git+https://github.com/prisma/quaint#0b9aa168f5d25b1f752db075ee500e336c31301a" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal 0.2.2", + "bit-vec", + "byteorder", + "bytes", + "chrono", + "connection-string", + "either", + "futures", + "hex", + "libsqlite3-sys", + "lru-cache", + "metrics", + "mobc", + "mysql_async", + "native-tls", + "num_cpus", + "percent-encoding", + "postgres-native-tls", + "postgres-types", + "rusqlite", + "serde_json", + "thiserror", + "tiberius", + "tokio", + "tokio-postgres", + "tokio-util", + "tracing", + "tracing-core", + "url", + "uuid", +] + +[[package]] +name = "query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "indexmap", + "itertools 0.10.3", + "prisma-models", + "prisma-value", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid", +] + +[[package]] +name = "query-core" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal 0.2.2", + "chrono", + "connection-string", + "crossbeam-queue 0.2.3", + "cuid", + "datamodel", + "datamodel-connector", + "futures", + "im", + "indexmap", + "itertools 0.10.3", + "mongodb-client", + "mongodb-query-connector", + "once_cell", + "petgraph 0.4.13", + "pin-utils", + "prisma-inflector", + "prisma-models", + "prisma-value", + "query-connector", + "serde", + "serde_json", + "sql-query-connector", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "user-facing-errors", + "uuid", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -3483,6 +4878,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + [[package]] name = "rand" version = "0.7.3" @@ -3574,7 +4975,7 @@ checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils", + "crossbeam-utils 0.8.7", "lazy_static", "num_cpus", ] @@ -3592,6 +4993,12 @@ dependencies = [ "rustc-serialize", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.2.10" @@ -3608,7 +5015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom 0.2.4", - "redox_syscall", + "redox_syscall 0.2.10", ] [[package]] @@ -3681,13 +5088,35 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "request-handlers" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "bigdecimal 0.2.2", + "connection-string", + "datamodel", + "dmmf", + "futures", + "graphql-parser", + "indexmap", + "itertools 0.10.3", + "query-core", + "serde", + "serde_json", + "thiserror", + "tracing", + "url", + "user-facing-errors", +] + [[package]] name = "resolv-conf" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname", + "hostname 0.3.1", "quick-error", ] @@ -3727,7 +5156,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b861ecaade43ac97886a512b360d01d66be9f41f3c61088b42cedf92e03d678" dependencies = [ - "base64", + "base64 0.13.0", "bitflags 1.3.2", "serde", ] @@ -3754,6 +5183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152" dependencies = [ "bitflags 1.3.2", + "chrono", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -3789,19 +5219,34 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-serialize" version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.5", ] [[package]] @@ -3810,7 +5255,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64", + "base64 0.13.0", "log", "ring 0.16.20", "sct 0.6.1", @@ -3829,6 +5274,15 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -3870,6 +5324,32 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "schema-ast" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "diagnostics", + "pest", + "pest_derive", +] + [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -3907,7 +5387,7 @@ name = "sdcorelib" version = "0.1.0" dependencies = [ "anyhow", - "base64", + "base64 0.13.0", "bytesize", "cargo-edit", "chrono", @@ -3915,14 +5395,16 @@ dependencies = [ "data-encoding", "env_logger", "futures", - "hostname", + "hostname 0.3.1", "hotwatch", + "include_dir", "int-enum", "lazy_static", "libp2p", "log", "mime", "once_cell", + "prisma-client-rust", "rebind", "refinery", "ring 0.17.0-alpha.11", @@ -4027,6 +5509,38 @@ dependencies = [ "syn", ] +[[package]] +name = "security-framework" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +dependencies = [ + "bitflags 1.3.2", + "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 = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.5" @@ -4036,6 +5550,12 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.136" @@ -4045,6 +5565,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.136" @@ -4068,6 +5597,29 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc" +dependencies = [ + "rustversion", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -4093,6 +5645,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha-1" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + [[package]] name = "sha2" version = "0.9.9" @@ -4145,6 +5708,21 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "476a6f59085a3b8ba2d1127d3f3d9d3b100bbc60301a6a557a405313ea99096f" +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook" version = "0.3.13" @@ -4176,6 +5754,15 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e" +[[package]] +name = "sized-chunks" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f01db57d7ee89c8e053245deb77040a6cc8508311f381c88749c33d4b9b78785" +dependencies = [ + "typenum", +] + [[package]] name = "slab" version = "0.4.5" @@ -4210,7 +5797,7 @@ dependencies = [ "curve25519-dalek 4.0.0-pre.2", "rand_core 0.6.3", "ring 0.16.20", - "rustc_version", + "rustc_version 0.4.0", "sha2 0.10.2", "subtle", ] @@ -4254,7 +5841,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "flate2", "futures", @@ -4276,7 +5863,51 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" dependencies = [ - "lock_api", + "lock_api 0.4.6", +] + +[[package]] +name = "sql-datamodel-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "datamodel-connector", + "enumflags2", + "native-types", + "once_cell", + "regex", + "serde_json", +] + +[[package]] +name = "sql-query-connector" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal 0.2.2", + "chrono", + "cuid", + "datamodel", + "futures", + "itertools 0.10.3", + "once_cell", + "opentelemetry", + "prisma-models", + "prisma-value", + "quaint", + "query-connector", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-opentelemetry", + "user-facing-errors", + "uuid", ] [[package]] @@ -4314,8 +5945,8 @@ dependencies = [ "chrono", "crc", "crossbeam-channel", - "crossbeam-queue", - "crossbeam-utils", + "crossbeam-queue 0.3.4", + "crossbeam-utils 0.8.7", "either", "futures-channel", "futures-core", @@ -4329,7 +5960,7 @@ dependencies = [ "libsqlite3-sys", "log", "memchr", - "num-bigint", + "num-bigint 0.3.3", "once_cell", "parking_lot 0.11.2", "percent-encoding", @@ -4408,6 +6039,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "structopt" version = "0.3.26" @@ -4475,7 +6112,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e31aa5c69d3be879a07d9a0eb0ad1a424301849061fff96294569b61dd137d2f" dependencies = [ - "base64", + "base64 0.13.0", "serde", "serde_json", ] @@ -4524,6 +6161,18 @@ dependencies = [ "libc", ] +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.3.0" @@ -4533,7 +6182,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall", + "redox_syscall 0.2.10", "remove_dir_all", "winapi 0.3.9", ] @@ -4587,6 +6236,15 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + [[package]] name = "threadpool" version = "1.8.1" @@ -4610,6 +6268,38 @@ dependencies = [ "webp", ] +[[package]] +name = "tiberius" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00035fdbcee3e791e756d1831a1b9a89e414c320d3eccdae65aba4f388216c30" +dependencies = [ + "async-native-tls", + "async-trait", + "asynchronous-codec 0.5.0", + "bigdecimal 0.2.2", + "byteorder", + "bytes", + "chrono", + "connection-string", + "encoding", + "enumflags2", + "futures", + "futures-sink", + "futures-util", + "num-traits", + "once_cell", + "opentls", + "pin-project-lite 0.2.8", + "pretty-hex", + "thiserror", + "tokio", + "tokio-util", + "tracing", + "uuid", + "winauth", +] + [[package]] name = "tiff" version = "0.7.1" @@ -4631,6 +6321,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +dependencies = [ + "libc", + "num_threads", +] + [[package]] name = "tinyvec" version = "1.5.1" @@ -4648,13 +6348,87 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.16.1" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ "bytes", + "libc", "memchr", + "mio 0.8.0", + "num_cpus", "pin-project-lite 0.2.8", + "socket2 0.4.4", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "git+https://github.com/pimeys/tls?branch=vendored-openssl#6d0e6fc7a4bf6f290b1033764b47cb3f26d7fceb" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-postgres" +version = "0.7.1" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures", + "log", + "parking_lot 0.11.2", + "percent-encoding", + "phf", + "pin-project-lite 0.2.8", + "postgres-protocol", + "postgres-types", + "socket2 0.4.4", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls 0.19.1", + "tokio", + "webpki 0.21.4", +] + +[[package]] +name = "tokio-util" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "log", + "pin-project-lite 0.2.8", + "tokio", ] [[package]] @@ -4672,7 +6446,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30834716e93eef7db510648299f647427858e7e2c0beeec2699ea2289c7739" dependencies = [ - "combine", + "combine 4.6.3", "indexmap", "itertools 0.10.3", "serde", @@ -4710,6 +6484,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23" dependencies = [ "lazy_static", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project 1.0.10", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ffbf13a0f8b054a4e59df3a173b818e9c6177c02789871f2073977fd0062076" +dependencies = [ + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", ] [[package]] @@ -4733,6 +6553,7 @@ dependencies = [ "smallvec", "thiserror", "tinyvec", + "tokio", "url", ] @@ -4752,6 +6573,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", + "tokio", "trust-dns-proto", ] @@ -4778,6 +6600,28 @@ dependencies = [ "termcolor", ] +[[package]] +name = "twox-hash" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" +dependencies = [ + "cfg-if 1.0.0", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typed-builder" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a46ee5bd706ff79131be9c94e7edcb82b703c487766a114434e5790361cf08c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "typenum" version = "1.15.0" @@ -4841,6 +6685,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unindent" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8" + [[package]] name = "universal-hash" version = "0.4.1" @@ -4851,13 +6701,22 @@ dependencies = [ "subtle", ] +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + [[package]] name = "unsigned-varint" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.0", "bytes", "futures-io", "futures-util", @@ -4875,7 +6734,7 @@ version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b8b063c2d59218ae09f22b53c42eaad0d53516457905f5235ca4bc9e99daa71" dependencies = [ - "base64", + "base64 0.13.0", "chunked_transfer", "log", "once_cell", @@ -4901,6 +6760,30 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "user-facing-error-macros" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "user-facing-errors" +version = "0.1.0" +source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" +dependencies = [ + "backtrace", + "indoc", + "quaint", + "serde", + "serde_json", + "tracing", + "user-facing-error-macros", +] + [[package]] name = "uuid" version = "0.8.2" @@ -4911,6 +6794,12 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "value-bag" version = "1.0.0-alpha.8" @@ -5204,6 +7093,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winauth" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f820cd208ce9c6b050812dc2d724ba98c6c1e9db5ce9b3f58d925ae5723a5e6" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "md5", + "rand 0.7.3", + "winapi 0.3.9", +] + [[package]] name = "windows" version = "0.29.0" @@ -5299,6 +7201,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "winutil" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -5309,6 +7220,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129e027ad65ce1453680623c3fb5163cbf7107bfe1aa32257e7d0e63f9ced188" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "1.2.0" diff --git a/packages/core/Cargo.toml b/packages/core/Cargo.toml index 40ee5ad24..37fc51e15 100644 --- a/packages/core/Cargo.toml +++ b/packages/core/Cargo.toml @@ -33,6 +33,7 @@ rusqlite = "0.25.3" refinery = { version = "0.6.0", features = ["rusqlite"] } sqlx = { version = "0.5.7", features = ["sqlite"] } sea-orm = { version = "^0.6.0", features = [ "sqlx-sqlite", "runtime-async-std-rustls", "macros", "debug-print"], default-features = false } +prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", branch = "master" } walkdir = "^2.3.2" bytesize = "1.1.0" env_logger = "0.9.0" @@ -43,4 +44,5 @@ uuid = "0.8" thumbnailer = "0.4.0" mime = "0.3.16" -tokio = {version = "1.15.0", features=["sync"]} \ No newline at end of file +tokio = { version = "1.17.0", features = ["sync", "rt"] } +include_dir = {version = "0.7.2", features = ["glob"]} diff --git a/packages/core/prisma/migrations/20220303102833_/migration.sql b/packages/core/prisma/migrations/20220303102833_/migration.sql new file mode 100644 index 000000000..ffa7a9dd5 --- /dev/null +++ b/packages/core/prisma/migrations/20220303102833_/migration.sql @@ -0,0 +1,117 @@ +-- CreateTable +CREATE TABLE "libraries" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "uuid" TEXT NOT NULL, + "name" TEXT NOT NULL, + "remote_id" TEXT, + "is_primary" BOOLEAN NOT NULL DEFAULT true, + "encryption" INTEGER NOT NULL DEFAULT 0, + "total_file_count" INTEGER NOT NULL DEFAULT 0, + "total_bytes_used" TEXT NOT NULL DEFAULT '0', + "total_byte_capacity" TEXT NOT NULL DEFAULT '0', + "total_unique_bytes" TEXT NOT NULL DEFAULT '0', + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "timezone" TEXT +); + +-- CreateTable +CREATE TABLE "clients" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "uuid" TEXT NOT NULL, + "name" TEXT NOT NULL, + "platform" INTEGER NOT NULL DEFAULT 0, + "version" TEXT, + "online" BOOLEAN DEFAULT true, + "last_seen" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "timezone" TEXT, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- CreateTable +CREATE TABLE "locations" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT, + "path" TEXT, + "total_capacity" INTEGER, + "available_capacity" INTEGER, + "is_removable" BOOLEAN NOT NULL DEFAULT true, + "is_ejectable" BOOLEAN NOT NULL DEFAULT true, + "is_root_filesystem" BOOLEAN NOT NULL DEFAULT true, + "is_online" BOOLEAN NOT NULL DEFAULT true, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- CreateTable +CREATE TABLE "files" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "is_dir" BOOLEAN NOT NULL DEFAULT false, + "location_id" INTEGER NOT NULL, + "materialized_path" TEXT NOT NULL, + "name" TEXT NOT NULL, + "extension" TEXT, + "path_integrity_hash" TEXT NOT NULL, + "quick_integrity_hash" TEXT, + "full_integrity_hash" TEXT, + "size_in_bytes" TEXT NOT NULL, + "encryption" INTEGER NOT NULL DEFAULT 0, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_indexed" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "ipfs_id" TEXT, + "parent_id" INTEGER, + CONSTRAINT "files_location_id_fkey" FOREIGN KEY ("location_id") REFERENCES "locations" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT "files_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "files" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "tags" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT, + "encryption" INTEGER DEFAULT 0, + "total_files" INTEGER DEFAULT 0, + "redundancy_goal" INTEGER DEFAULT 1, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- CreateTable +CREATE TABLE "tags_on_files" ( + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "tag_id" INTEGER NOT NULL, + "file_id" INTEGER NOT NULL, + + PRIMARY KEY ("tag_id", "file_id"), + CONSTRAINT "tags_on_files_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT "tags_on_files_tag_id_fkey" FOREIGN KEY ("tag_id") REFERENCES "tags" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +); + +-- CreateTable +CREATE TABLE "jobs" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "client_id" INTEGER NOT NULL, + "action" INTEGER NOT NULL, + "status" INTEGER NOT NULL DEFAULT 0, + "percentage_complete" INTEGER NOT NULL DEFAULT 0, + "task_count" INTEGER NOT NULL DEFAULT 1, + "completed_task_count" INTEGER NOT NULL DEFAULT 0, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "jobs_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "clients" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION +); + +-- CreateTable +CREATE TABLE "spaces" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT NOT NULL, + "encryption" INTEGER DEFAULT 0, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "libraryId" INTEGER, + CONSTRAINT "spaces_libraryId_fkey" FOREIGN KEY ("libraryId") REFERENCES "libraries" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); + +-- CreateIndex +CREATE UNIQUE INDEX "clients_uuid_key" ON "clients"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "files_path_integrity_hash_key" ON "files"("path_integrity_hash"); diff --git a/packages/core/prisma/migrations/migration_lock.toml b/packages/core/prisma/migrations/migration_lock.toml new file mode 100644 index 000000000..e5e5c4705 --- /dev/null +++ b/packages/core/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "sqlite" \ No newline at end of file diff --git a/packages/core/prisma/migrations/migration_table/migration.sql b/packages/core/prisma/migrations/migration_table/migration.sql new file mode 100644 index 000000000..b24c95e1e --- /dev/null +++ b/packages/core/prisma/migrations/migration_table/migration.sql @@ -0,0 +1,10 @@ +-- CreateTable +CREATE TABLE "_migrations" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" TEXT NOT NULL, + "checksum" TEXT NOT NULL, + "steps_applied" INTEGER NOT NULL DEFAULT 0, + "applied_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); +-- CreateIndex +CREATE UNIQUE INDEX "_migrations_checksum_key" ON "_migrations"("checksum"); \ No newline at end of file diff --git a/packages/core/prisma/schema.prisma b/packages/core/prisma/schema.prisma index 049c4086e..634d034ec 100644 --- a/packages/core/prisma/schema.prisma +++ b/packages/core/prisma/schema.prisma @@ -1,6 +1,21 @@ datasource db { provider = "sqlite" - url = "file:/Users/jamie/Library/Application Support/spacedrive/library.db" + url = "file:dev.db" +} + +generator client { + provider = "prisma-client-rust" + output = "../src/prisma.rs" +} + +model Migration { + id Int @id @default(autoincrement()) + name String + checksum String @unique + steps_applied Int @default(0) + applied_at DateTime @default(now()) + + @@map("_migrations") } model Library { @@ -23,7 +38,7 @@ model Library { model Client { id Int @id @default(autoincrement()) - uuid String @unique() + uuid String @unique name String platform Int @default(0) version String? @@ -53,53 +68,57 @@ model Location { } model File { - id Int @id @default(autoincrement()) - is_dir Boolean @default(false) - location_id Int - materialized_path String - name String - extension String? - meta_integrity_hash String @unique() - sampled_byte_integrity_hash String? - byte_integrity_hash String? - size_in_bytes String - encryption Int @default(0) - ipfs_id String? - date_created DateTime @default(now()) - date_modified DateTime @default(now()) - date_indexed DateTime @default(now()) - directory_id Int? - parent_id Int? - locations Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - files File? @relation("file_to_file_parent_id", fields: [parent_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - other_files File[] @relation("file_to_file_parent_id") - tags_files TagFile[] @ignore + id Int @id @default(autoincrement()) + is_dir Boolean @default(false) + location_id Int + materialized_path String + name String + extension String? + path_integrity_hash String @unique // combo of location_id, materialized_path, name, extension + quick_integrity_hash String? // 100 * 100 byte samples + full_integrity_hash String? // full byte to byte hash + size_in_bytes String + encryption Int @default(0) + date_created DateTime @default(now()) + date_modified DateTime @default(now()) + date_indexed DateTime @default(now()) + ipfs_id String? + location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction) + + parent File? @relation("directory_files", fields: [parent_id], references: [id]) + parent_id Int? + children File[] @relation("directory_files") + + file_tags TagOnFile[] @@map("files") } model Tag { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) name String? - encryption Int? @default(0) - total_files Int? @default(0) - redundancy_goal Int? @default(1) - date_created DateTime @default(now()) - date_modified DateTime @default(now()) - tags_files TagFile[] @ignore + encryption Int? @default(0) + total_files Int? @default(0) + redundancy_goal Int? @default(1) + date_created DateTime @default(now()) + date_modified DateTime @default(now()) + + tag_files TagOnFile[] @@map("tags") } -model TagFile { - tag_id Int - file_id Int +model TagOnFile { date_created DateTime @default(now()) - file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction) + + tag_id Int + tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction) + + file_id Int + file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction) @@id([tag_id, file_id]) - @@map("tags_files") + @@map("tags_on_files") } model Job { diff --git a/packages/core/src/db/connection.rs b/packages/core/src/db/connection.rs index 394f4cb13..5dfef1625 100644 --- a/packages/core/src/db/connection.rs +++ b/packages/core/src/db/connection.rs @@ -1,8 +1,14 @@ +use crate::file::checksum::sha256_digest; +use crate::prisma::{Migration, PrismaClient}; use crate::state::{self}; use anyhow::Result; +use data_encoding::HEXLOWER; +use include_dir::{include_dir, Dir}; use once_cell::sync::OnceCell; -use rusqlite::Connection; use sea_orm::{Database, DatabaseConnection}; +use sha256::digest; +use std::ffi::OsStr; +use std::io::{BufReader, Read}; pub static DB: OnceCell = OnceCell::new(); @@ -23,6 +29,10 @@ pub async fn db() -> Result<&'static DatabaseConnection, String> { .unwrap(); DB.set(db).unwrap_or_default(); + // TODO: Error handling when brendan adds it to prisma-client-rust + + // let client = PrismaClient::new_with_url(&format!("file:{}", &path)).await; + // DB.set(client).unwrap_or_default(); Ok(DB.get().unwrap()) } else { @@ -30,21 +40,136 @@ pub async fn db() -> Result<&'static DatabaseConnection, String> { } } -pub async fn init(db_url: &str) -> Result<(), sqlx::Error> { - // establish connection, this is only used to create the db if missing - // replace in future - let mut connection = Connection::open(&db_url).unwrap(); +const INIT_MIGRATION: &str = include_str!("../../prisma/migrations/migration_table/migration.sql"); +static MIGRATIONS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/prisma/migrations"); - // migrate db - mod embedded_primary { - use refinery::embed_migrations; - embed_migrations!("src/db/migrations"); +pub async fn init(db_url: &str) -> Result<(), sqlx::Error> { + let client = PrismaClient::new_with_url(&format!("file:{}", &db_url)).await; + + match client + ._query_raw::( + "SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'", + ) + .await + { + Ok(data) => { + if data.len() == 0 { + println!("Migration table does not exist"); + + client._execute_raw(INIT_MIGRATION).await; + + let value: Vec = client + ._query_raw( + "SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'", + ) + .await + .unwrap(); + + println!("Migration table created: {:?}", value); + } else { + println!("Migration table exists: {:?}", data); + } + + let mut migration_subdirs = MIGRATIONS_DIR + .dirs() + .filter(|subdir| { + subdir + .path() + .file_name() + .map(|name| name != OsStr::new("migration_table")) + .unwrap_or(false) + }) + .collect::>(); + + migration_subdirs.sort_by(|a, b| { + let a_name = a.path().file_name().unwrap().to_str().unwrap(); + let b_name = b.path().file_name().unwrap().to_str().unwrap(); + + let a_time = a_name[..15].parse::().unwrap(); + let b_time = b_name[..15].parse::().unwrap(); + + a_time.cmp(&b_time) + }); + + for subdir in migration_subdirs { + println!("{:?}", subdir.path()); + let migration_file = subdir + .get_file(subdir.path().join("./migration.sql")) + .unwrap(); + let migration_sql = migration_file.contents_utf8().unwrap(); + + let digest = sha256_digest(BufReader::new(migration_file.contents()))?; + // create a lowercase hash from + let checksum = HEXLOWER.encode(digest.as_ref()); + let name = subdir.path().file_name().unwrap().to_str().unwrap(); + + // get existing migration by checksum, if it doesn't exist run the migration + let existing_migration = client + .migration() + .find_unique(Migration::checksum().equals(checksum.clone())) + .exec() + .await; + + if existing_migration.is_none() { + println!("Running migration: {}", name); + + let steps = migration_sql.split(";").collect::>(); + let steps = &steps[0..steps.len() - 1]; + + client + .migration() + .create_one( + Migration::name().set(name.to_string()), + Migration::checksum().set(checksum.clone()), + vec![], + ) + .exec() + .await; + + for (i, step) in steps.iter().enumerate() { + match client._execute_raw(&format!("{};", step)).await { + Ok(_) => { + println!("Step {} ran successfully", i); + client + .migration() + .find_unique(Migration::checksum().equals(checksum.clone())) + .update(vec![Migration::steps_applied().set(i as i64 + 1)]) + .exec() + .await; + } + Err(e) => { + println!("Error running migration: {}", name); + println!("{}", e); + break; + } + } + } + + println!("Migration {} recorded successfully", name); + } else { + println!("Migration {} already exists", name); + } + } + } + Err(err) => { + panic!("Failed to check migration table existence: {:?}", err); + } } - embedded_primary::migrations::runner() - .run(&mut connection) - .unwrap(); + // // establish connection, this is only used to create the db if missing + // // replace in future + // let mut connection = Connection::open(&db_url).unwrap(); - connection.close().unwrap(); + // // migrate db + // mod embedded_primary { + // use refinery::embed_migrations; + // embed_migrations!("src/db/migrations"); + // }= + + // embedded_primary::migrations::runner() + // .run(&mut connection) + // .unwrap(); + + // connection.close().unwrap(); Ok(()) } diff --git a/packages/core/src/file/checksum.rs b/packages/core/src/file/checksum.rs index 6a9427804..dfab4346d 100644 --- a/packages/core/src/file/checksum.rs +++ b/packages/core/src/file/checksum.rs @@ -5,7 +5,7 @@ use std::io; use std::io::{BufReader, Read}; use std::time::Instant; -fn sha256_digest(mut reader: R) -> io::Result { +pub fn sha256_digest(mut reader: R) -> io::Result { let mut context = Context::new(&SHA256); let mut buffer = [0; 1024]; loop { diff --git a/packages/core/src/lib.rs b/packages/core/src/lib.rs index b41c7da7d..0fc8f2018 100644 --- a/packages/core/src/lib.rs +++ b/packages/core/src/lib.rs @@ -4,7 +4,9 @@ pub mod file; pub mod library; pub mod native; pub mod state; +pub mod tx; // pub mod p2p; +pub mod prisma; pub mod util; use futures::executor::block_on; @@ -59,7 +61,7 @@ pub async fn core_send_stream>(stream: T) { .await; } -pub fn configure(mut data_dir: std::path::PathBuf) -> mpsc::Receiver { +pub async fn configure(mut data_dir: std::path::PathBuf) -> mpsc::Receiver { data_dir = data_dir.join("spacedrive"); let (event_sender, event_receiver) = mpsc::channel(100); @@ -81,42 +83,41 @@ pub fn configure(mut data_dir: std::path::PathBuf) -> mpsc::Receiver { + println!("Created new library: {:?}", library); + } + Err(e) => { + println!("Error creating library: {:?}", e); + } + } + } else { + for library in client_config.libraries.iter() { + // init database for library + match library::loader::load(&library.library_path, &library.library_id).await { Ok(library) => { - println!("Created new library: {:?}", library); + println!("Loaded library: {:?}", library); } Err(e) => { - println!("Error creating library: {:?}", e); - } - } - } else { - for library in client_config.libraries.iter() { - // init database for library - match library::loader::load(&library.library_path, &library.library_id).await { - Ok(library) => { - println!("Loaded library: {:?}", library); - } - Err(e) => { - println!("Error loading library: {:?}", e); - } + println!("Error loading library: {:?}", e); } } } + } - // init client - match library::client::create().await { - Ok(_) => {} - Err(e) => { - println!("Error initializing client: {:?}", e); - } - }; - // activate p2p listeners - // p2p::listener::listen(None); - }); - + // init client + match library::client::create().await { + Ok(_) => {} + Err(e) => { + println!("Error initializing client: {:?}", e); + } + }; + // activate p2p listeners + // p2p::listener::listen(None); + println!("Spacedrive online"); // env_logger::builder() diff --git a/packages/core/src/prisma.rs b/packages/core/src/prisma.rs new file mode 100644 index 000000000..c28ba6437 --- /dev/null +++ b/packages/core/src/prisma.rs @@ -0,0 +1,10392 @@ +// Code generated by Prisma Client Rust. DO NOT EDIT. + +use prisma_client_rust::chrono; +use prisma_client_rust::datamodel::parse_configuration; +use prisma_client_rust::prisma_models::InternalDataModelBuilder; +use prisma_client_rust::query::*; +use prisma_client_rust::query_core::{ + executor, schema_builder, BuildMode, CoreError, QueryExecutor, QuerySchema, +}; +use prisma_client_rust::serde_json; +use prisma_client_rust::DeleteResult; +use serde::{Deserialize, Serialize}; +use std::path::Path; +use std::sync::Arc; +pub struct PrismaClient { + executor: Box, + query_schema: Arc, +} +impl PrismaClient { + pub async fn new() -> Self { + let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n path String?\n total_capacity Int?\n available_capacity Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n files File[]\n\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n location_id Int\n materialized_path String\n name String\n extension String?\n path_integrity_hash String @unique // combo of location_id, materialized_path, name, extension\n quick_integrity_hash String? // 100 * 100 byte samples\n full_integrity_hash String? // full byte to byte hash\n size_in_bytes String\n encryption Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n ipfs_id String?\n\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n parent File? @relation(\"directory_files\", fields: [parent_id], references: [id])\n parent_id Int?\n children File[] @relation(\"directory_files\")\n\n file_tags TagOnFile[]\n @@map(\"files\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Job {\n id Int @id @default(autoincrement())\n client_id Int\n action Int\n status Int @default(0)\n percentage_complete Int @default(0)\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n @@map(\"spaces\")\n}\n" ; + let config = parse_configuration(datamodel_str).unwrap().subject; + let source = config + .datasources + .first() + .expect("Pleasy supply a datasource in your schema.prisma file"); + let url = if let Some(url) = source.load_shadow_database_url().unwrap() { + url + } else { + source.load_url(|key| std::env::var(key).ok()).unwrap() + }; + let url = if url.starts_with("file:") { + let path = url.split(":").nth(1).unwrap(); + if Path::new("./schema.prisma").exists() { + url + } else if Path::new("./prisma/schema.prisma").exists() { + format!("file:./prisma/{}", path) + } else { + url + } + } else { + url + }; + let (db_name, executor) = executor::load(&source, &[], &url).await.unwrap(); + let internal_model = InternalDataModelBuilder::new(&datamodel_str).build(db_name); + let query_schema = Arc::new(schema_builder::build( + internal_model, + BuildMode::Modern, + true, + source.capabilities(), + vec![], + source.referential_integrity(), + )); + executor.primary_connector().get_connection().await.unwrap(); + Self { + executor, + query_schema, + } + } + pub async fn new_with_url(url: &str) -> Self { + let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n path String?\n total_capacity Int?\n available_capacity Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n files File[]\n\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n location_id Int\n materialized_path String\n name String\n extension String?\n path_integrity_hash String @unique // combo of location_id, materialized_path, name, extension\n quick_integrity_hash String? // 100 * 100 byte samples\n full_integrity_hash String? // full byte to byte hash\n size_in_bytes String\n encryption Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n ipfs_id String?\n\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n parent File? @relation(\"directory_files\", fields: [parent_id], references: [id])\n parent_id Int?\n children File[] @relation(\"directory_files\")\n\n file_tags TagOnFile[]\n @@map(\"files\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Job {\n id Int @id @default(autoincrement())\n client_id Int\n action Int\n status Int @default(0)\n percentage_complete Int @default(0)\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n @@map(\"spaces\")\n}\n" ; + let config = parse_configuration(datamodel_str).unwrap().subject; + let source = config + .datasources + .first() + .expect("Pleasy supply a datasource in your schema.prisma file"); + let (db_name, executor) = executor::load(&source, &[], &url).await.unwrap(); + let internal_model = InternalDataModelBuilder::new(&datamodel_str).build(db_name); + let query_schema = Arc::new(schema_builder::build( + internal_model, + BuildMode::Modern, + true, + source.capabilities(), + vec![], + source.referential_integrity(), + )); + executor.primary_connector().get_connection().await.unwrap(); + Self { + executor, + query_schema, + } + } + pub async fn _query_raw( + &self, + query: &str, + ) -> Result, CoreError> { + let query = Query { + ctx: QueryContext::new(&self.executor, self.query_schema.clone()), + operation: "mutation".into(), + method: "queryRaw".into(), + inputs: vec![ + Input { + name: "query".into(), + value: Some(query.into()), + ..Default::default() + }, + Input { + name: "parameters".into(), + value: Some("[]".into()), + ..Default::default() + }, + ], + name: "".into(), + model: "".into(), + outputs: vec![], + }; + query.perform().await + } + pub async fn _execute_raw(&self, query: &str) -> Result { + let query = Query { + ctx: QueryContext::new(&self.executor, self.query_schema.clone()), + operation: "mutation".into(), + method: "executeRaw".into(), + inputs: vec![ + Input { + name: "query".into(), + value: Some(query.into()), + ..Default::default() + }, + Input { + name: "parameters".into(), + value: Some("[]".into()), + ..Default::default() + }, + ], + name: "".into(), + model: "".into(), + outputs: vec![], + }; + query.perform().await.map(|result: i64| result) + } + pub fn migration(&self) -> MigrationActions { + MigrationActions { client: &self } + } + pub fn library(&self) -> LibraryActions { + LibraryActions { client: &self } + } + pub fn client(&self) -> ClientActions { + ClientActions { client: &self } + } + pub fn location(&self) -> LocationActions { + LocationActions { client: &self } + } + pub fn file(&self) -> FileActions { + FileActions { client: &self } + } + pub fn tag(&self) -> TagActions { + TagActions { client: &self } + } + pub fn tag_on_file(&self) -> TagOnFileActions { + TagOnFileActions { client: &self } + } + pub fn job(&self) -> JobActions { + JobActions { client: &self } + } + pub fn space(&self) -> SpaceActions { + SpaceActions { client: &self } + } +} +fn migration_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("checksum"), + Output::new("steps_applied"), + Output::new("applied_at"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct MigrationData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "checksum")] + pub checksum: String, + #[serde(rename = "steps_applied")] + pub steps_applied: i64, + #[serde(rename = "applied_at")] + pub applied_at: chrono::DateTime, +} +impl MigrationData {} +pub struct Migration; +impl Migration { + pub fn id() -> MigrationIdField { + MigrationIdField {} + } + pub fn name() -> MigrationNameField { + MigrationNameField {} + } + pub fn checksum() -> MigrationChecksumField { + MigrationChecksumField {} + } + pub fn steps_applied() -> MigrationStepsAppliedField { + MigrationStepsAppliedField {} + } + pub fn applied_at() -> MigrationAppliedAtField { + MigrationAppliedAtField {} + } + pub fn not(params: Vec) -> MigrationWhereParam { + MigrationWhereParam::Not(params) + } + pub fn or(params: Vec) -> MigrationWhereParam { + MigrationWhereParam::Or(params) + } + pub fn and(params: Vec) -> MigrationWhereParam { + MigrationWhereParam::And(params) + } +} +pub struct MigrationIdField {} +pub struct MigrationSetId(i64); +impl From for MigrationSetParam { + fn from(value: MigrationSetId) -> Self { + Self::Id(value.0) + } +} +impl MigrationIdField { + pub fn lt(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + MigrationSetId(value).into() + } +} +pub struct MigrationNameField {} +pub struct MigrationSetName(String); +impl From for MigrationSetParam { + fn from(value: MigrationSetName) -> Self { + Self::Name(value.0) + } +} +impl MigrationNameField { + pub fn contains(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + MigrationSetName(value).into() + } +} +pub struct MigrationChecksumField {} +pub struct MigrationSetChecksum(String); +impl From for MigrationSetParam { + fn from(value: MigrationSetChecksum) -> Self { + Self::Checksum(value.0) + } +} +impl MigrationChecksumField { + pub fn contains(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumContains(value) + } + pub fn has_prefix(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumHasSuffix(value) + } + pub fn equals(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumEquals(value) + } + pub fn set>(&self, value: String) -> T { + MigrationSetChecksum(value).into() + } +} +pub struct MigrationStepsAppliedField {} +pub struct MigrationSetStepsApplied(i64); +impl From for MigrationSetParam { + fn from(value: MigrationSetStepsApplied) -> Self { + Self::StepsApplied(value.0) + } +} +impl MigrationStepsAppliedField { + pub fn lt(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLT(value) + } + pub fn gt(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGT(value) + } + pub fn lte(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLTE(value) + } + pub fn gte(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGTE(value) + } + pub fn equals(&self, value: i64) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedEquals(value) + } + pub fn set>(&self, value: i64) -> T { + MigrationSetStepsApplied(value).into() + } +} +pub struct MigrationAppliedAtField {} +pub struct MigrationSetAppliedAt(chrono::DateTime); +impl From for MigrationSetParam { + fn from(value: MigrationSetAppliedAt) -> Self { + Self::AppliedAt(value.0) + } +} +impl MigrationAppliedAtField { + pub fn before(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + MigrationSetAppliedAt(value).into() + } +} +pub enum MigrationWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + ChecksumContains(String), + ChecksumHasPrefix(String), + ChecksumHasSuffix(String), + ChecksumEquals(String), + StepsAppliedLT(i64), + StepsAppliedGT(i64), + StepsAppliedLTE(i64), + StepsAppliedGTE(i64), + StepsAppliedEquals(i64), + AppliedAtBefore(chrono::DateTime), + AppliedAtAfter(chrono::DateTime), + AppliedAtBeforeEquals(chrono::DateTime), + AppliedAtAfterEquals(chrono::DateTime), + AppliedAtEquals(chrono::DateTime), + Not(Vec), + Or(Vec), + And(Vec), +} +impl MigrationWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumContains(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumHasPrefix(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumHasSuffix(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumEquals(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedLT(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedGT(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedLTE(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedGTE(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedEquals(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtBefore(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtAfter(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtBeforeEquals(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtAfterEquals(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtEquals(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct MigrationWith { + pub param: MigrationWithParam, +} +pub enum MigrationWithParam {} +impl From for MigrationWith { + fn from(param: MigrationWithParam) -> Self { + Self { param } + } +} +impl MigrationWithParam { + pub fn output(self) -> Output { + match self {} + } +} +pub enum MigrationSetParam { + Id(i64), + Name(String), + Checksum(String), + StepsApplied(i64), + AppliedAt(chrono::DateTime), +} +impl MigrationSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Checksum(value) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::StepsApplied(value) => Field { + name: "steps_applied".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::AppliedAt(value) => Field { + name: "applied_at".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub struct MigrationFindMany<'a> { + query: Query<'a>, +} +impl<'a> MigrationFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> MigrationDelete<'a> { + MigrationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Migration".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> MigrationUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + MigrationUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct MigrationFindFirst<'a> { + query: Query<'a>, +} +impl<'a> MigrationFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct MigrationFindUnique<'a> { + query: Query<'a>, +} +impl<'a> MigrationFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> MigrationDelete<'a> { + MigrationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Migration".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> MigrationUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + MigrationUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct MigrationCreateOne<'a> { + query: Query<'a>, +} +impl<'a> MigrationCreateOne<'a> { + pub async fn exec(self) -> MigrationData { + self.query.perform::().await.unwrap() + } +} +pub struct MigrationUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> MigrationUpdateUnique<'a> { + pub async fn exec(self) -> MigrationData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct MigrationUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> MigrationUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct MigrationDelete<'a> { + query: Query<'a>, +} +impl<'a> MigrationDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct MigrationActions<'a> { + client: &'a PrismaClient, +} +impl<'a> MigrationActions<'a> { + pub fn find_unique(&self, param: MigrationWhereParam) -> MigrationFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Migration".into(), + outputs: migration_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + MigrationFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> MigrationFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Migration".into(), + outputs: migration_outputs(), + inputs, + }; + MigrationFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> MigrationFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Migration".into(), + outputs: migration_outputs(), + inputs, + }; + MigrationFindMany { query } + } + pub fn create_one( + &self, + name: MigrationSetName, + checksum: MigrationSetChecksum, + params: Vec, + ) -> MigrationCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(MigrationSetParam::from(name).field()); + input_fields.push(MigrationSetParam::from(checksum).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Migration".into(), + outputs: migration_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + MigrationCreateOne { query } + } +} +fn library_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("uuid"), + Output::new("name"), + Output::new("remote_id"), + Output::new("is_primary"), + Output::new("encryption"), + Output::new("total_file_count"), + Output::new("total_bytes_used"), + Output::new("total_byte_capacity"), + Output::new("total_unique_bytes"), + Output::new("date_created"), + Output::new("timezone"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LibraryData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "uuid")] + pub uuid: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "remote_id")] + pub remote_id: Option, + #[serde(rename = "is_primary")] + pub is_primary: bool, + #[serde(rename = "encryption")] + pub encryption: i64, + #[serde(rename = "total_file_count")] + pub total_file_count: i64, + #[serde(rename = "total_bytes_used")] + pub total_bytes_used: String, + #[serde(rename = "total_byte_capacity")] + pub total_byte_capacity: String, + #[serde(rename = "total_unique_bytes")] + pub total_unique_bytes: String, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "timezone")] + pub timezone: Option, + #[serde(rename = "spaces")] + spaces: Option>, +} +impl LibraryData { + pub fn spaces(&self) -> Result<&Vec, String> { + match self.spaces.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access spaces but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Library; +impl Library { + pub fn id() -> LibraryIdField { + LibraryIdField {} + } + pub fn uuid() -> LibraryUuidField { + LibraryUuidField {} + } + pub fn name() -> LibraryNameField { + LibraryNameField {} + } + pub fn remote_id() -> LibraryRemoteIdField { + LibraryRemoteIdField {} + } + pub fn is_primary() -> LibraryIsPrimaryField { + LibraryIsPrimaryField {} + } + pub fn encryption() -> LibraryEncryptionField { + LibraryEncryptionField {} + } + pub fn total_file_count() -> LibraryTotalFileCountField { + LibraryTotalFileCountField {} + } + pub fn total_bytes_used() -> LibraryTotalBytesUsedField { + LibraryTotalBytesUsedField {} + } + pub fn total_byte_capacity() -> LibraryTotalByteCapacityField { + LibraryTotalByteCapacityField {} + } + pub fn total_unique_bytes() -> LibraryTotalUniqueBytesField { + LibraryTotalUniqueBytesField {} + } + pub fn date_created() -> LibraryDateCreatedField { + LibraryDateCreatedField {} + } + pub fn timezone() -> LibraryTimezoneField { + LibraryTimezoneField {} + } + pub fn spaces() -> LibrarySpacesField { + LibrarySpacesField {} + } + pub fn not(params: Vec) -> LibraryWhereParam { + LibraryWhereParam::Not(params) + } + pub fn or(params: Vec) -> LibraryWhereParam { + LibraryWhereParam::Or(params) + } + pub fn and(params: Vec) -> LibraryWhereParam { + LibraryWhereParam::And(params) + } +} +pub struct LibraryIdField {} +pub struct LibrarySetId(i64); +impl From for LibrarySetParam { + fn from(value: LibrarySetId) -> Self { + Self::Id(value.0) + } +} +impl LibraryIdField { + pub fn lt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LibrarySetId(value).into() + } +} +pub struct LibraryUuidField {} +pub struct LibrarySetUuid(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetUuid) -> Self { + Self::Uuid(value.0) + } +} +impl LibraryUuidField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetUuid(value).into() + } +} +pub struct LibraryNameField {} +pub struct LibrarySetName(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetName) -> Self { + Self::Name(value.0) + } +} +impl LibraryNameField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetName(value).into() + } +} +pub struct LibraryRemoteIdField {} +pub struct LibrarySetRemoteId(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetRemoteId) -> Self { + Self::RemoteId(value.0) + } +} +impl LibraryRemoteIdField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetRemoteId(value).into() + } +} +pub struct LibraryIsPrimaryField {} +pub struct LibrarySetIsPrimary(bool); +impl From for LibrarySetParam { + fn from(value: LibrarySetIsPrimary) -> Self { + Self::IsPrimary(value.0) + } +} +impl LibraryIsPrimaryField { + pub fn equals(&self, value: bool) -> LibraryWhereParam { + LibraryWhereParam::IsPrimaryEquals(value) + } + pub fn set>(&self, value: bool) -> T { + LibrarySetIsPrimary(value).into() + } +} +pub struct LibraryEncryptionField {} +pub struct LibrarySetEncryption(i64); +impl From for LibrarySetParam { + fn from(value: LibrarySetEncryption) -> Self { + Self::Encryption(value.0) + } +} +impl LibraryEncryptionField { + pub fn lt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLT(value) + } + pub fn gt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGT(value) + } + pub fn lte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLTE(value) + } + pub fn gte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGTE(value) + } + pub fn equals(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::EncryptionEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LibrarySetEncryption(value).into() + } +} +pub struct LibraryTotalFileCountField {} +pub struct LibrarySetTotalFileCount(i64); +impl From for LibrarySetParam { + fn from(value: LibrarySetTotalFileCount) -> Self { + Self::TotalFileCount(value.0) + } +} +impl LibraryTotalFileCountField { + pub fn lt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::TotalFileCountLT(value) + } + pub fn gt(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::TotalFileCountGT(value) + } + pub fn lte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::TotalFileCountLTE(value) + } + pub fn gte(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::TotalFileCountGTE(value) + } + pub fn equals(&self, value: i64) -> LibraryWhereParam { + LibraryWhereParam::TotalFileCountEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LibrarySetTotalFileCount(value).into() + } +} +pub struct LibraryTotalBytesUsedField {} +pub struct LibrarySetTotalBytesUsed(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetTotalBytesUsed) -> Self { + Self::TotalBytesUsed(value.0) + } +} +impl LibraryTotalBytesUsedField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalBytesUsedContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalBytesUsedHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalBytesUsedHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalBytesUsedEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetTotalBytesUsed(value).into() + } +} +pub struct LibraryTotalByteCapacityField {} +pub struct LibrarySetTotalByteCapacity(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetTotalByteCapacity) -> Self { + Self::TotalByteCapacity(value.0) + } +} +impl LibraryTotalByteCapacityField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalByteCapacityContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalByteCapacityHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalByteCapacityHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalByteCapacityEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetTotalByteCapacity(value).into() + } +} +pub struct LibraryTotalUniqueBytesField {} +pub struct LibrarySetTotalUniqueBytes(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetTotalUniqueBytes) -> Self { + Self::TotalUniqueBytes(value.0) + } +} +impl LibraryTotalUniqueBytesField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalUniqueBytesContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalUniqueBytesHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalUniqueBytesHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TotalUniqueBytesEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetTotalUniqueBytes(value).into() + } +} +pub struct LibraryDateCreatedField {} +pub struct LibrarySetDateCreated(chrono::DateTime); +impl From for LibrarySetParam { + fn from(value: LibrarySetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl LibraryDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + LibrarySetDateCreated(value).into() + } +} +pub struct LibraryTimezoneField {} +pub struct LibrarySetTimezone(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetTimezone) -> Self { + Self::Timezone(value.0) + } +} +impl LibraryTimezoneField { + pub fn contains(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneContains(value) + } + pub fn has_prefix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneHasSuffix(value) + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneEquals(value) + } + pub fn set>(&self, value: String) -> T { + LibrarySetTimezone(value).into() + } +} +pub struct LibrarySpacesField {} +pub struct LibraryLinkSpaces(Vec); +impl From for LibrarySetParam { + fn from(value: LibraryLinkSpaces) -> Self { + Self::LinkSpaces(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl LibrarySpacesField { + pub fn some(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::SpacesSome(value) + } + pub fn every(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::SpacesEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + LibraryLinkSpaces(value).into() + } + pub fn unlink(&self, params: Vec) -> LibrarySetParam { + LibrarySetParam::UnlinkSpaces(params) + } + pub fn fetch(&self, params: Vec) -> LibraryWith { + LibraryWithParam::Spaces(params).into() + } +} +pub enum LibraryWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + UuidContains(String), + UuidHasPrefix(String), + UuidHasSuffix(String), + UuidEquals(String), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + RemoteIdContains(String), + RemoteIdHasPrefix(String), + RemoteIdHasSuffix(String), + RemoteIdEquals(String), + IsPrimaryEquals(bool), + EncryptionLT(i64), + EncryptionGT(i64), + EncryptionLTE(i64), + EncryptionGTE(i64), + EncryptionEquals(i64), + TotalFileCountLT(i64), + TotalFileCountGT(i64), + TotalFileCountLTE(i64), + TotalFileCountGTE(i64), + TotalFileCountEquals(i64), + TotalBytesUsedContains(String), + TotalBytesUsedHasPrefix(String), + TotalBytesUsedHasSuffix(String), + TotalBytesUsedEquals(String), + TotalByteCapacityContains(String), + TotalByteCapacityHasPrefix(String), + TotalByteCapacityHasSuffix(String), + TotalByteCapacityEquals(String), + TotalUniqueBytesContains(String), + TotalUniqueBytesHasPrefix(String), + TotalUniqueBytesHasSuffix(String), + TotalUniqueBytesEquals(String), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + TimezoneContains(String), + TimezoneHasPrefix(String), + TimezoneHasSuffix(String), + TimezoneEquals(String), + SpacesSome(Vec), + SpacesEvery(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl LibraryWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidContains(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasPrefix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasSuffix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEquals(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdContains(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdHasPrefix(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdHasSuffix(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdEquals(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsPrimaryEquals(value) => Field { + name: "is_primary".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLT(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGT(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLTE(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGTE(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountEquals(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedContains(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedHasPrefix(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedHasSuffix(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedEquals(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityContains(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityHasPrefix(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityHasSuffix(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityEquals(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesContains(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesHasPrefix(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesHasSuffix(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesEquals(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneContains(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasPrefix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasSuffix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEquals(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SpacesSome(value) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SpacesEvery(value) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct LibraryWith { + pub param: LibraryWithParam, +} +pub enum LibraryWithParam { + Spaces(Vec), +} +impl From for LibraryWith { + fn from(param: LibraryWithParam) -> Self { + Self { param } + } +} +impl LibraryWithParam { + pub fn output(self) -> Output { + match self { + Self::Spaces(where_params) => Output { + name: "spaces".into(), + outputs: space_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum LibrarySetParam { + Id(i64), + Uuid(String), + Name(String), + RemoteId(String), + IsPrimary(bool), + Encryption(i64), + TotalFileCount(i64), + TotalBytesUsed(String), + TotalByteCapacity(String), + TotalUniqueBytes(String), + DateCreated(chrono::DateTime), + Timezone(String), + LinkSpaces(Vec), + UnlinkSpaces(Vec), +} +impl LibrarySetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Uuid(value) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::RemoteId(value) => Field { + name: "remote_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsPrimary(value) => Field { + name: "is_primary".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalFileCount(value) => Field { + name: "total_file_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalBytesUsed(value) => Field { + name: "total_bytes_used".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalByteCapacity(value) => Field { + name: "total_byte_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalUniqueBytes(value) => Field { + name: "total_unique_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Timezone(value) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkSpaces(where_params) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkSpaces(where_params) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct LibraryFindMany<'a> { + query: Query<'a>, +} +impl<'a> LibraryFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> LibraryDelete<'a> { + LibraryDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Library".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LibraryUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LibraryUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LibraryFindFirst<'a> { + query: Query<'a>, +} +impl<'a> LibraryFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LibraryFindUnique<'a> { + query: Query<'a>, +} +impl<'a> LibraryFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> LibraryDelete<'a> { + LibraryDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Library".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LibraryUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LibraryUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LibraryCreateOne<'a> { + query: Query<'a>, +} +impl<'a> LibraryCreateOne<'a> { + pub async fn exec(self) -> LibraryData { + self.query.perform::().await.unwrap() + } +} +pub struct LibraryUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> LibraryUpdateUnique<'a> { + pub async fn exec(self) -> LibraryData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LibraryUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> LibraryUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LibraryDelete<'a> { + query: Query<'a>, +} +impl<'a> LibraryDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct LibraryActions<'a> { + client: &'a PrismaClient, +} +impl<'a> LibraryActions<'a> { + pub fn find_unique(&self, param: LibraryWhereParam) -> LibraryFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Library".into(), + outputs: library_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LibraryFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> LibraryFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Library".into(), + outputs: library_outputs(), + inputs, + }; + LibraryFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> LibraryFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Library".into(), + outputs: library_outputs(), + inputs, + }; + LibraryFindMany { query } + } + pub fn create_one( + &self, + uuid: LibrarySetUuid, + name: LibrarySetName, + params: Vec, + ) -> LibraryCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(LibrarySetParam::from(uuid).field()); + input_fields.push(LibrarySetParam::from(name).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Library".into(), + outputs: library_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + LibraryCreateOne { query } + } +} +fn client_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("uuid"), + Output::new("name"), + Output::new("platform"), + Output::new("version"), + Output::new("online"), + Output::new("last_seen"), + Output::new("timezone"), + Output::new("date_created"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "uuid")] + pub uuid: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "platform")] + pub platform: i64, + #[serde(rename = "version")] + pub version: Option, + #[serde(rename = "online")] + pub online: Option, + #[serde(rename = "last_seen")] + pub last_seen: chrono::DateTime, + #[serde(rename = "timezone")] + pub timezone: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "jobs")] + jobs: Option>, +} +impl ClientData { + pub fn jobs(&self) -> Result<&Vec, String> { + match self.jobs.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access jobs but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Client; +impl Client { + pub fn id() -> ClientIdField { + ClientIdField {} + } + pub fn uuid() -> ClientUuidField { + ClientUuidField {} + } + pub fn name() -> ClientNameField { + ClientNameField {} + } + pub fn platform() -> ClientPlatformField { + ClientPlatformField {} + } + pub fn version() -> ClientVersionField { + ClientVersionField {} + } + pub fn online() -> ClientOnlineField { + ClientOnlineField {} + } + pub fn last_seen() -> ClientLastSeenField { + ClientLastSeenField {} + } + pub fn timezone() -> ClientTimezoneField { + ClientTimezoneField {} + } + pub fn date_created() -> ClientDateCreatedField { + ClientDateCreatedField {} + } + pub fn jobs() -> ClientJobsField { + ClientJobsField {} + } + pub fn not(params: Vec) -> ClientWhereParam { + ClientWhereParam::Not(params) + } + pub fn or(params: Vec) -> ClientWhereParam { + ClientWhereParam::Or(params) + } + pub fn and(params: Vec) -> ClientWhereParam { + ClientWhereParam::And(params) + } +} +pub struct ClientIdField {} +pub struct ClientSetId(i64); +impl From for ClientSetParam { + fn from(value: ClientSetId) -> Self { + Self::Id(value.0) + } +} +impl ClientIdField { + pub fn lt(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + ClientSetId(value).into() + } +} +pub struct ClientUuidField {} +pub struct ClientSetUuid(String); +impl From for ClientSetParam { + fn from(value: ClientSetUuid) -> Self { + Self::Uuid(value.0) + } +} +impl ClientUuidField { + pub fn contains(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidContains(value) + } + pub fn has_prefix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidHasSuffix(value) + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidEquals(value) + } + pub fn set>(&self, value: String) -> T { + ClientSetUuid(value).into() + } +} +pub struct ClientNameField {} +pub struct ClientSetName(String); +impl From for ClientSetParam { + fn from(value: ClientSetName) -> Self { + Self::Name(value.0) + } +} +impl ClientNameField { + pub fn contains(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + ClientSetName(value).into() + } +} +pub struct ClientPlatformField {} +pub struct ClientSetPlatform(i64); +impl From for ClientSetParam { + fn from(value: ClientSetPlatform) -> Self { + Self::Platform(value.0) + } +} +impl ClientPlatformField { + pub fn lt(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::PlatformLT(value) + } + pub fn gt(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::PlatformGT(value) + } + pub fn lte(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::PlatformLTE(value) + } + pub fn gte(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::PlatformGTE(value) + } + pub fn equals(&self, value: i64) -> ClientWhereParam { + ClientWhereParam::PlatformEquals(value) + } + pub fn set>(&self, value: i64) -> T { + ClientSetPlatform(value).into() + } +} +pub struct ClientVersionField {} +pub struct ClientSetVersion(String); +impl From for ClientSetParam { + fn from(value: ClientSetVersion) -> Self { + Self::Version(value.0) + } +} +impl ClientVersionField { + pub fn contains(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionContains(value) + } + pub fn has_prefix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionHasSuffix(value) + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionEquals(value) + } + pub fn set>(&self, value: String) -> T { + ClientSetVersion(value).into() + } +} +pub struct ClientOnlineField {} +pub struct ClientSetOnline(bool); +impl From for ClientSetParam { + fn from(value: ClientSetOnline) -> Self { + Self::Online(value.0) + } +} +impl ClientOnlineField { + pub fn equals(&self, value: bool) -> ClientWhereParam { + ClientWhereParam::OnlineEquals(value) + } + pub fn set>(&self, value: bool) -> T { + ClientSetOnline(value).into() + } +} +pub struct ClientLastSeenField {} +pub struct ClientSetLastSeen(chrono::DateTime); +impl From for ClientSetParam { + fn from(value: ClientSetLastSeen) -> Self { + Self::LastSeen(value.0) + } +} +impl ClientLastSeenField { + pub fn before(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + ClientSetLastSeen(value).into() + } +} +pub struct ClientTimezoneField {} +pub struct ClientSetTimezone(String); +impl From for ClientSetParam { + fn from(value: ClientSetTimezone) -> Self { + Self::Timezone(value.0) + } +} +impl ClientTimezoneField { + pub fn contains(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneContains(value) + } + pub fn has_prefix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneHasSuffix(value) + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneEquals(value) + } + pub fn set>(&self, value: String) -> T { + ClientSetTimezone(value).into() + } +} +pub struct ClientDateCreatedField {} +pub struct ClientSetDateCreated(chrono::DateTime); +impl From for ClientSetParam { + fn from(value: ClientSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl ClientDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + ClientSetDateCreated(value).into() + } +} +pub struct ClientJobsField {} +pub struct ClientLinkJobs(Vec); +impl From for ClientSetParam { + fn from(value: ClientLinkJobs) -> Self { + Self::LinkJobs(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl ClientJobsField { + pub fn some(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::JobsSome(value) + } + pub fn every(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::JobsEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + ClientLinkJobs(value).into() + } + pub fn unlink(&self, params: Vec) -> ClientSetParam { + ClientSetParam::UnlinkJobs(params) + } + pub fn fetch(&self, params: Vec) -> ClientWith { + ClientWithParam::Jobs(params).into() + } +} +pub enum ClientWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + UuidContains(String), + UuidHasPrefix(String), + UuidHasSuffix(String), + UuidEquals(String), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + PlatformLT(i64), + PlatformGT(i64), + PlatformLTE(i64), + PlatformGTE(i64), + PlatformEquals(i64), + VersionContains(String), + VersionHasPrefix(String), + VersionHasSuffix(String), + VersionEquals(String), + OnlineEquals(bool), + LastSeenBefore(chrono::DateTime), + LastSeenAfter(chrono::DateTime), + LastSeenBeforeEquals(chrono::DateTime), + LastSeenAfterEquals(chrono::DateTime), + LastSeenEquals(chrono::DateTime), + TimezoneContains(String), + TimezoneHasPrefix(String), + TimezoneHasSuffix(String), + TimezoneEquals(String), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + JobsSome(Vec), + JobsEvery(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl ClientWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidContains(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasPrefix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasSuffix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEquals(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLT(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGT(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLTE(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGTE(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformEquals(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionContains(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionHasPrefix(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionHasSuffix(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionEquals(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::OnlineEquals(value) => Field { + name: "online".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenBefore(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenAfter(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenBeforeEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenAfterEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneContains(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasPrefix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasSuffix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEquals(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::JobsSome(value) => Field { + name: "jobs".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::JobsEvery(value) => Field { + name: "jobs".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct ClientWith { + pub param: ClientWithParam, +} +pub enum ClientWithParam { + Jobs(Vec), +} +impl From for ClientWith { + fn from(param: ClientWithParam) -> Self { + Self { param } + } +} +impl ClientWithParam { + pub fn output(self) -> Output { + match self { + Self::Jobs(where_params) => Output { + name: "jobs".into(), + outputs: job_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum ClientSetParam { + Id(i64), + Uuid(String), + Name(String), + Platform(i64), + Version(String), + Online(bool), + LastSeen(chrono::DateTime), + Timezone(String), + DateCreated(chrono::DateTime), + LinkJobs(Vec), + UnlinkJobs(Vec), +} +impl ClientSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Uuid(value) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Platform(value) => Field { + name: "platform".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Version(value) => Field { + name: "version".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Online(value) => Field { + name: "online".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LastSeen(value) => Field { + name: "last_seen".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Timezone(value) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkJobs(where_params) => Field { + name: "jobs".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkJobs(where_params) => Field { + name: "jobs".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct ClientFindMany<'a> { + query: Query<'a>, +} +impl<'a> ClientFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> ClientDelete<'a> { + ClientDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Client".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> ClientUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + ClientUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct ClientFindFirst<'a> { + query: Query<'a>, +} +impl<'a> ClientFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct ClientFindUnique<'a> { + query: Query<'a>, +} +impl<'a> ClientFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> ClientDelete<'a> { + ClientDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Client".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> ClientUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + ClientUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct ClientCreateOne<'a> { + query: Query<'a>, +} +impl<'a> ClientCreateOne<'a> { + pub async fn exec(self) -> ClientData { + self.query.perform::().await.unwrap() + } +} +pub struct ClientUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> ClientUpdateUnique<'a> { + pub async fn exec(self) -> ClientData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct ClientUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> ClientUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct ClientDelete<'a> { + query: Query<'a>, +} +impl<'a> ClientDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct ClientActions<'a> { + client: &'a PrismaClient, +} +impl<'a> ClientActions<'a> { + pub fn find_unique(&self, param: ClientWhereParam) -> ClientFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Client".into(), + outputs: client_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + ClientFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> ClientFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Client".into(), + outputs: client_outputs(), + inputs, + }; + ClientFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> ClientFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Client".into(), + outputs: client_outputs(), + inputs, + }; + ClientFindMany { query } + } + pub fn create_one( + &self, + uuid: ClientSetUuid, + name: ClientSetName, + params: Vec, + ) -> ClientCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(ClientSetParam::from(uuid).field()); + input_fields.push(ClientSetParam::from(name).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Client".into(), + outputs: client_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + ClientCreateOne { query } + } +} +fn location_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("path"), + Output::new("total_capacity"), + Output::new("available_capacity"), + Output::new("is_removable"), + Output::new("is_ejectable"), + Output::new("is_root_filesystem"), + Output::new("is_online"), + Output::new("date_created"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LocationData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "path")] + pub path: Option, + #[serde(rename = "total_capacity")] + pub total_capacity: Option, + #[serde(rename = "available_capacity")] + pub available_capacity: Option, + #[serde(rename = "is_removable")] + pub is_removable: bool, + #[serde(rename = "is_ejectable")] + pub is_ejectable: bool, + #[serde(rename = "is_root_filesystem")] + pub is_root_filesystem: bool, + #[serde(rename = "is_online")] + pub is_online: bool, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "files")] + files: Option>, +} +impl LocationData { + pub fn files(&self) -> Result<&Vec, String> { + match self.files.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access files but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Location; +impl Location { + pub fn id() -> LocationIdField { + LocationIdField {} + } + pub fn name() -> LocationNameField { + LocationNameField {} + } + pub fn path() -> LocationPathField { + LocationPathField {} + } + pub fn total_capacity() -> LocationTotalCapacityField { + LocationTotalCapacityField {} + } + pub fn available_capacity() -> LocationAvailableCapacityField { + LocationAvailableCapacityField {} + } + pub fn is_removable() -> LocationIsRemovableField { + LocationIsRemovableField {} + } + pub fn is_ejectable() -> LocationIsEjectableField { + LocationIsEjectableField {} + } + pub fn is_root_filesystem() -> LocationIsRootFilesystemField { + LocationIsRootFilesystemField {} + } + pub fn is_online() -> LocationIsOnlineField { + LocationIsOnlineField {} + } + pub fn date_created() -> LocationDateCreatedField { + LocationDateCreatedField {} + } + pub fn files() -> LocationFilesField { + LocationFilesField {} + } + pub fn not(params: Vec) -> LocationWhereParam { + LocationWhereParam::Not(params) + } + pub fn or(params: Vec) -> LocationWhereParam { + LocationWhereParam::Or(params) + } + pub fn and(params: Vec) -> LocationWhereParam { + LocationWhereParam::And(params) + } +} +pub struct LocationIdField {} +pub struct LocationSetId(i64); +impl From for LocationSetParam { + fn from(value: LocationSetId) -> Self { + Self::Id(value.0) + } +} +impl LocationIdField { + pub fn lt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LocationSetId(value).into() + } +} +pub struct LocationNameField {} +pub struct LocationSetName(String); +impl From for LocationSetParam { + fn from(value: LocationSetName) -> Self { + Self::Name(value.0) + } +} +impl LocationNameField { + pub fn contains(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + LocationSetName(value).into() + } +} +pub struct LocationPathField {} +pub struct LocationSetPath(String); +impl From for LocationSetParam { + fn from(value: LocationSetPath) -> Self { + Self::Path(value.0) + } +} +impl LocationPathField { + pub fn contains(&self, value: String) -> LocationWhereParam { + LocationWhereParam::PathContains(value) + } + pub fn has_prefix(&self, value: String) -> LocationWhereParam { + LocationWhereParam::PathHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LocationWhereParam { + LocationWhereParam::PathHasSuffix(value) + } + pub fn equals(&self, value: String) -> LocationWhereParam { + LocationWhereParam::PathEquals(value) + } + pub fn set>(&self, value: String) -> T { + LocationSetPath(value).into() + } +} +pub struct LocationTotalCapacityField {} +pub struct LocationSetTotalCapacity(i64); +impl From for LocationSetParam { + fn from(value: LocationSetTotalCapacity) -> Self { + Self::TotalCapacity(value.0) + } +} +impl LocationTotalCapacityField { + pub fn lt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLT(value) + } + pub fn gt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGT(value) + } + pub fn lte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLTE(value) + } + pub fn gte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGTE(value) + } + pub fn equals(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::TotalCapacityEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LocationSetTotalCapacity(value).into() + } +} +pub struct LocationAvailableCapacityField {} +pub struct LocationSetAvailableCapacity(i64); +impl From for LocationSetParam { + fn from(value: LocationSetAvailableCapacity) -> Self { + Self::AvailableCapacity(value.0) + } +} +impl LocationAvailableCapacityField { + pub fn lt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLT(value) + } + pub fn gt(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGT(value) + } + pub fn lte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLTE(value) + } + pub fn gte(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGTE(value) + } + pub fn equals(&self, value: i64) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityEquals(value) + } + pub fn set>(&self, value: i64) -> T { + LocationSetAvailableCapacity(value).into() + } +} +pub struct LocationIsRemovableField {} +pub struct LocationSetIsRemovable(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsRemovable) -> Self { + Self::IsRemovable(value.0) + } +} +impl LocationIsRemovableField { + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsRemovableEquals(value) + } + pub fn set>(&self, value: bool) -> T { + LocationSetIsRemovable(value).into() + } +} +pub struct LocationIsEjectableField {} +pub struct LocationSetIsEjectable(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsEjectable) -> Self { + Self::IsEjectable(value.0) + } +} +impl LocationIsEjectableField { + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsEjectableEquals(value) + } + pub fn set>(&self, value: bool) -> T { + LocationSetIsEjectable(value).into() + } +} +pub struct LocationIsRootFilesystemField {} +pub struct LocationSetIsRootFilesystem(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsRootFilesystem) -> Self { + Self::IsRootFilesystem(value.0) + } +} +impl LocationIsRootFilesystemField { + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsRootFilesystemEquals(value) + } + pub fn set>(&self, value: bool) -> T { + LocationSetIsRootFilesystem(value).into() + } +} +pub struct LocationIsOnlineField {} +pub struct LocationSetIsOnline(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsOnline) -> Self { + Self::IsOnline(value.0) + } +} +impl LocationIsOnlineField { + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsOnlineEquals(value) + } + pub fn set>(&self, value: bool) -> T { + LocationSetIsOnline(value).into() + } +} +pub struct LocationDateCreatedField {} +pub struct LocationSetDateCreated(chrono::DateTime); +impl From for LocationSetParam { + fn from(value: LocationSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl LocationDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + LocationSetDateCreated(value).into() + } +} +pub struct LocationFilesField {} +pub struct LocationLinkFiles(Vec); +impl From for LocationSetParam { + fn from(value: LocationLinkFiles) -> Self { + Self::LinkFiles(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl LocationFilesField { + pub fn some(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::FilesSome(value) + } + pub fn every(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::FilesEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + LocationLinkFiles(value).into() + } + pub fn unlink(&self, params: Vec) -> LocationSetParam { + LocationSetParam::UnlinkFiles(params) + } + pub fn fetch(&self, params: Vec) -> LocationWith { + LocationWithParam::Files(params).into() + } +} +pub enum LocationWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + PathContains(String), + PathHasPrefix(String), + PathHasSuffix(String), + PathEquals(String), + TotalCapacityLT(i64), + TotalCapacityGT(i64), + TotalCapacityLTE(i64), + TotalCapacityGTE(i64), + TotalCapacityEquals(i64), + AvailableCapacityLT(i64), + AvailableCapacityGT(i64), + AvailableCapacityLTE(i64), + AvailableCapacityGTE(i64), + AvailableCapacityEquals(i64), + IsRemovableEquals(bool), + IsEjectableEquals(bool), + IsRootFilesystemEquals(bool), + IsOnlineEquals(bool), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + FilesSome(Vec), + FilesEvery(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl LocationWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathContains(value) => Field { + name: "path".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathHasPrefix(value) => Field { + name: "path".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathHasSuffix(value) => Field { + name: "path".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathEquals(value) => Field { + name: "path".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLT(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGT(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLTE(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGTE(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityEquals(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLT(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGT(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLTE(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGTE(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityEquals(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsRemovableEquals(value) => Field { + name: "is_removable".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsEjectableEquals(value) => Field { + name: "is_ejectable".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsRootFilesystemEquals(value) => Field { + name: "is_root_filesystem".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsOnlineEquals(value) => Field { + name: "is_online".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesSome(value) => Field { + name: "files".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesEvery(value) => Field { + name: "files".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct LocationWith { + pub param: LocationWithParam, +} +pub enum LocationWithParam { + Files(Vec), +} +impl From for LocationWith { + fn from(param: LocationWithParam) -> Self { + Self { param } + } +} +impl LocationWithParam { + pub fn output(self) -> Output { + match self { + Self::Files(where_params) => Output { + name: "files".into(), + outputs: file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum LocationSetParam { + Id(i64), + Name(String), + Path(String), + TotalCapacity(i64), + AvailableCapacity(i64), + IsRemovable(bool), + IsEjectable(bool), + IsRootFilesystem(bool), + IsOnline(bool), + DateCreated(chrono::DateTime), + LinkFiles(Vec), + UnlinkFiles(Vec), +} +impl LocationSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Path(value) => Field { + name: "path".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalCapacity(value) => Field { + name: "total_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::AvailableCapacity(value) => Field { + name: "available_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsRemovable(value) => Field { + name: "is_removable".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsEjectable(value) => Field { + name: "is_ejectable".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsRootFilesystem(value) => Field { + name: "is_root_filesystem".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsOnline(value) => Field { + name: "is_online".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFiles(where_params) => Field { + name: "files".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkFiles(where_params) => Field { + name: "files".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct LocationFindMany<'a> { + query: Query<'a>, +} +impl<'a> LocationFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> LocationDelete<'a> { + LocationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Location".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LocationUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LocationUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LocationFindFirst<'a> { + query: Query<'a>, +} +impl<'a> LocationFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LocationFindUnique<'a> { + query: Query<'a>, +} +impl<'a> LocationFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> LocationDelete<'a> { + LocationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Location".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LocationUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LocationUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LocationCreateOne<'a> { + query: Query<'a>, +} +impl<'a> LocationCreateOne<'a> { + pub async fn exec(self) -> LocationData { + self.query.perform::().await.unwrap() + } +} +pub struct LocationUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> LocationUpdateUnique<'a> { + pub async fn exec(self) -> LocationData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LocationUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> LocationUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct LocationDelete<'a> { + query: Query<'a>, +} +impl<'a> LocationDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct LocationActions<'a> { + client: &'a PrismaClient, +} +impl<'a> LocationActions<'a> { + pub fn find_unique(&self, param: LocationWhereParam) -> LocationFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LocationFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> LocationFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs, + }; + LocationFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> LocationFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs, + }; + LocationFindMany { query } + } + pub fn create_one(&self, params: Vec) -> LocationCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + LocationCreateOne { query } + } +} +fn file_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("is_dir"), + Output::new("location_id"), + Output::new("materialized_path"), + Output::new("name"), + Output::new("extension"), + Output::new("path_integrity_hash"), + Output::new("quick_integrity_hash"), + Output::new("full_integrity_hash"), + Output::new("size_in_bytes"), + Output::new("encryption"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("date_indexed"), + Output::new("ipfs_id"), + Output::new("parent_id"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct FileData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "is_dir")] + pub is_dir: bool, + #[serde(rename = "location_id")] + pub location_id: i64, + #[serde(rename = "materialized_path")] + pub materialized_path: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "extension")] + pub extension: Option, + #[serde(rename = "path_integrity_hash")] + pub path_integrity_hash: String, + #[serde(rename = "quick_integrity_hash")] + pub quick_integrity_hash: Option, + #[serde(rename = "full_integrity_hash")] + pub full_integrity_hash: Option, + #[serde(rename = "size_in_bytes")] + pub size_in_bytes: String, + #[serde(rename = "encryption")] + pub encryption: i64, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "date_indexed")] + pub date_indexed: chrono::DateTime, + #[serde(rename = "ipfs_id")] + pub ipfs_id: Option, + #[serde(rename = "location")] + pub location: Box>, + #[serde(rename = "parent")] + pub parent: Box>, + #[serde(rename = "parent_id")] + pub parent_id: Option, + #[serde(rename = "children")] + children: Option>, + #[serde(rename = "file_tags")] + file_tags: Option>, +} +impl FileData { + pub fn location(&self) -> Option<&LocationData> { + self.location.as_ref().as_ref() + } + pub fn parent(&self) -> Option<&FileData> { + self.parent.as_ref().as_ref() + } + pub fn children(&self) -> Result<&Vec, String> { + match self.children.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access children but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } + pub fn file_tags(&self) -> Result<&Vec, String> { + match self.file_tags.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access file_tags but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct File; +impl File { + pub fn id() -> FileIdField { + FileIdField {} + } + pub fn is_dir() -> FileIsDirField { + FileIsDirField {} + } + pub fn location_id() -> FileLocationIdField { + FileLocationIdField {} + } + pub fn materialized_path() -> FileMaterializedPathField { + FileMaterializedPathField {} + } + pub fn name() -> FileNameField { + FileNameField {} + } + pub fn extension() -> FileExtensionField { + FileExtensionField {} + } + pub fn path_integrity_hash() -> FilePathIntegrityHashField { + FilePathIntegrityHashField {} + } + pub fn quick_integrity_hash() -> FileQuickIntegrityHashField { + FileQuickIntegrityHashField {} + } + pub fn full_integrity_hash() -> FileFullIntegrityHashField { + FileFullIntegrityHashField {} + } + pub fn size_in_bytes() -> FileSizeInBytesField { + FileSizeInBytesField {} + } + pub fn encryption() -> FileEncryptionField { + FileEncryptionField {} + } + pub fn date_created() -> FileDateCreatedField { + FileDateCreatedField {} + } + pub fn date_modified() -> FileDateModifiedField { + FileDateModifiedField {} + } + pub fn date_indexed() -> FileDateIndexedField { + FileDateIndexedField {} + } + pub fn ipfs_id() -> FileIpfsIdField { + FileIpfsIdField {} + } + pub fn location() -> FileLocationField { + FileLocationField {} + } + pub fn parent() -> FileParentField { + FileParentField {} + } + pub fn parent_id() -> FileParentIdField { + FileParentIdField {} + } + pub fn children() -> FileChildrenField { + FileChildrenField {} + } + pub fn file_tags() -> FileFileTagsField { + FileFileTagsField {} + } + pub fn not(params: Vec) -> FileWhereParam { + FileWhereParam::Not(params) + } + pub fn or(params: Vec) -> FileWhereParam { + FileWhereParam::Or(params) + } + pub fn and(params: Vec) -> FileWhereParam { + FileWhereParam::And(params) + } +} +pub struct FileIdField {} +pub struct FileSetId(i64); +impl From for FileSetParam { + fn from(value: FileSetId) -> Self { + Self::Id(value.0) + } +} +impl FileIdField { + pub fn lt(&self, value: i64) -> FileWhereParam { + FileWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> FileWhereParam { + FileWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> FileWhereParam { + FileWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> FileWhereParam { + FileWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> FileWhereParam { + FileWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + FileSetId(value).into() + } +} +pub struct FileIsDirField {} +pub struct FileSetIsDir(bool); +impl From for FileSetParam { + fn from(value: FileSetIsDir) -> Self { + Self::IsDir(value.0) + } +} +impl FileIsDirField { + pub fn equals(&self, value: bool) -> FileWhereParam { + FileWhereParam::IsDirEquals(value) + } + pub fn set>(&self, value: bool) -> T { + FileSetIsDir(value).into() + } +} +pub struct FileLocationIdField {} +pub struct FileSetLocationId(i64); +impl From for FileSetParam { + fn from(value: FileSetLocationId) -> Self { + Self::LocationId(value.0) + } +} +impl FileLocationIdField { + pub fn lt(&self, value: i64) -> FileWhereParam { + FileWhereParam::LocationIdLT(value) + } + pub fn gt(&self, value: i64) -> FileWhereParam { + FileWhereParam::LocationIdGT(value) + } + pub fn lte(&self, value: i64) -> FileWhereParam { + FileWhereParam::LocationIdLTE(value) + } + pub fn gte(&self, value: i64) -> FileWhereParam { + FileWhereParam::LocationIdGTE(value) + } + pub fn equals(&self, value: i64) -> FileWhereParam { + FileWhereParam::LocationIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + FileSetLocationId(value).into() + } +} +pub struct FileMaterializedPathField {} +pub struct FileSetMaterializedPath(String); +impl From for FileSetParam { + fn from(value: FileSetMaterializedPath) -> Self { + Self::MaterializedPath(value.0) + } +} +impl FileMaterializedPathField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::MaterializedPathContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::MaterializedPathHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::MaterializedPathHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::MaterializedPathEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetMaterializedPath(value).into() + } +} +pub struct FileNameField {} +pub struct FileSetName(String); +impl From for FileSetParam { + fn from(value: FileSetName) -> Self { + Self::Name(value.0) + } +} +impl FileNameField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetName(value).into() + } +} +pub struct FileExtensionField {} +pub struct FileSetExtension(String); +impl From for FileSetParam { + fn from(value: FileSetExtension) -> Self { + Self::Extension(value.0) + } +} +impl FileExtensionField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::ExtensionContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::ExtensionHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::ExtensionHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::ExtensionEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetExtension(value).into() + } +} +pub struct FilePathIntegrityHashField {} +pub struct FileSetPathIntegrityHash(String); +impl From for FileSetParam { + fn from(value: FileSetPathIntegrityHash) -> Self { + Self::PathIntegrityHash(value.0) + } +} +impl FilePathIntegrityHashField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::PathIntegrityHashContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::PathIntegrityHashHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::PathIntegrityHashHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::PathIntegrityHashEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetPathIntegrityHash(value).into() + } +} +pub struct FileQuickIntegrityHashField {} +pub struct FileSetQuickIntegrityHash(String); +impl From for FileSetParam { + fn from(value: FileSetQuickIntegrityHash) -> Self { + Self::QuickIntegrityHash(value.0) + } +} +impl FileQuickIntegrityHashField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::QuickIntegrityHashContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::QuickIntegrityHashHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::QuickIntegrityHashHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::QuickIntegrityHashEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetQuickIntegrityHash(value).into() + } +} +pub struct FileFullIntegrityHashField {} +pub struct FileSetFullIntegrityHash(String); +impl From for FileSetParam { + fn from(value: FileSetFullIntegrityHash) -> Self { + Self::FullIntegrityHash(value.0) + } +} +impl FileFullIntegrityHashField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::FullIntegrityHashContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::FullIntegrityHashHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::FullIntegrityHashHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::FullIntegrityHashEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetFullIntegrityHash(value).into() + } +} +pub struct FileSizeInBytesField {} +pub struct FileSetSizeInBytes(String); +impl From for FileSetParam { + fn from(value: FileSetSizeInBytes) -> Self { + Self::SizeInBytes(value.0) + } +} +impl FileSizeInBytesField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetSizeInBytes(value).into() + } +} +pub struct FileEncryptionField {} +pub struct FileSetEncryption(i64); +impl From for FileSetParam { + fn from(value: FileSetEncryption) -> Self { + Self::Encryption(value.0) + } +} +impl FileEncryptionField { + pub fn lt(&self, value: i64) -> FileWhereParam { + FileWhereParam::EncryptionLT(value) + } + pub fn gt(&self, value: i64) -> FileWhereParam { + FileWhereParam::EncryptionGT(value) + } + pub fn lte(&self, value: i64) -> FileWhereParam { + FileWhereParam::EncryptionLTE(value) + } + pub fn gte(&self, value: i64) -> FileWhereParam { + FileWhereParam::EncryptionGTE(value) + } + pub fn equals(&self, value: i64) -> FileWhereParam { + FileWhereParam::EncryptionEquals(value) + } + pub fn set>(&self, value: i64) -> T { + FileSetEncryption(value).into() + } +} +pub struct FileDateCreatedField {} +pub struct FileSetDateCreated(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl FileDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + FileSetDateCreated(value).into() + } +} +pub struct FileDateModifiedField {} +pub struct FileSetDateModified(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateModified) -> Self { + Self::DateModified(value.0) + } +} +impl FileDateModifiedField { + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + FileSetDateModified(value).into() + } +} +pub struct FileDateIndexedField {} +pub struct FileSetDateIndexed(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateIndexed) -> Self { + Self::DateIndexed(value.0) + } +} +impl FileDateIndexedField { + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + FileSetDateIndexed(value).into() + } +} +pub struct FileIpfsIdField {} +pub struct FileSetIpfsId(String); +impl From for FileSetParam { + fn from(value: FileSetIpfsId) -> Self { + Self::IpfsId(value.0) + } +} +impl FileIpfsIdField { + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdContains(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdHasSuffix(value) + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdEquals(value) + } + pub fn set>(&self, value: String) -> T { + FileSetIpfsId(value).into() + } +} +pub struct FileLocationField {} +pub struct FileLinkLocation(LocationWhereParam); +impl From for FileSetParam { + fn from(value: FileLinkLocation) -> Self { + Self::LinkLocation(value.0) + } +} +impl FileLocationField { + pub fn is(&self, value: Vec) -> FileWhereParam { + FileWhereParam::LocationIs(value) + } + pub fn link>(&self, value: LocationWhereParam) -> T { + FileLinkLocation(value).into() + } + pub fn fetch(&self) -> FileWith { + FileWithParam::Location.into() + } + pub fn unlink(&self) -> FileSetParam { + FileSetParam::UnlinkLocation + } +} +pub struct FileParentField {} +pub struct FileLinkParent(FileWhereParam); +impl From for FileSetParam { + fn from(value: FileLinkParent) -> Self { + Self::LinkParent(value.0) + } +} +impl FileParentField { + pub fn is(&self, value: Vec) -> FileWhereParam { + FileWhereParam::ParentIs(value) + } + pub fn link>(&self, value: FileWhereParam) -> T { + FileLinkParent(value).into() + } + pub fn fetch(&self) -> FileWith { + FileWithParam::Parent.into() + } + pub fn unlink(&self) -> FileSetParam { + FileSetParam::UnlinkParent + } +} +pub struct FileParentIdField {} +pub struct FileSetParentId(i64); +impl From for FileSetParam { + fn from(value: FileSetParentId) -> Self { + Self::ParentId(value.0) + } +} +impl FileParentIdField { + pub fn lt(&self, value: i64) -> FileWhereParam { + FileWhereParam::ParentIdLT(value) + } + pub fn gt(&self, value: i64) -> FileWhereParam { + FileWhereParam::ParentIdGT(value) + } + pub fn lte(&self, value: i64) -> FileWhereParam { + FileWhereParam::ParentIdLTE(value) + } + pub fn gte(&self, value: i64) -> FileWhereParam { + FileWhereParam::ParentIdGTE(value) + } + pub fn equals(&self, value: i64) -> FileWhereParam { + FileWhereParam::ParentIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + FileSetParentId(value).into() + } +} +pub struct FileChildrenField {} +pub struct FileLinkChildren(Vec); +impl From for FileSetParam { + fn from(value: FileLinkChildren) -> Self { + Self::LinkChildren(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl FileChildrenField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::ChildrenSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::ChildrenEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + FileLinkChildren(value).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnlinkChildren(params) + } + pub fn fetch(&self, params: Vec) -> FileWith { + FileWithParam::Children(params).into() + } +} +pub struct FileFileTagsField {} +pub struct FileLinkFileTags(Vec); +impl From for FileSetParam { + fn from(value: FileLinkFileTags) -> Self { + Self::LinkFileTags(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl FileFileTagsField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileTagsSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileTagsEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + FileLinkFileTags(value).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnlinkFileTags(params) + } + pub fn fetch(&self, params: Vec) -> FileWith { + FileWithParam::FileTags(params).into() + } +} +pub enum FileWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + IsDirEquals(bool), + LocationIdLT(i64), + LocationIdGT(i64), + LocationIdLTE(i64), + LocationIdGTE(i64), + LocationIdEquals(i64), + MaterializedPathContains(String), + MaterializedPathHasPrefix(String), + MaterializedPathHasSuffix(String), + MaterializedPathEquals(String), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + ExtensionContains(String), + ExtensionHasPrefix(String), + ExtensionHasSuffix(String), + ExtensionEquals(String), + PathIntegrityHashContains(String), + PathIntegrityHashHasPrefix(String), + PathIntegrityHashHasSuffix(String), + PathIntegrityHashEquals(String), + QuickIntegrityHashContains(String), + QuickIntegrityHashHasPrefix(String), + QuickIntegrityHashHasSuffix(String), + QuickIntegrityHashEquals(String), + FullIntegrityHashContains(String), + FullIntegrityHashHasPrefix(String), + FullIntegrityHashHasSuffix(String), + FullIntegrityHashEquals(String), + SizeInBytesContains(String), + SizeInBytesHasPrefix(String), + SizeInBytesHasSuffix(String), + SizeInBytesEquals(String), + EncryptionLT(i64), + EncryptionGT(i64), + EncryptionLTE(i64), + EncryptionGTE(i64), + EncryptionEquals(i64), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateIndexedBefore(chrono::DateTime), + DateIndexedAfter(chrono::DateTime), + DateIndexedBeforeEquals(chrono::DateTime), + DateIndexedAfterEquals(chrono::DateTime), + DateIndexedEquals(chrono::DateTime), + IpfsIdContains(String), + IpfsIdHasPrefix(String), + IpfsIdHasSuffix(String), + IpfsIdEquals(String), + LocationIs(Vec), + ParentIs(Vec), + ParentIdLT(i64), + ParentIdGT(i64), + ParentIdLTE(i64), + ParentIdGTE(i64), + ParentIdEquals(i64), + ChildrenSome(Vec), + ChildrenEvery(Vec), + FileTagsSome(Vec), + FileTagsEvery(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl FileWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsDirEquals(value) => Field { + name: "is_dir".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLT(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGT(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLTE(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGTE(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdEquals(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathContains(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathHasPrefix(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathHasSuffix(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathEquals(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionContains(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionHasPrefix(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionHasSuffix(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionEquals(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathIntegrityHashContains(value) => Field { + name: "path_integrity_hash".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathIntegrityHashHasPrefix(value) => Field { + name: "path_integrity_hash".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathIntegrityHashHasSuffix(value) => Field { + name: "path_integrity_hash".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PathIntegrityHashEquals(value) => Field { + name: "path_integrity_hash".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::QuickIntegrityHashContains(value) => Field { + name: "quick_integrity_hash".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::QuickIntegrityHashHasPrefix(value) => Field { + name: "quick_integrity_hash".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::QuickIntegrityHashHasSuffix(value) => Field { + name: "quick_integrity_hash".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::QuickIntegrityHashEquals(value) => Field { + name: "quick_integrity_hash".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FullIntegrityHashContains(value) => Field { + name: "full_integrity_hash".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FullIntegrityHashHasPrefix(value) => Field { + name: "full_integrity_hash".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FullIntegrityHashHasSuffix(value) => Field { + name: "full_integrity_hash".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FullIntegrityHashEquals(value) => Field { + name: "full_integrity_hash".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesContains(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesHasPrefix(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesHasSuffix(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesEquals(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedBefore(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedAfter(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedBeforeEquals(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedAfterEquals(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedEquals(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdContains(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdHasPrefix(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdHasSuffix(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdEquals(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIs(value) => Field { + name: "location".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIs(value) => Field { + name: "parent".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdLT(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdGT(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdLTE(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdGTE(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdEquals(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChildrenSome(value) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChildrenEvery(value) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileTagsSome(value) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileTagsEvery(value) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct FileWith { + pub param: FileWithParam, +} +pub enum FileWithParam { + Location, + Parent, + Children(Vec), + FileTags(Vec), +} +impl From for FileWith { + fn from(param: FileWithParam) -> Self { + Self { param } + } +} +impl FileWithParam { + pub fn output(self) -> Output { + match self { + Self::Location => Output { + name: "location".into(), + outputs: location_outputs(), + ..Default::default() + }, + Self::Parent => Output { + name: "parent".into(), + outputs: file_outputs(), + ..Default::default() + }, + Self::Children(where_params) => Output { + name: "children".into(), + outputs: file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + Self::FileTags(where_params) => Output { + name: "file_tags".into(), + outputs: tag_on_file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum FileSetParam { + Id(i64), + IsDir(bool), + LocationId(i64), + MaterializedPath(String), + Name(String), + Extension(String), + PathIntegrityHash(String), + QuickIntegrityHash(String), + FullIntegrityHash(String), + SizeInBytes(String), + Encryption(i64), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + DateIndexed(chrono::DateTime), + IpfsId(String), + LinkLocation(LocationWhereParam), + UnlinkLocation, + LinkParent(FileWhereParam), + UnlinkParent, + ParentId(i64), + LinkChildren(Vec), + UnlinkChildren(Vec), + LinkFileTags(Vec), + UnlinkFileTags(Vec), +} +impl FileSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsDir(value) => Field { + name: "is_dir".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LocationId(value) => Field { + name: "location_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::MaterializedPath(value) => Field { + name: "materialized_path".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Extension(value) => Field { + name: "extension".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::PathIntegrityHash(value) => Field { + name: "path_integrity_hash".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::QuickIntegrityHash(value) => Field { + name: "quick_integrity_hash".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::FullIntegrityHash(value) => Field { + name: "full_integrity_hash".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SizeInBytes(value) => Field { + name: "size_in_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateIndexed(value) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IpfsId(value) => Field { + name: "ipfs_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkLocation(where_param) => Field { + name: "location".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkLocation => Field { + name: "location".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkParent(where_param) => Field { + name: "parent".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkParent => Field { + name: "parent".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentId(value) => Field { + name: "parent_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkChildren(where_params) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkChildren(where_params) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkFileTags(where_params) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkFileTags(where_params) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct FileFindMany<'a> { + query: Query<'a>, +} +impl<'a> FileFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> FileDelete<'a> { + FileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "File".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> FileUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + FileUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct FileFindFirst<'a> { + query: Query<'a>, +} +impl<'a> FileFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct FileFindUnique<'a> { + query: Query<'a>, +} +impl<'a> FileFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> FileDelete<'a> { + FileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "File".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> FileUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + FileUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct FileCreateOne<'a> { + query: Query<'a>, +} +impl<'a> FileCreateOne<'a> { + pub async fn exec(self) -> FileData { + self.query.perform::().await.unwrap() + } +} +pub struct FileUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> FileUpdateUnique<'a> { + pub async fn exec(self) -> FileData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct FileUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> FileUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct FileDelete<'a> { + query: Query<'a>, +} +impl<'a> FileDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct FileActions<'a> { + client: &'a PrismaClient, +} +impl<'a> FileActions<'a> { + pub fn find_unique(&self, param: FileWhereParam) -> FileFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "File".into(), + outputs: file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + FileFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> FileFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "File".into(), + outputs: file_outputs(), + inputs, + }; + FileFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> FileFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "File".into(), + outputs: file_outputs(), + inputs, + }; + FileFindMany { query } + } + pub fn create_one( + &self, + materialized_path: FileSetMaterializedPath, + name: FileSetName, + path_integrity_hash: FileSetPathIntegrityHash, + size_in_bytes: FileSetSizeInBytes, + params: Vec, + ) -> FileCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(FileSetParam::from(materialized_path).field()); + input_fields.push(FileSetParam::from(name).field()); + input_fields.push(FileSetParam::from(path_integrity_hash).field()); + input_fields.push(FileSetParam::from(size_in_bytes).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "File".into(), + outputs: file_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + FileCreateOne { query } + } +} +fn tag_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("encryption"), + Output::new("total_files"), + Output::new("redundancy_goal"), + Output::new("date_created"), + Output::new("date_modified"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TagData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "encryption")] + pub encryption: Option, + #[serde(rename = "total_files")] + pub total_files: Option, + #[serde(rename = "redundancy_goal")] + pub redundancy_goal: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "tag_files")] + tag_files: Option>, +} +impl TagData { + pub fn tag_files(&self) -> Result<&Vec, String> { + match self.tag_files.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access tag_files but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Tag; +impl Tag { + pub fn id() -> TagIdField { + TagIdField {} + } + pub fn name() -> TagNameField { + TagNameField {} + } + pub fn encryption() -> TagEncryptionField { + TagEncryptionField {} + } + pub fn total_files() -> TagTotalFilesField { + TagTotalFilesField {} + } + pub fn redundancy_goal() -> TagRedundancyGoalField { + TagRedundancyGoalField {} + } + pub fn date_created() -> TagDateCreatedField { + TagDateCreatedField {} + } + pub fn date_modified() -> TagDateModifiedField { + TagDateModifiedField {} + } + pub fn tag_files() -> TagTagFilesField { + TagTagFilesField {} + } + pub fn not(params: Vec) -> TagWhereParam { + TagWhereParam::Not(params) + } + pub fn or(params: Vec) -> TagWhereParam { + TagWhereParam::Or(params) + } + pub fn and(params: Vec) -> TagWhereParam { + TagWhereParam::And(params) + } +} +pub struct TagIdField {} +pub struct TagSetId(i64); +impl From for TagSetParam { + fn from(value: TagSetId) -> Self { + Self::Id(value.0) + } +} +impl TagIdField { + pub fn lt(&self, value: i64) -> TagWhereParam { + TagWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> TagWhereParam { + TagWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> TagWhereParam { + TagWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> TagWhereParam { + TagWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> TagWhereParam { + TagWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagSetId(value).into() + } +} +pub struct TagNameField {} +pub struct TagSetName(String); +impl From for TagSetParam { + fn from(value: TagSetName) -> Self { + Self::Name(value.0) + } +} +impl TagNameField { + pub fn contains(&self, value: String) -> TagWhereParam { + TagWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> TagWhereParam { + TagWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> TagWhereParam { + TagWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> TagWhereParam { + TagWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + TagSetName(value).into() + } +} +pub struct TagEncryptionField {} +pub struct TagSetEncryption(i64); +impl From for TagSetParam { + fn from(value: TagSetEncryption) -> Self { + Self::Encryption(value.0) + } +} +impl TagEncryptionField { + pub fn lt(&self, value: i64) -> TagWhereParam { + TagWhereParam::EncryptionLT(value) + } + pub fn gt(&self, value: i64) -> TagWhereParam { + TagWhereParam::EncryptionGT(value) + } + pub fn lte(&self, value: i64) -> TagWhereParam { + TagWhereParam::EncryptionLTE(value) + } + pub fn gte(&self, value: i64) -> TagWhereParam { + TagWhereParam::EncryptionGTE(value) + } + pub fn equals(&self, value: i64) -> TagWhereParam { + TagWhereParam::EncryptionEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagSetEncryption(value).into() + } +} +pub struct TagTotalFilesField {} +pub struct TagSetTotalFiles(i64); +impl From for TagSetParam { + fn from(value: TagSetTotalFiles) -> Self { + Self::TotalFiles(value.0) + } +} +impl TagTotalFilesField { + pub fn lt(&self, value: i64) -> TagWhereParam { + TagWhereParam::TotalFilesLT(value) + } + pub fn gt(&self, value: i64) -> TagWhereParam { + TagWhereParam::TotalFilesGT(value) + } + pub fn lte(&self, value: i64) -> TagWhereParam { + TagWhereParam::TotalFilesLTE(value) + } + pub fn gte(&self, value: i64) -> TagWhereParam { + TagWhereParam::TotalFilesGTE(value) + } + pub fn equals(&self, value: i64) -> TagWhereParam { + TagWhereParam::TotalFilesEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagSetTotalFiles(value).into() + } +} +pub struct TagRedundancyGoalField {} +pub struct TagSetRedundancyGoal(i64); +impl From for TagSetParam { + fn from(value: TagSetRedundancyGoal) -> Self { + Self::RedundancyGoal(value.0) + } +} +impl TagRedundancyGoalField { + pub fn lt(&self, value: i64) -> TagWhereParam { + TagWhereParam::RedundancyGoalLT(value) + } + pub fn gt(&self, value: i64) -> TagWhereParam { + TagWhereParam::RedundancyGoalGT(value) + } + pub fn lte(&self, value: i64) -> TagWhereParam { + TagWhereParam::RedundancyGoalLTE(value) + } + pub fn gte(&self, value: i64) -> TagWhereParam { + TagWhereParam::RedundancyGoalGTE(value) + } + pub fn equals(&self, value: i64) -> TagWhereParam { + TagWhereParam::RedundancyGoalEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagSetRedundancyGoal(value).into() + } +} +pub struct TagDateCreatedField {} +pub struct TagSetDateCreated(chrono::DateTime); +impl From for TagSetParam { + fn from(value: TagSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl TagDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + TagSetDateCreated(value).into() + } +} +pub struct TagDateModifiedField {} +pub struct TagSetDateModified(chrono::DateTime); +impl From for TagSetParam { + fn from(value: TagSetDateModified) -> Self { + Self::DateModified(value.0) + } +} +impl TagDateModifiedField { + pub fn before(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + TagSetDateModified(value).into() + } +} +pub struct TagTagFilesField {} +pub struct TagLinkTagFiles(Vec); +impl From for TagSetParam { + fn from(value: TagLinkTagFiles) -> Self { + Self::LinkTagFiles(value.0.into_iter().map(|v| v.into()).collect()) + } +} +impl TagTagFilesField { + pub fn some(&self, value: Vec) -> TagWhereParam { + TagWhereParam::TagFilesSome(value) + } + pub fn every(&self, value: Vec) -> TagWhereParam { + TagWhereParam::TagFilesEvery(value) + } + pub fn link>(&self, value: Vec) -> T { + TagLinkTagFiles(value).into() + } + pub fn unlink(&self, params: Vec) -> TagSetParam { + TagSetParam::UnlinkTagFiles(params) + } + pub fn fetch(&self, params: Vec) -> TagWith { + TagWithParam::TagFiles(params).into() + } +} +pub enum TagWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + EncryptionLT(i64), + EncryptionGT(i64), + EncryptionLTE(i64), + EncryptionGTE(i64), + EncryptionEquals(i64), + TotalFilesLT(i64), + TotalFilesGT(i64), + TotalFilesLTE(i64), + TotalFilesGTE(i64), + TotalFilesEquals(i64), + RedundancyGoalLT(i64), + RedundancyGoalGT(i64), + RedundancyGoalLTE(i64), + RedundancyGoalGTE(i64), + RedundancyGoalEquals(i64), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + TagFilesSome(Vec), + TagFilesEvery(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl TagWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLT(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGT(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLTE(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGTE(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesEquals(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLT(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGT(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLTE(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGTE(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalEquals(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagFilesSome(value) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagFilesEvery(value) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct TagWith { + pub param: TagWithParam, +} +pub enum TagWithParam { + TagFiles(Vec), +} +impl From for TagWith { + fn from(param: TagWithParam) -> Self { + Self { param } + } +} +impl TagWithParam { + pub fn output(self) -> Output { + match self { + Self::TagFiles(where_params) => Output { + name: "tag_files".into(), + outputs: tag_on_file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params.into_iter().map(|f| f.field()).collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum TagSetParam { + Id(i64), + Name(String), + Encryption(i64), + TotalFiles(i64), + RedundancyGoal(i64), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + LinkTagFiles(Vec), + UnlinkTagFiles(Vec), +} +impl TagSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalFiles(value) => Field { + name: "total_files".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::RedundancyGoal(value) => Field { + name: "redundancy_goal".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkTagFiles(where_params) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkTagFiles(where_params) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params.into_iter().map(|item| item.field()).collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct TagFindMany<'a> { + query: Query<'a>, +} +impl<'a> TagFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> TagDelete<'a> { + TagDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Tag".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagFindFirst<'a> { + query: Query<'a>, +} +impl<'a> TagFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagFindUnique<'a> { + query: Query<'a>, +} +impl<'a> TagFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> TagDelete<'a> { + TagDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Tag".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagCreateOne<'a> { + query: Query<'a>, +} +impl<'a> TagCreateOne<'a> { + pub async fn exec(self) -> TagData { + self.query.perform::().await.unwrap() + } +} +pub struct TagUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> TagUpdateUnique<'a> { + pub async fn exec(self) -> TagData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> TagUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagDelete<'a> { + query: Query<'a>, +} +impl<'a> TagDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct TagActions<'a> { + client: &'a PrismaClient, +} +impl<'a> TagActions<'a> { + pub fn find_unique(&self, param: TagWhereParam) -> TagFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Tag".into(), + outputs: tag_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + TagFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> TagFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Tag".into(), + outputs: tag_outputs(), + inputs, + }; + TagFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> TagFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Tag".into(), + outputs: tag_outputs(), + inputs, + }; + TagFindMany { query } + } + pub fn create_one(&self, params: Vec) -> TagCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Tag".into(), + outputs: tag_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + TagCreateOne { query } + } +} +fn tag_on_file_outputs() -> Vec { + vec![ + Output::new("date_created"), + Output::new("tag_id"), + Output::new("file_id"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TagOnFileData { + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "tag_id")] + pub tag_id: i64, + #[serde(rename = "tag")] + tag: Box>, + #[serde(rename = "file_id")] + pub file_id: i64, + #[serde(rename = "file")] + file: Box>, +} +impl TagOnFileData { + pub fn tag(&self) -> Result<&TagData, String> { + match self.tag.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access tag but did not fetch it using the .with() syntax".to_string(), + ), + } + } + pub fn file(&self) -> Result<&FileData, String> { + match self.file.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access file but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct TagOnFile; +impl TagOnFile { + pub fn date_created() -> TagOnFileDateCreatedField { + TagOnFileDateCreatedField {} + } + pub fn tag_id() -> TagOnFileTagIdField { + TagOnFileTagIdField {} + } + pub fn tag() -> TagOnFileTagField { + TagOnFileTagField {} + } + pub fn file_id() -> TagOnFileFileIdField { + TagOnFileFileIdField {} + } + pub fn file() -> TagOnFileFileField { + TagOnFileFileField {} + } + pub fn not(params: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::Not(params) + } + pub fn or(params: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::Or(params) + } + pub fn and(params: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::And(params) + } +} +pub struct TagOnFileDateCreatedField {} +pub struct TagOnFileSetDateCreated(chrono::DateTime); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl TagOnFileDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + TagOnFileSetDateCreated(value).into() + } +} +pub struct TagOnFileTagIdField {} +pub struct TagOnFileSetTagId(i64); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetTagId) -> Self { + Self::TagId(value.0) + } +} +impl TagOnFileTagIdField { + pub fn lt(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLT(value) + } + pub fn gt(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGT(value) + } + pub fn lte(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLTE(value) + } + pub fn gte(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGTE(value) + } + pub fn equals(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagOnFileSetTagId(value).into() + } +} +pub struct TagOnFileTagField {} +pub struct TagOnFileLinkTag(TagWhereParam); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileLinkTag) -> Self { + Self::LinkTag(value.0) + } +} +impl TagOnFileTagField { + pub fn is(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIs(value) + } + pub fn link>(&self, value: TagWhereParam) -> T { + TagOnFileLinkTag(value).into() + } + pub fn fetch(&self) -> TagOnFileWith { + TagOnFileWithParam::Tag.into() + } +} +pub struct TagOnFileFileIdField {} +pub struct TagOnFileSetFileId(i64); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetFileId) -> Self { + Self::FileId(value.0) + } +} +impl TagOnFileFileIdField { + pub fn lt(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLT(value) + } + pub fn gt(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGT(value) + } + pub fn lte(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLTE(value) + } + pub fn gte(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGTE(value) + } + pub fn equals(&self, value: i64) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + TagOnFileSetFileId(value).into() + } +} +pub struct TagOnFileFileField {} +pub struct TagOnFileLinkFile(FileWhereParam); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileLinkFile) -> Self { + Self::LinkFile(value.0) + } +} +impl TagOnFileFileField { + pub fn is(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIs(value) + } + pub fn link>(&self, value: FileWhereParam) -> T { + TagOnFileLinkFile(value).into() + } + pub fn fetch(&self) -> TagOnFileWith { + TagOnFileWithParam::File.into() + } +} +pub enum TagOnFileWhereParam { + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + TagIdLT(i64), + TagIdGT(i64), + TagIdLTE(i64), + TagIdGTE(i64), + TagIdEquals(i64), + TagIs(Vec), + FileIdLT(i64), + FileIdGT(i64), + FileIdLTE(i64), + FileIdGTE(i64), + FileIdEquals(i64), + FileIs(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl TagOnFileWhereParam { + pub fn field(self) -> Field { + match self { + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLT(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGT(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLTE(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGTE(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdEquals(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIs(value) => Field { + name: "tag".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLT(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGT(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLTE(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGTE(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdEquals(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIs(value) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct TagOnFileWith { + pub param: TagOnFileWithParam, +} +pub enum TagOnFileWithParam { + Tag, + File, +} +impl From for TagOnFileWith { + fn from(param: TagOnFileWithParam) -> Self { + Self { param } + } +} +impl TagOnFileWithParam { + pub fn output(self) -> Output { + match self { + Self::Tag => Output { + name: "tag".into(), + outputs: tag_outputs(), + ..Default::default() + }, + Self::File => Output { + name: "file".into(), + outputs: file_outputs(), + ..Default::default() + }, + } + } +} +pub enum TagOnFileSetParam { + DateCreated(chrono::DateTime), + TagId(i64), + LinkTag(TagWhereParam), + FileId(i64), + LinkFile(FileWhereParam), +} +impl TagOnFileSetParam { + pub fn field(self) -> Field { + match self { + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TagId(value) => Field { + name: "tag_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkTag(where_param) => Field { + name: "tag".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFile(where_param) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct TagOnFileFindMany<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> TagOnFileDelete<'a> { + TagOnFileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "TagOnFile".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagOnFileUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagOnFileUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagOnFileFindFirst<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagOnFileFindUnique<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> TagOnFileDelete<'a> { + TagOnFileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "TagOnFile".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagOnFileUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagOnFileUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagOnFileCreateOne<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileCreateOne<'a> { + pub async fn exec(self) -> TagOnFileData { + self.query.perform::().await.unwrap() + } +} +pub struct TagOnFileUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileUpdateUnique<'a> { + pub async fn exec(self) -> TagOnFileData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagOnFileUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct TagOnFileDelete<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct TagOnFileActions<'a> { + client: &'a PrismaClient, +} +impl<'a> TagOnFileActions<'a> { + pub fn find_unique(&self, param: TagOnFileWhereParam) -> TagOnFileFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + TagOnFileFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> TagOnFileFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs, + }; + TagOnFileFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> TagOnFileFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs, + }; + TagOnFileFindMany { query } + } + pub fn create_one( + &self, + tag: TagOnFileLinkTag, + file: TagOnFileLinkFile, + params: Vec, + ) -> TagOnFileCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(TagOnFileSetParam::from(tag).field()); + input_fields.push(TagOnFileSetParam::from(file).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + TagOnFileCreateOne { query } + } +} +fn job_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("client_id"), + Output::new("action"), + Output::new("status"), + Output::new("percentage_complete"), + Output::new("task_count"), + Output::new("completed_task_count"), + Output::new("date_created"), + Output::new("date_modified"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct JobData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "client_id")] + pub client_id: i64, + #[serde(rename = "action")] + pub action: i64, + #[serde(rename = "status")] + pub status: i64, + #[serde(rename = "percentage_complete")] + pub percentage_complete: i64, + #[serde(rename = "task_count")] + pub task_count: i64, + #[serde(rename = "completed_task_count")] + pub completed_task_count: i64, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "clients")] + clients: Box>, +} +impl JobData { + pub fn clients(&self) -> Result<&ClientData, String> { + match self.clients.as_ref() { + Some(v) => Ok(v), + None => Err( + "attempted to access clients but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Job; +impl Job { + pub fn id() -> JobIdField { + JobIdField {} + } + pub fn client_id() -> JobClientIdField { + JobClientIdField {} + } + pub fn action() -> JobActionField { + JobActionField {} + } + pub fn status() -> JobStatusField { + JobStatusField {} + } + pub fn percentage_complete() -> JobPercentageCompleteField { + JobPercentageCompleteField {} + } + pub fn task_count() -> JobTaskCountField { + JobTaskCountField {} + } + pub fn completed_task_count() -> JobCompletedTaskCountField { + JobCompletedTaskCountField {} + } + pub fn date_created() -> JobDateCreatedField { + JobDateCreatedField {} + } + pub fn date_modified() -> JobDateModifiedField { + JobDateModifiedField {} + } + pub fn clients() -> JobClientsField { + JobClientsField {} + } + pub fn not(params: Vec) -> JobWhereParam { + JobWhereParam::Not(params) + } + pub fn or(params: Vec) -> JobWhereParam { + JobWhereParam::Or(params) + } + pub fn and(params: Vec) -> JobWhereParam { + JobWhereParam::And(params) + } +} +pub struct JobIdField {} +pub struct JobSetId(i64); +impl From for JobSetParam { + fn from(value: JobSetId) -> Self { + Self::Id(value.0) + } +} +impl JobIdField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetId(value).into() + } +} +pub struct JobClientIdField {} +pub struct JobSetClientId(i64); +impl From for JobSetParam { + fn from(value: JobSetClientId) -> Self { + Self::ClientId(value.0) + } +} +impl JobClientIdField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::ClientIdLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::ClientIdGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::ClientIdLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::ClientIdGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::ClientIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetClientId(value).into() + } +} +pub struct JobActionField {} +pub struct JobSetAction(i64); +impl From for JobSetParam { + fn from(value: JobSetAction) -> Self { + Self::Action(value.0) + } +} +impl JobActionField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::ActionLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::ActionGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::ActionLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::ActionGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::ActionEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetAction(value).into() + } +} +pub struct JobStatusField {} +pub struct JobSetStatus(i64); +impl From for JobSetParam { + fn from(value: JobSetStatus) -> Self { + Self::Status(value.0) + } +} +impl JobStatusField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::StatusLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::StatusGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::StatusLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::StatusGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::StatusEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetStatus(value).into() + } +} +pub struct JobPercentageCompleteField {} +pub struct JobSetPercentageComplete(i64); +impl From for JobSetParam { + fn from(value: JobSetPercentageComplete) -> Self { + Self::PercentageComplete(value.0) + } +} +impl JobPercentageCompleteField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::PercentageCompleteLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::PercentageCompleteGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::PercentageCompleteLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::PercentageCompleteGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::PercentageCompleteEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetPercentageComplete(value).into() + } +} +pub struct JobTaskCountField {} +pub struct JobSetTaskCount(i64); +impl From for JobSetParam { + fn from(value: JobSetTaskCount) -> Self { + Self::TaskCount(value.0) + } +} +impl JobTaskCountField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::TaskCountLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::TaskCountGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::TaskCountLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::TaskCountGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::TaskCountEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetTaskCount(value).into() + } +} +pub struct JobCompletedTaskCountField {} +pub struct JobSetCompletedTaskCount(i64); +impl From for JobSetParam { + fn from(value: JobSetCompletedTaskCount) -> Self { + Self::CompletedTaskCount(value.0) + } +} +impl JobCompletedTaskCountField { + pub fn lt(&self, value: i64) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLT(value) + } + pub fn gt(&self, value: i64) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGT(value) + } + pub fn lte(&self, value: i64) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLTE(value) + } + pub fn gte(&self, value: i64) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGTE(value) + } + pub fn equals(&self, value: i64) -> JobWhereParam { + JobWhereParam::CompletedTaskCountEquals(value) + } + pub fn set>(&self, value: i64) -> T { + JobSetCompletedTaskCount(value).into() + } +} +pub struct JobDateCreatedField {} +pub struct JobSetDateCreated(chrono::DateTime); +impl From for JobSetParam { + fn from(value: JobSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl JobDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + JobSetDateCreated(value).into() + } +} +pub struct JobDateModifiedField {} +pub struct JobSetDateModified(chrono::DateTime); +impl From for JobSetParam { + fn from(value: JobSetDateModified) -> Self { + Self::DateModified(value.0) + } +} +impl JobDateModifiedField { + pub fn before(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + JobSetDateModified(value).into() + } +} +pub struct JobClientsField {} +pub struct JobLinkClients(ClientWhereParam); +impl From for JobSetParam { + fn from(value: JobLinkClients) -> Self { + Self::LinkClients(value.0) + } +} +impl JobClientsField { + pub fn is(&self, value: Vec) -> JobWhereParam { + JobWhereParam::ClientsIs(value) + } + pub fn link>(&self, value: ClientWhereParam) -> T { + JobLinkClients(value).into() + } + pub fn fetch(&self) -> JobWith { + JobWithParam::Clients.into() + } +} +pub enum JobWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + ClientIdLT(i64), + ClientIdGT(i64), + ClientIdLTE(i64), + ClientIdGTE(i64), + ClientIdEquals(i64), + ActionLT(i64), + ActionGT(i64), + ActionLTE(i64), + ActionGTE(i64), + ActionEquals(i64), + StatusLT(i64), + StatusGT(i64), + StatusLTE(i64), + StatusGTE(i64), + StatusEquals(i64), + PercentageCompleteLT(i64), + PercentageCompleteGT(i64), + PercentageCompleteLTE(i64), + PercentageCompleteGTE(i64), + PercentageCompleteEquals(i64), + TaskCountLT(i64), + TaskCountGT(i64), + TaskCountLTE(i64), + TaskCountGTE(i64), + TaskCountEquals(i64), + CompletedTaskCountLT(i64), + CompletedTaskCountGT(i64), + CompletedTaskCountLTE(i64), + CompletedTaskCountGTE(i64), + CompletedTaskCountEquals(i64), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + ClientsIs(Vec), + Not(Vec), + Or(Vec), + And(Vec), +} +impl JobWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientIdLT(value) => Field { + name: "client_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientIdGT(value) => Field { + name: "client_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientIdLTE(value) => Field { + name: "client_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientIdGTE(value) => Field { + name: "client_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientIdEquals(value) => Field { + name: "client_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLT(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGT(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLTE(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGTE(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionEquals(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLT(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGT(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLTE(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGTE(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusEquals(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PercentageCompleteLT(value) => Field { + name: "percentage_complete".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PercentageCompleteGT(value) => Field { + name: "percentage_complete".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PercentageCompleteLTE(value) => Field { + name: "percentage_complete".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PercentageCompleteGTE(value) => Field { + name: "percentage_complete".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PercentageCompleteEquals(value) => Field { + name: "percentage_complete".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLT(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGT(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLTE(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGTE(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountEquals(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLT(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGT(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLTE(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGTE(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountEquals(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ClientsIs(value) => Field { + name: "clients".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct JobWith { + pub param: JobWithParam, +} +pub enum JobWithParam { + Clients, +} +impl From for JobWith { + fn from(param: JobWithParam) -> Self { + Self { param } + } +} +impl JobWithParam { + pub fn output(self) -> Output { + match self { + Self::Clients => Output { + name: "clients".into(), + outputs: client_outputs(), + ..Default::default() + }, + } + } +} +pub enum JobSetParam { + Id(i64), + ClientId(i64), + Action(i64), + Status(i64), + PercentageComplete(i64), + TaskCount(i64), + CompletedTaskCount(i64), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + LinkClients(ClientWhereParam), +} +impl JobSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::ClientId(value) => Field { + name: "client_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Action(value) => Field { + name: "action".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Status(value) => Field { + name: "status".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::PercentageComplete(value) => Field { + name: "percentage_complete".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TaskCount(value) => Field { + name: "task_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::CompletedTaskCount(value) => Field { + name: "completed_task_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkClients(where_param) => Field { + name: "clients".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub struct JobFindMany<'a> { + query: Query<'a>, +} +impl<'a> JobFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> JobDelete<'a> { + JobDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Job".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> JobUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + JobUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct JobFindFirst<'a> { + query: Query<'a>, +} +impl<'a> JobFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct JobFindUnique<'a> { + query: Query<'a>, +} +impl<'a> JobFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> JobDelete<'a> { + JobDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Job".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> JobUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + JobUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct JobCreateOne<'a> { + query: Query<'a>, +} +impl<'a> JobCreateOne<'a> { + pub async fn exec(self) -> JobData { + self.query.perform::().await.unwrap() + } +} +pub struct JobUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> JobUpdateUnique<'a> { + pub async fn exec(self) -> JobData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct JobUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> JobUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct JobDelete<'a> { + query: Query<'a>, +} +impl<'a> JobDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct JobActions<'a> { + client: &'a PrismaClient, +} +impl<'a> JobActions<'a> { + pub fn find_unique(&self, param: JobWhereParam) -> JobFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + JobFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> JobFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs, + }; + JobFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> JobFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs, + }; + JobFindMany { query } + } + pub fn create_one( + &self, + action: JobSetAction, + clients: JobLinkClients, + params: Vec, + ) -> JobCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(JobSetParam::from(action).field()); + input_fields.push(JobSetParam::from(clients).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + JobCreateOne { query } + } +} +fn space_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("encryption"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("libraryId"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SpaceData { + #[serde(rename = "id")] + pub id: i64, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "encryption")] + pub encryption: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "Library")] + pub library: Box>, + #[serde(rename = "libraryId")] + pub library_id: Option, +} +impl SpaceData { + pub fn library(&self) -> Option<&LibraryData> { + self.library.as_ref().as_ref() + } +} +pub struct Space; +impl Space { + pub fn id() -> SpaceIdField { + SpaceIdField {} + } + pub fn name() -> SpaceNameField { + SpaceNameField {} + } + pub fn encryption() -> SpaceEncryptionField { + SpaceEncryptionField {} + } + pub fn date_created() -> SpaceDateCreatedField { + SpaceDateCreatedField {} + } + pub fn date_modified() -> SpaceDateModifiedField { + SpaceDateModifiedField {} + } + pub fn library() -> SpaceLibraryField { + SpaceLibraryField {} + } + pub fn library_id() -> SpaceLibraryIdField { + SpaceLibraryIdField {} + } + pub fn not(params: Vec) -> SpaceWhereParam { + SpaceWhereParam::Not(params) + } + pub fn or(params: Vec) -> SpaceWhereParam { + SpaceWhereParam::Or(params) + } + pub fn and(params: Vec) -> SpaceWhereParam { + SpaceWhereParam::And(params) + } +} +pub struct SpaceIdField {} +pub struct SpaceSetId(i64); +impl From for SpaceSetParam { + fn from(value: SpaceSetId) -> Self { + Self::Id(value.0) + } +} +impl SpaceIdField { + pub fn lt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::IdLT(value) + } + pub fn gt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::IdGT(value) + } + pub fn lte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::IdLTE(value) + } + pub fn gte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::IdGTE(value) + } + pub fn equals(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::IdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + SpaceSetId(value).into() + } +} +pub struct SpaceNameField {} +pub struct SpaceSetName(String); +impl From for SpaceSetParam { + fn from(value: SpaceSetName) -> Self { + Self::Name(value.0) + } +} +impl SpaceNameField { + pub fn contains(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameContains(value) + } + pub fn has_prefix(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameHasSuffix(value) + } + pub fn equals(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameEquals(value) + } + pub fn set>(&self, value: String) -> T { + SpaceSetName(value).into() + } +} +pub struct SpaceEncryptionField {} +pub struct SpaceSetEncryption(i64); +impl From for SpaceSetParam { + fn from(value: SpaceSetEncryption) -> Self { + Self::Encryption(value.0) + } +} +impl SpaceEncryptionField { + pub fn lt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLT(value) + } + pub fn gt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGT(value) + } + pub fn lte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLTE(value) + } + pub fn gte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGTE(value) + } + pub fn equals(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::EncryptionEquals(value) + } + pub fn set>(&self, value: i64) -> T { + SpaceSetEncryption(value).into() + } +} +pub struct SpaceDateCreatedField {} +pub struct SpaceSetDateCreated(chrono::DateTime); +impl From for SpaceSetParam { + fn from(value: SpaceSetDateCreated) -> Self { + Self::DateCreated(value.0) + } +} +impl SpaceDateCreatedField { + pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + SpaceSetDateCreated(value).into() + } +} +pub struct SpaceDateModifiedField {} +pub struct SpaceSetDateModified(chrono::DateTime); +impl From for SpaceSetParam { + fn from(value: SpaceSetDateModified) -> Self { + Self::DateModified(value.0) + } +} +impl SpaceDateModifiedField { + pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedAfterEquals(value) + } + pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedEquals(value) + } + pub fn set>(&self, value: chrono::DateTime) -> T { + SpaceSetDateModified(value).into() + } +} +pub struct SpaceLibraryField {} +pub struct SpaceLinkLibrary(LibraryWhereParam); +impl From for SpaceSetParam { + fn from(value: SpaceLinkLibrary) -> Self { + Self::LinkLibrary(value.0) + } +} +impl SpaceLibraryField { + pub fn is(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::LibraryIs(value) + } + pub fn link>(&self, value: LibraryWhereParam) -> T { + SpaceLinkLibrary(value).into() + } + pub fn fetch(&self) -> SpaceWith { + SpaceWithParam::Library.into() + } + pub fn unlink(&self) -> SpaceSetParam { + SpaceSetParam::UnlinkLibrary + } +} +pub struct SpaceLibraryIdField {} +pub struct SpaceSetLibraryId(i64); +impl From for SpaceSetParam { + fn from(value: SpaceSetLibraryId) -> Self { + Self::LibraryId(value.0) + } +} +impl SpaceLibraryIdField { + pub fn lt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLT(value) + } + pub fn gt(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGT(value) + } + pub fn lte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLTE(value) + } + pub fn gte(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGTE(value) + } + pub fn equals(&self, value: i64) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdEquals(value) + } + pub fn set>(&self, value: i64) -> T { + SpaceSetLibraryId(value).into() + } +} +pub enum SpaceWhereParam { + IdLT(i64), + IdGT(i64), + IdLTE(i64), + IdGTE(i64), + IdEquals(i64), + NameContains(String), + NameHasPrefix(String), + NameHasSuffix(String), + NameEquals(String), + EncryptionLT(i64), + EncryptionGT(i64), + EncryptionLTE(i64), + EncryptionGTE(i64), + EncryptionEquals(i64), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateCreatedEquals(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + LibraryIs(Vec), + LibraryIdLT(i64), + LibraryIdGT(i64), + LibraryIdLTE(i64), + LibraryIdGTE(i64), + LibraryIdEquals(i64), + Not(Vec), + Or(Vec), + And(Vec), +} +impl SpaceWhereParam { + pub fn field(self) -> Field { + match self { + Self::IdLT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGT(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGTE(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGT(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGTE(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIs(value) => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "AND".into(), + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLT(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGT(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLTE(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGTE(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdEquals(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::Not(value) => Field { + name: "NOT".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "OR".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.field()).collect()), + ..Default::default() + }, + } + } +} +pub struct SpaceWith { + pub param: SpaceWithParam, +} +pub enum SpaceWithParam { + Library, +} +impl From for SpaceWith { + fn from(param: SpaceWithParam) -> Self { + Self { param } + } +} +impl SpaceWithParam { + pub fn output(self) -> Output { + match self { + Self::Library => Output { + name: "Library".into(), + outputs: library_outputs(), + ..Default::default() + }, + } + } +} +pub enum SpaceSetParam { + Id(i64), + Name(String), + Encryption(i64), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + LinkLibrary(LibraryWhereParam), + UnlinkLibrary, + LibraryId(i64), +} +impl SpaceSetParam { + pub fn field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkLibrary(where_param) => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![where_param.field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnlinkLibrary => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryId(value) => Field { + name: "libraryId".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub struct SpaceFindMany<'a> { + query: Query<'a>, +} +impl<'a> SpaceFindMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> SpaceDelete<'a> { + SpaceDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Space".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> SpaceUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + SpaceUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct SpaceFindFirst<'a> { + query: Query<'a>, +} +impl<'a> SpaceFindFirst<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct SpaceFindUnique<'a> { + query: Query<'a>, +} +impl<'a> SpaceFindUnique<'a> { + pub async fn exec(self) -> Option { + self.query.perform::>().await.unwrap() + } + pub fn delete(self) -> SpaceDelete<'a> { + SpaceDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Space".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> SpaceUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + SpaceUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + } + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct SpaceCreateOne<'a> { + query: Query<'a>, +} +impl<'a> SpaceCreateOne<'a> { + pub async fn exec(self) -> SpaceData { + self.query.perform::().await.unwrap() + } +} +pub struct SpaceUpdateUnique<'a> { + query: Query<'a>, +} +impl<'a> SpaceUpdateUnique<'a> { + pub async fn exec(self) -> SpaceData { + self.query.perform::().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct SpaceUpdateMany<'a> { + query: Query<'a>, +} +impl<'a> SpaceUpdateMany<'a> { + pub async fn exec(self) -> Vec { + self.query.perform::>().await.unwrap() + } + pub fn with(mut self, fetches: Vec) -> Self { + let outputs = fetches + .into_iter() + .map(|f| f.param.output()) + .collect::>(); + self.query.outputs.extend(outputs); + self + } +} +pub struct SpaceDelete<'a> { + query: Query<'a>, +} +impl<'a> SpaceDelete<'a> { + pub async fn exec(self) -> isize { + self.query.perform::().await.unwrap().count + } +} +pub struct SpaceActions<'a> { + client: &'a PrismaClient, +} +impl<'a> SpaceActions<'a> { + pub fn find_unique(&self, param: SpaceWhereParam) -> SpaceFindUnique { + let fields = transform_equals(vec![param.field()]); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Space".into(), + outputs: space_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + SpaceFindUnique { query } + } + pub fn find_first(&self, params: Vec) -> SpaceFindFirst { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Space".into(), + outputs: space_outputs(), + inputs, + }; + SpaceFindFirst { query } + } + pub fn find_many(&self, params: Vec) -> SpaceFindMany { + let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Space".into(), + outputs: space_outputs(), + inputs, + }; + SpaceFindMany { query } + } + pub fn create_one(&self, name: SpaceSetName, params: Vec) -> SpaceCreateOne { + let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + input_fields.push(SpaceSetParam::from(name).field()); + let query = Query { + ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Space".into(), + outputs: space_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + SpaceCreateOne { query } + } +} diff --git a/packages/core/src/tx/commit.rs b/packages/core/src/tx/commit.rs index 41e67084c..a4d306edc 100644 --- a/packages/core/src/tx/commit.rs +++ b/packages/core/src/tx/commit.rs @@ -1,52 +1,35 @@ +use chrono::{DateTime, Utc}; +use prisma_client_rust::SerializeQuery; use serde::{Deserialize, Serialize}; +use uuid::Uuid; +use crate::state; + +// an SQL commit to be sent to connected clients #[derive(Serialize, Deserialize)] pub struct Commit { - pub commit_type: CommitType, - pub client_id: u32, - pub library_id: u32, + pub id: String, pub timestamp: DateTime, - pub sql: Option, -} - -enum CommitType { - Create, - Mutate, - Delete, + pub client_uuid: String, + pub library_uuid: String, + pub sql: String, } impl Commit { - pub fn new(commit_type: CommitType, sql: Option) -> Self { - Self { commit_type, sql } + pub fn new(sql: String) -> Self { + let client = state::client::get(); + let id = Uuid::new_v4().to_string(); + let timestamp = Utc::now(); + Self { + id, + sql, + client_uuid: client.client_id, + library_uuid: client.current_library_id, + timestamp, + } } pub fn from_query(query: T) -> Self { - Self::new(CommitType::Mutate, query.serialize_query()) + Self::new(query.serialize_query()) } } - -struct RawQuery(String); - -trait SerializeQuery { - fn serialize_query(self) -> String; -} - -struct PostFindMany { - query: String, -} - -impl SerializeQuery for PostFindUnique { - fn serialize_query(self) -> String { - RawQuery(self.query) - } -} - -fn main() { - // example - Commit::from_query( - client - .post() - .find_unique(Post::id().equals("post0".to_string())) - .with(vec![Post::user().fetch()]), - ); -} diff --git a/packages/core/src/tx/mod.rs b/packages/core/src/tx/mod.rs index e69de29bb..6cfaa824a 100644 --- a/packages/core/src/tx/mod.rs +++ b/packages/core/src/tx/mod.rs @@ -0,0 +1 @@ +// pub mod commit;