diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..b45689720 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +prisma = "run -p ark-prisma-cli --" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70a5e4282..3f06b8e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - + check: needs: setup name: Check @@ -34,6 +34,13 @@ jobs: profile: minimal toolchain: stable override: true + + - name: Prisma generate + uses: actions-rs/cargo@v1 + with: + command: prisma + args: generate + - name: Run cargo check uses: actions-rs/cargo@v1 with: @@ -42,18 +49,23 @@ jobs: codecoverage: if: github.event_name == 'pull_request' needs: check - name: Test + name: Coverage runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v2 - name: Cache cargo dependencies uses: Swatinem/rust-cache@v2 + - name: Prisma generate + uses: actions-rs/cargo@v1 + with: + command: prisma + args: generate - name: Run cargo-tarpaulin uses: actions-rs/tarpaulin@v0.1 with: - version: '0.15.0' - args: '-- --test-threads 1' + version: "0.15.0" + args: "-- --test-threads 1" - name: Upload to codecov.io uses: codecov/codecov-action@v1.0.2 with: @@ -73,6 +85,13 @@ jobs: uses: actions/checkout@v2 - name: Cache cargo dependencies uses: Swatinem/rust-cache@v2 + + - name: Prisma generate + uses: actions-rs/cargo@v1 + with: + command: prisma + args: generate + - name: Run cargo test uses: actions-rs/cargo@v1 with: @@ -95,11 +114,19 @@ jobs: toolchain: stable override: true components: rustfmt, clippy + + - name: Prisma generate + uses: actions-rs/cargo@v1 + with: + command: prisma + args: generate + - name: Run cargo fmt uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check + - name: Run cargo clippy uses: actions-rs/cargo@v1 with: diff --git a/.gitignore b/.gitignore index 6e26162c5..9b2f6aa1c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ crates/ark-metadata/images/**/* .env .aws + +# Prisma +crates/ark-storage/src/prisma.rs +*/dev.db diff --git a/Cargo.lock b/Cargo.lock index 7cf21275e..9b576be19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,11 +28,43 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.10", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "1.0.5" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "aho-corasick" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -69,12 +101,12 @@ dependencies = [ "ark-serialize", "ark-std", "derivative", - "digest", - "itertools", + "digest 0.10.7", + "itertools 0.10.5", "num-bigint", "num-traits", "paste", - "rustc_version", + "rustc_version 0.4.0", "zeroize", ] @@ -110,7 +142,9 @@ dependencies = [ "ark-starknet", "ark-storage", "dotenv", + "futures", "log", + "mockall", "starknet", "tokio", "tracing", @@ -140,6 +174,13 @@ dependencies = [ "urlencoding", ] +[[package]] +name = "ark-prisma-cli" +version = "0.1.0" +dependencies = [ + "prisma-client-rust-cli", +] + [[package]] name = "ark-rs" version = "0.1.0" @@ -162,7 +203,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-std", - "digest", + "digest 0.10.7", "num-bigint", ] @@ -186,16 +227,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", - "rand", + "rand 0.8.5", ] [[package]] name = "ark-storage" version = "0.1.0" dependencies = [ + "async-trait", "log", "mockall", "num-bigint", + "prisma-client-rust", "serde", "serde_json", "starknet", @@ -207,6 +250,24 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + +[[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-trait" version = "0.1.73" @@ -215,7 +276,29 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", +] + +[[package]] +name = "asynchronous-codec" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + +[[package]] +name = "atomic-shim" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cd4b51d303cf3501c301e8125df442128d3c6d7c69f71b27833d253de47e77" +dependencies = [ + "crossbeam-utils", ] [[package]] @@ -417,7 +500,7 @@ dependencies = [ "once_cell", "percent-encoding", "regex", - "sha2", + "sha2 0.10.7", "time", "tracing", ] @@ -451,7 +534,7 @@ dependencies = [ "md-5", "pin-project-lite", "sha1", - "sha2", + "sha2 0.10.7", "tracing", ] @@ -473,7 +556,7 @@ dependencies = [ "hyper-rustls", "lazy_static", "pin-project-lite", - "rustls", + "rustls 0.21.7", "tokio", "tower", "tracing", @@ -509,7 +592,7 @@ dependencies = [ "pin-project-lite", "pin-utils", "tokio", - "tokio-util", + "tokio-util 0.7.9", "tracing", ] @@ -620,7 +703,7 @@ dependencies = [ "aws-smithy-http", "aws-smithy-types", "http", - "rustc_version", + "rustc_version 0.4.0", "tracing", ] @@ -639,6 +722,28 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base36" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9c26bddc1271f7112e5ec797e8eeba6de2de211c1488e506b9500196dbf77c5" +dependencies = [ + "base-x", + "failure", +] + +[[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.1" @@ -673,6 +778,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 = "bitflags" version = "1.3.2" @@ -697,6 +827,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -706,6 +845,88 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bson" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58da0ae1e701ea752cc46c1bb9f39d5ecefc7395c3ecd526261a566d4f16e0c2" +dependencies = [ + "ahash 0.8.3", + "base64 0.13.1", + "bitvec", + "chrono", + "hex", + "indexmap 1.9.3", + "js-sys", + "once_cell", + "rand 0.8.5", + "serde", + "serde_bytes", + "serde_json", + "time", + "uuid 1.4.1", +] + +[[package]] +name = "builtin-psl-connectors" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "connection-string 0.1.14", + "either", + "enumflags2", + "indoc", + "lsp-types", + "once_cell", + "psl-core", + "regex", +] + [[package]] name = "bumpalo" version = "3.14.0" @@ -718,6 +939,28 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "byteorder" version = "1.4.3" @@ -749,6 +992,15 @@ dependencies = [ "libc", ] +[[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 = "1.0.0" @@ -757,14 +1009,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "wasm-bindgen", "windows-targets", ] @@ -778,6 +1032,87 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys", +] + +[[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 = "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 = "connection-string" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510ca239cf13b7f8d16a2b48f263de7b4f8c566f0af58d901031473c76afb1e3" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "convert_case" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -809,7 +1144,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" dependencies = [ - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -822,63 +1157,198 @@ dependencies = [ ] [[package]] -name = "crunchy" -version = "0.2.2" +name = "crossbeam" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] [[package]] -name = "crypto-bigint" -version = "0.5.3" +name = "crossbeam-channel" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "generic-array", - "subtle", - "zeroize", + "cfg-if", + "crossbeam-utils", ] [[package]] -name = "crypto-common" -version = "0.1.6" +name = "crossbeam-deque" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "generic-array", - "typenum", + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "ctr" -version = "0.9.2" +name = "crossbeam-epoch" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ - "cipher", + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", ] [[package]] -name = "darling" -version = "0.20.3" +name = "crossbeam-queue" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "darling_core", - "darling_macro", + "cfg-if", + "crossbeam-utils", ] [[package]] -name = "darling_core" -version = "0.20.3" +name = "crossbeam-utils" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +dependencies = [ + "generic-array", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "cuid" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51294db11d38eb763c92936c5c88425d0090e27dce21dd15748134af9e53e739" +dependencies = [ + "base36", + "cuid-util", + "cuid2", + "hostname", + "num", + "once_cell", + "rand 0.8.5", +] + +[[package]] +name = "cuid-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea2bfe0336ff1b7ca74819b2df8dfae9afea358aff6b1688baa5c181d8c3713" + +[[package]] +name = "cuid2" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d99cacd52fd67db7490ad051c8c1973fb75520174d69aabbae08c534c9d0e8" +dependencies = [ + "cuid-util", + "num", + "rand 0.8.5", + "sha3", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core 0.20.3", + "darling_macro 0.20.3", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.33", + "syn 2.0.37", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core 0.13.4", + "quote", + "syn 1.0.109", ] [[package]] @@ -887,9 +1357,26 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core", + "darling_core 0.20.3", "quote", - "syn 2.0.33", + "syn 2.0.37", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "datamodel-renderer" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "base64 0.13.1", + "once_cell", + "psl", + "regex", ] [[package]] @@ -912,23 +1399,108 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 1.0.109", +] + +[[package]] +name = "diagnostics" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "colored", + "indoc", + "pest", +] + [[package]] name = "difflib" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "crypto-common", "subtle", ] +[[package]] +name = "directories" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dml" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "chrono", + "cuid", + "either", + "enumflags2", + "indoc", + "prisma-value", + "psl-core", + "schema-ast", + "serde", + "serde_json", + "uuid 1.4.1", +] + +[[package]] +name = "dmmf" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "bigdecimal", + "indexmap 1.9.3", + "prisma-models", + "psl", + "schema", + "schema-builder", + "serde", + "serde_json", +] + [[package]] name = "dotenv" version = "0.15.0" @@ -947,6 +1519,70 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[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 = "encoding_rs" version = "0.8.33" @@ -956,6 +1592,44 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enumflags2" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -991,15 +1665,15 @@ checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ "aes", "ctr", - "digest", + "digest 0.10.7", "hex", "hmac", "pbkdf2", - "rand", + "rand 0.8.5", "scrypt", "serde", "serde_json", - "sha2", + "sha2 0.10.7", "sha3", "thiserror", "uuid 0.8.2", @@ -1032,12 +1706,52 @@ dependencies = [ "uint", ] +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + [[package]] name = "fastrand" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1045,11 +1759,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" + [[package]] name = "flate2" version = "1.0.27" @@ -1057,6 +1777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", + "libz-sys", "miniz_oxide", ] @@ -1106,18 +1827,86 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] -name = "funty" -version = "2.0.0" +name = "frunk" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +checksum = "11a351b59e12f97b4176ee78497dff72e4276fb1ceb13e19056aca7fa0206287" +dependencies = [ + "frunk_core", + "frunk_derives", + "frunk_proc_macros", +] [[package]] -name = "futures-channel" +name = "frunk_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af2469fab0bd07e64ccf0ad57a1438f63160c69b2e57f04a439653d68eb558d6" + +[[package]] +name = "frunk_derives" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn 2.0.37", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b54add839292b743aeda6ebedbd8b11e93404f902c56223e51b9ec18a13d2c" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn 2.0.37", +] + +[[package]] +name = "frunk_proc_macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71b85a1d4a9a6b300b41c05e8e13ef2feca03e0334127f29eca9506a7fe13a93" +dependencies = [ + "frunk_core", + "frunk_proc_macro_helpers", + "quote", + "syn 2.0.37", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -1126,6 +1915,23 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + [[package]] name = "futures-macro" version = "0.3.28" @@ -1134,7 +1940,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -1149,15 +1955,25 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + [[package]] name = "futures-util" version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ + "futures-channel", "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -1173,6 +1989,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.10" @@ -1182,7 +2009,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1192,6 +2019,22 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "graphql-parser" +version = "0.3.0" +source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3" +dependencies = [ + "combine", + "indexmap 1.9.3", + "thiserror", +] + [[package]] name = "h2" version = "0.3.21" @@ -1207,15 +2050,36 @@ dependencies = [ "indexmap 1.9.3", "slab", "tokio", - "tokio-util", + "tokio-util 0.7.9", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.6", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] [[package]] name = "hashbrown" @@ -1223,11 +2087,35 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +[[package]] +name = "hashlink" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +dependencies = [ + "hashbrown 0.11.2", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1241,7 +2129,18 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", ] [[package]] @@ -1312,10 +2211,10 @@ dependencies = [ "http", "hyper", "log", - "rustls", + "rustls 0.21.7", "rustls-native-certs", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", ] [[package]] @@ -1328,7 +2227,7 @@ dependencies = [ "hyper", "native-tls", "tokio", - "tokio-native-tls", + "tokio-native-tls 0.3.1", ] [[package]] @@ -1360,6 +2259,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.4.0" @@ -1429,6 +2339,12 @@ dependencies = [ "hashbrown 0.14.0", ] +[[package]] +name = "indoc" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" + [[package]] name = "inout" version = "0.1.3" @@ -1438,12 +2354,59 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "introspection-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "anyhow", + "async-trait", + "enumflags2", + "psl", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", +] + +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.4", + "widestring", + "windows-sys", + "winreg", +] + [[package]] name = "ipnet" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1453,6 +2416,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1461,13 +2433,39 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-rpc-api-build" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "backtrace", + "heck 0.3.3", + "serde", + "toml", +] + +[[package]] +name = "jsonrpc-core" +version = "17.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4467ab6dfa369b69e52bd0692e480c4d117410538526a57a304a0f2250fd95e" +dependencies = [ + "futures", + "futures-executor", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "keccak" version = "0.1.4" @@ -1484,108 +2482,654 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] -name = "libc" -version = "0.2.148" +name = "lazycell" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] -name = "linux-raw-sys" -version = "0.4.7" +name = "lexical" +version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" +dependencies = [ + "lexical-core", +] [[package]] -name = "lock_api" -version = "0.4.10" +name = "lexical-core" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" dependencies = [ - "autocfg", - "scopeguard", + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", ] [[package]] -name = "log" -version = "0.4.20" +name = "lexical-parse-float" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] [[package]] -name = "matchers" -version = "0.1.0" +name = "lexical-parse-integer" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" dependencies = [ - "regex-automata 0.1.10", + "lexical-util", + "static_assertions", ] [[package]] -name = "md-5" -version = "0.10.5" +name = "lexical-util" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" dependencies = [ - "digest", + "static_assertions", ] [[package]] -name = "memchr" -version = "2.6.3" +name = "lexical-write-float" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] [[package]] -name = "mime" -version = "0.3.17" +name = "lexical-write-integer" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", + "static_assertions", +] [[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "libc" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] -name = "mio" -version = "0.8.8" +name = "libloading" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "libc", - "wasi", - "windows-sys", + "cfg-if", + "winapi", ] [[package]] -name = "mockall" +name = "libsqlite3-sys" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lsp-types" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2368312c59425dd133cb9a327afee65be0a633a8ce471d248e2202a48f8f68ae" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + +[[package]] +name = "md5" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d" + +[[package]] +name = "memchr" +version = "2.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metrics" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e52eb6380b6d2a10eb3434aec0885374490f5b82c8aaf5cd487a183c98be834" +dependencies = [ + "ahash 0.7.6", + "metrics-macros", +] + +[[package]] +name = "metrics" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2" +dependencies = [ + "ahash 0.7.6", + "metrics-macros", +] + +[[package]] +name = "metrics-exporter-prometheus" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953cbbb6f9ba4b9304f4df79b98cdc9d14071ed93065a9fca11c00c5d9181b66" +dependencies = [ + "hyper", + "indexmap 1.9.3", + "ipnet", + "metrics 0.19.0", + "metrics-util 0.13.0", + "parking_lot 0.11.2", + "quanta", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "metrics-macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e30813093f757be5cf21e50389a24dc7dbb22c49f23b7e8f51d69b508a5ffa" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "metrics-util" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65a9e83b833e1d2e07010a386b197c13aa199bbd0fca5cf69bfa147972db890a" +dependencies = [ + "aho-corasick 0.7.20", + "atomic-shim", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.11.2", + "indexmap 1.9.3", + "metrics 0.18.1", + "num_cpus", + "ordered-float", + "parking_lot 0.11.2", + "quanta", + "radix_trie", + "sketches-ddsketch", +] + +[[package]] +name = "metrics-util" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50" +dependencies = [ + "atomic-shim", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.11.2", + "metrics 0.19.0", + "num_cpus", + "parking_lot 0.11.2", + "quanta", + "sketches-ddsketch", +] + +[[package]] +name = "migration-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "chrono", + "enumflags2", + "introspection-connector", + "psl", + "sha2 0.9.9", + "tracing", + "tracing-error", + "user-facing-errors", +] + +[[package]] +name = "migration-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "async-trait", + "chrono", + "enumflags2", + "json-rpc-api-build", + "jsonrpc-core", + "migration-connector", + "mongodb-migration-connector", + "psl", + "serde", + "serde_json", + "sql-migration-connector", + "tokio", + "tracing", + "tracing-futures", + "tracing-subscriber", + "url", + "user-facing-errors", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + +[[package]] +name = "mobc" +version = "0.7.3" +source = "git+https://github.com/prisma/mobc?tag=1.0.6#80462c4870a2bf6aab49da15c88c021bae531da8" +dependencies = [ + "async-trait", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "log", + "metrics 0.18.1", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "mockall" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c84490118f2ee2d74570d114f3d0493cbf02790df303d2707606c3e14e07c96" dependencies = [ - "cfg-if", - "downcast", - "fragile", + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mongodb" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16928502631c0db72214720aa479c722397fe5aed6bf1c740a3830b3fe4bfcfe" +dependencies = [ + "async-trait", + "base64 0.13.1", + "bitflags 1.3.2", + "bson", + "chrono", + "derivative", + "derive_more", + "futures-core", + "futures-executor", + "futures-io", + "futures-util", + "hex", + "hmac", + "lazy_static", + "md-5", + "pbkdf2", + "percent-encoding", + "rand 0.8.5", + "rustc_version_runtime", + "rustls 0.20.9", + "rustls-pemfile", + "serde", + "serde_bytes", + "serde_with 1.14.0", + "sha-1", + "sha2 0.10.7", + "socket2 0.4.9", + "stringprep", + "strsim", + "take_mut", + "thiserror", + "tokio", + "tokio-rustls 0.23.4", + "tokio-util 0.7.9", + "trust-dns-proto", + "trust-dns-resolver", + "typed-builder", + "uuid 1.4.1", + "webpki-roots 0.22.6", +] + +[[package]] +name = "mongodb-client" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "mongodb", + "once_cell", + "percent-encoding", + "thiserror", +] + +[[package]] +name = "mongodb-introspection-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "async-trait", + "convert_case 0.5.0", + "datamodel-renderer", + "enumflags2", + "futures", + "indoc", + "introspection-connector", + "mongodb", + "mongodb-client", + "mongodb-schema-describer", + "once_cell", + "psl", + "regex", + "serde_json", + "thiserror", + "user-facing-errors", +] + +[[package]] +name = "mongodb-migration-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "enumflags2", + "futures", + "migration-connector", + "mongodb", + "mongodb-client", + "mongodb-introspection-connector", + "mongodb-schema-describer", + "psl", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "mongodb-query-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal", + "bson", + "chrono", + "cuid", + "futures", + "indexmap 1.9.3", + "itertools 0.10.5", + "mongodb", + "mongodb-client", + "prisma-models", + "prisma-value", + "psl", + "query-connector", + "query-engine-metrics", + "rand 0.7.3", + "regex", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "mongodb-schema-describer" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "futures", + "mongodb", + "serde", +] + +[[package]] +name = "mysql_async" +version = "0.30.0" +source = "git+https://github.com/prisma/mysql_async?rev=e3f8bdb41d57e769412f53d0f479bf67fdcc0ee3#e3f8bdb41d57e769412f53d0f479bf67fdcc0ee3" +dependencies = [ + "bytes", + "crossbeam", + "flate2", + "futures-core", + "futures-sink", + "futures-util", "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", + "lru", + "mio", + "mysql_common", + "native-tls", + "once_cell", + "pem", + "percent-encoding", + "pin-project", + "serde", + "serde_json", + "socket2 0.4.9", + "thiserror", + "tokio", + "tokio-native-tls 0.3.0", + "tokio-util 0.7.9", + "twox-hash", + "url", ] [[package]] -name = "mockall_derive" -version = "0.11.4" +name = "mysql_common" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" +checksum = "9006c95034ccf7b903d955f210469119f6c3477fc9c9e7a7845ce38a3e665c2a" dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 1.0.109", + "base64 0.13.1", + "bigdecimal", + "bindgen", + "bitflags 1.3.2", + "bitvec", + "byteorder", + "bytes", + "cc", + "cmake", + "crc32fast", + "flate2", + "frunk", + "lazy_static", + "lexical", + "num-bigint", + "num-traits", + "rand 0.8.5", + "regex", + "rust_decimal", + "saturating", + "serde", + "serde_json", + "sha1", + "sha2 0.10.7", + "smallvec", + "subprocess", + "thiserror", + "time", + "uuid 1.4.1", ] [[package]] @@ -1606,6 +3150,25 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -1622,6 +3185,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -1633,6 +3210,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1643,6 +3229,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -1677,6 +3286,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl" version = "0.10.57" @@ -1700,7 +3315,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -1711,9 +3326,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.3+3.1.2" +version = "300.1.5+3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107" +checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" dependencies = [ "cc", ] @@ -1731,6 +3346,55 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "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-float" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" + [[package]] name = "outref" version = "0.5.1" @@ -1763,12 +3427,23 @@ version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1776,7 +3451,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.8", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -1787,11 +3476,23 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", "windows-targets", ] +[[package]] +name = "parser-database" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "diagnostics", + "either", + "enumflags2", + "indexmap 1.9.3", + "schema-ast", +] + [[package]] name = "paste" version = "1.0.14" @@ -1804,7 +3505,22 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[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.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", ] [[package]] @@ -1813,6 +3529,79 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.37", +] + +[[package]] +name = "pest_meta" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.7", +] + +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +dependencies = [ + "fixedbitset", + "ordermap", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.3" @@ -1830,7 +3619,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -1851,6 +3640,49 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "postgres-native-tls" +version = "0.5.0" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#74f0847e9a8ac350c48dd65c4c33e9be5fcf6010" +dependencies = [ + "native-tls", + "tokio", + "tokio-native-tls 0.3.1", + "tokio-postgres", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.4" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#74f0847e9a8ac350c48dd65c4c33e9be5fcf6010" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "fallible-iterator", + "hmac", + "md-5", + "memchr", + "rand 0.8.5", + "sha2 0.10.7", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.4" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#74f0847e9a8ac350c48dd65c4c33e9be5fcf6010" +dependencies = [ + "bit-vec", + "bytes", + "chrono", + "fallible-iterator", + "postgres-protocol", + "serde", + "serde_json", + "uuid 1.4.1", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1865,7 +3697,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -1887,6 +3719,12 @@ dependencies = [ "termtree", ] +[[package]] +name = "pretty-hex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" + [[package]] name = "primitive-types" version = "0.12.1" @@ -1900,6 +3738,128 @@ dependencies = [ "uint", ] +[[package]] +name = "prisma-client-rust" +version = "0.6.8" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.9#895aac7b33c6b516bc7bee80819db8c3348e674d" +dependencies = [ + "base64 0.13.1", + "bigdecimal", + "chrono", + "diagnostics", + "dml", + "dmmf", + "dotenv", + "futures", + "indexmap 1.9.3", + "migration-core", + "paste", + "prisma-client-rust-macros", + "prisma-models", + "psl", + "query-connector", + "query-core", + "schema", + "serde", + "serde-value", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "prisma-client-rust-cli" +version = "0.6.8" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.9#895aac7b33c6b516bc7bee80819db8c3348e674d" +dependencies = [ + "directories", + "flate2", + "http", + "prisma-client-rust-sdk", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "prisma-client-rust-macros" +version = "0.6.8" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.9#895aac7b33c6b516bc7bee80819db8c3348e674d" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prisma-client-rust-sdk" +version = "0.6.8" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.9#895aac7b33c6b516bc7bee80819db8c3348e674d" +dependencies = [ + "convert_case 0.5.0", + "dml", + "dmmf", + "prisma-models", + "proc-macro2", + "psl", + "query-core", + "quote", + "request-handlers", + "serde", + "serde_json", + "serde_path_to_error", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "prisma-models" +version = "0.0.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "bigdecimal", + "chrono", + "itertools 0.10.5", + "once_cell", + "prisma-value", + "psl", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "prisma-value" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "base64 0.12.3", + "bigdecimal", + "chrono", + "once_cell", + "regex", + "serde", + "serde_json", + "uuid 1.4.1", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -1943,6 +3903,203 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psl" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "builtin-psl-connectors", + "dml", + "psl-core", +] + +[[package]] +name = "psl-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "bigdecimal", + "chrono", + "diagnostics", + "enumflags2", + "indoc", + "itertools 0.10.5", + "lsp-types", + "once_cell", + "parser-database", + "prisma-value", + "regex", + "schema-ast", + "serde", + "serde_json", + "url", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quaint" +version = "0.2.0-alpha.13" +source = "git+https://github.com/Brendonovich/quaint?tag=0.6.5#2bf0c3620f76d83982c17e567b71da6fc9d65d14" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal", + "bit-vec", + "byteorder", + "bytes", + "chrono", + "connection-string 0.1.14", + "either", + "futures", + "hex", + "libsqlite3-sys", + "lru-cache", + "metrics 0.18.1", + "mobc", + "mysql_async", + "native-tls", + "num_cpus", + "percent-encoding", + "postgres-native-tls", + "postgres-types", + "rusqlite", + "serde_json", + "sqlformat", + "thiserror", + "tiberius", + "tokio", + "tokio-postgres", + "tokio-util 0.6.10", + "tracing", + "tracing-core", + "url", + "uuid 1.4.1", +] + +[[package]] +name = "quanta" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" +dependencies = [ + "crossbeam-utils", + "libc", + "mach", + "once_cell", + "raw-cpuid", + "wasi 0.10.2+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + +[[package]] +name = "query-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "indexmap 1.9.3", + "itertools 0.10.5", + "prisma-models", + "prisma-value", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "query-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal", + "chrono", + "connection-string 0.1.14", + "crossbeam-queue", + "cuid", + "enumflags2", + "futures", + "indexmap 1.9.3", + "itertools 0.10.5", + "lazy_static", + "lru", + "mongodb-client", + "mongodb-query-connector", + "once_cell", + "opentelemetry", + "parking_lot 0.12.1", + "petgraph", + "pin-utils", + "prisma-models", + "prisma-value", + "psl", + "query-connector", + "query-engine-metrics", + "schema", + "schema-builder", + "serde", + "serde_json", + "sql-query-connector", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-opentelemetry", + "tracing-subscriber", + "url", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "query-engine-metrics" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "metrics 0.18.1", + "metrics-exporter-prometheus", + "metrics-util 0.12.1", + "once_cell", + "parking_lot 0.12.1", + "serde", + "serde_json", + "tracing", + "tracing-futures", + "tracing-subscriber", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.33" @@ -1958,6 +4115,29 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -1965,8 +4145,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -1976,7 +4166,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -1985,7 +4184,34 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.10", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-cpuid" +version = "10.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", ] [[package]] @@ -1997,13 +4223,24 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.10", + "redox_syscall 0.2.16", + "thiserror", +] + [[package]] name = "regex" version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.1", "memchr", "regex-automata 0.3.8", "regex-syntax 0.7.5", @@ -2024,7 +4261,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.1", "memchr", "regex-syntax 0.7.5", ] @@ -2036,10 +4273,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "rend" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "request-handlers" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "bigdecimal", + "connection-string 0.1.14", + "dmmf", + "futures", + "graphql-parser", + "indexmap 1.9.3", + "itertools 0.10.5", + "psl", + "query-core", + "serde", + "serde_json", + "thiserror", + "tracing", + "url", + "user-facing-errors", +] [[package]] name = "reqwest" @@ -2066,23 +4334,33 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.7", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", - "tokio-rustls", + "tokio-native-tls 0.3.1", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.25.2", "winreg", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -2108,6 +4386,34 @@ dependencies = [ "winapi", ] +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid 1.4.1", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rlp" version = "0.5.2" @@ -2118,32 +4424,89 @@ dependencies = [ "rustc-hex", ] +[[package]] +name = "rusqlite" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152" +dependencies = [ + "bitflags 1.3.2", + "chrono", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "memchr", + "smallvec", +] + +[[package]] +name = "rust_decimal" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" +dependencies = [ + "arrayvec", + "borsh", + "bytes", + "num-traits", + "rand 0.8.5", + "rkyv", + "serde", + "serde_json", +] + [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[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.19", +] + +[[package]] +name = "rustc_version_runtime" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d31b7153270ebf48bf91c65ae5b0c00e749c4cfad505f66530ac74950249582f" +dependencies = [ + "rustc_version 0.2.3", + "semver 0.9.0", ] [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" dependencies = [ "bitflags 2.4.0", "errno", @@ -2152,6 +4515,18 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "rustls" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "rustls" version = "0.21.7" @@ -2187,9 +4562,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -2210,6 +4585,12 @@ dependencies = [ "cipher", ] +[[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.22" @@ -2219,6 +4600,39 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "schema" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "once_cell", + "prisma-models", + "psl", +] + +[[package]] +name = "schema-ast" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "diagnostics", + "pest", + "pest_derive", +] + +[[package]] +name = "schema-builder" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "itertools 0.10.5", + "lazy_static", + "once_cell", + "prisma-models", + "psl", + "schema", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2234,7 +4648,7 @@ dependencies = [ "hmac", "pbkdf2", "salsa20", - "sha2", + "sha2 0.10.7", ] [[package]] @@ -2247,6 +4661,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "security-framework" version = "2.9.2" @@ -2272,9 +4692,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" + +[[package]] +name = "semver-parser" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" @@ -2285,6 +4720,25 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.188" @@ -2293,7 +4747,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -2302,6 +4756,7 @@ version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -2318,6 +4773,27 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2330,6 +4806,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde", + "serde_with_macros 1.5.2", +] + [[package]] name = "serde_with" version = "2.3.3" @@ -2342,31 +4828,67 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "serde_with_macros", + "serde_with_macros 2.3.3", "time", ] +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling 0.13.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_with_macros" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ - "darling", + "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", ] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ + "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest", + "digest 0.9.0", + "opaque-debug", ] [[package]] @@ -2377,7 +4899,7 @@ checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -2386,7 +4908,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] @@ -2399,6 +4921,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2408,6 +4936,24 @@ dependencies = [ "libc", ] +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "sketches-ddsketch" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d2ecae5fcf33b122e2e6bd520a57ccf152d2dde3b38c71039df1a6867264ee" + [[package]] name = "slab" version = "0.4.9" @@ -2419,9 +4965,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -2447,7 +4993,125 @@ dependencies = [ name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "sql-ddl" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" + +[[package]] +name = "sql-introspection-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal", + "datamodel-renderer", + "enumflags2", + "introspection-connector", + "once_cell", + "psl", + "quaint", + "regex", + "serde", + "serde_json", + "sql-schema-describer", + "thiserror", + "tracing", + "tracing-futures", + "user-facing-errors", +] + +[[package]] +name = "sql-migration-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "chrono", + "connection-string 0.1.14", + "either", + "enumflags2", + "indoc", + "migration-connector", + "once_cell", + "psl", + "quaint", + "regex", + "serde_json", + "sql-ddl", + "sql-introspection-connector", + "sql-schema-describer", + "tokio", + "tracing", + "tracing-futures", + "url", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "sql-query-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal", + "chrono", + "cuid", + "futures", + "itertools 0.10.5", + "once_cell", + "opentelemetry", + "prisma-models", + "prisma-value", + "psl", + "quaint", + "query-connector", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-opentelemetry", + "user-facing-errors", + "uuid 1.4.1", +] + +[[package]] +name = "sql-schema-describer" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "async-trait", + "bigdecimal", + "enumflags2", + "indexmap 1.9.3", + "indoc", + "once_cell", + "psl", + "quaint", + "regex", + "serde", + "tracing", + "tracing-error", + "tracing-futures", +] + +[[package]] +name = "sqlformat" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" +dependencies = [ + "itertools 0.11.0", + "nom", + "unicode_categories", +] [[package]] name = "starknet" @@ -2486,7 +5150,7 @@ checksum = "d0d6f81a647694b2cb669ab60e77954b57bf5fbc757f5fcaf0a791c3bd341f04" dependencies = [ "serde", "serde_json", - "serde_with", + "serde_with 2.3.3", "starknet-accounts", "starknet-core 0.5.1", "starknet-providers", @@ -2505,7 +5169,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with", + "serde_with 2.3.3", "sha3", "starknet-crypto", "starknet-ff", @@ -2523,7 +5187,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with", + "serde_with 2.3.3", "sha3", "starknet-crypto", "starknet-ff", @@ -2542,7 +5206,7 @@ dependencies = [ "num-integer", "num-traits", "rfc6979", - "sha2", + "sha2 0.10.7", "starknet-crypto-codegen", "starknet-curve", "starknet-ff", @@ -2557,7 +5221,7 @@ checksum = "af6527b845423542c8a16e060ea1bc43f67229848e7cd4c4d80be994a84220ce" dependencies = [ "starknet-curve", "starknet-ff", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -2578,7 +5242,7 @@ dependencies = [ "ark-ff", "bigdecimal", "crypto-bigint", - "getrandom", + "getrandom 0.2.10", "hex", "num-bigint", "serde", @@ -2591,7 +5255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef846b6bb48fc8c3e9a2aa9b5b037414f04a908d9db56493a3ae69a857eb2506" dependencies = [ "starknet-core 0.6.0", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -2608,7 +5272,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_with", + "serde_with 2.3.3", "starknet-core 0.5.1", "thiserror", "url", @@ -2624,7 +5288,7 @@ dependencies = [ "auto_impl", "crypto-bigint", "eth-keystore", - "rand", + "rand 0.8.5", "starknet-core 0.5.1", "starknet-crypto", "thiserror", @@ -2636,12 +5300,33 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subprocess" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "subtle" version = "2.5.0" @@ -2661,15 +5346,33 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.33" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + +[[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" @@ -2684,7 +5387,7 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.3.5", "rustix", "windows-sys", ] @@ -2712,7 +5415,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -2725,11 +5428,43 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tiberius" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66303a42b7c5daffb95c10cd8f3007a9c29b3e90128cf42b3738f58102aa2516" +dependencies = [ + "async-native-tls", + "async-trait", + "asynchronous-codec", + "bigdecimal", + "byteorder", + "bytes", + "chrono", + "connection-string 0.2.0", + "encoding", + "enumflags2", + "futures", + "futures-sink", + "futures-util", + "num-traits", + "once_cell", + "opentls", + "pin-project-lite", + "pretty-hex", + "thiserror", + "tokio", + "tokio-util 0.7.9", + "tracing", + "uuid 1.4.1", + "winauth", +] + [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -2740,15 +5475,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -2788,7 +5523,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2 0.5.4", @@ -2804,7 +5539,16 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", +] + +[[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]] @@ -2817,13 +5561,47 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-postgres" +version = "0.7.7" +source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#74f0847e9a8ac350c48dd65c4c33e9be5fcf6010" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures-channel", + "futures-util", + "log", + "parking_lot 0.12.1", + "percent-encoding", + "phf", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "socket2 0.4.9", + "tokio", + "tokio-util 0.7.9", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls 0.20.9", + "tokio", + "webpki", +] + [[package]] name = "tokio-rustls" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.7", "tokio", ] @@ -2840,18 +5618,43 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", + "futures-io", "futures-sink", "pin-project-lite", "tokio", "tracing", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml_datetime" version = "0.6.3" @@ -2918,7 +5721,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] [[package]] @@ -2931,6 +5734,26 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.1.3" @@ -2942,6 +5765,20 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + [[package]] name = "tracing-subscriber" version = "0.3.17" @@ -2960,17 +5797,90 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "trust-dns-proto" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.2.3", + "ipnet", + "lazy_static", + "log", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "parking_lot 0.12.1", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typed-builder" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -3005,6 +5915,33 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -3018,8 +5955,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", - "idna", + "idna 0.4.0", "percent-encoding", + "serde", ] [[package]] @@ -3028,13 +5966,37 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "user-facing-error-macros" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "user-facing-errors" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.5#7cc20cc54a7ab0b5e38c81901826939a91a17ba0" +dependencies = [ + "backtrace", + "indoc", + "quaint", + "serde", + "serde_json", + "tracing", + "user-facing-error-macros", +] + [[package]] name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom", + "getrandom 0.2.10", "serde", ] @@ -3043,6 +6005,10 @@ name = "uuid" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +dependencies = [ + "getrandom 0.2.10", + "serde", +] [[package]] name = "valuable" @@ -3062,6 +6028,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "vsimd" version = "0.8.0" @@ -3077,6 +6049,18 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3085,9 +6069,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3095,24 +6079,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", + "lazy_static", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.33", + "syn 1.0.109", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" dependencies = [ "cfg-if", "js-sys", @@ -3122,9 +6106,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3132,39 +6116,64 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "webpki-roots" version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.3.9" @@ -3187,6 +6196,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", +] + [[package]] name = "windows" version = "0.48.0" @@ -3313,5 +6335,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.37", ] diff --git a/Cargo.toml b/Cargo.toml index 61f85331a..8e716dba0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "ark-rs" version = "0.1.0" edition = "2021" +resolver = "2" authors = ["Screenshot Labs", "Starknet community"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -18,6 +19,7 @@ members = [ "crates/ark-starknet", "crates/ark-storage", "crates/ark-indexer", + "crates/ark-prisma-cli", ] [workspace.dependencies] @@ -42,4 +44,4 @@ starknet.workspace = true async-trait.workspace = true [dev-dependencies] -mockall = "0.11.4" \ No newline at end of file +mockall = "0.11.4" diff --git a/crates/ark-indexer/Cargo.toml b/crates/ark-indexer/Cargo.toml index 221f2bb12..e76b68cc4 100644 --- a/crates/ark-indexer/Cargo.toml +++ b/crates/ark-indexer/Cargo.toml @@ -9,6 +9,7 @@ tracing = "0.1" tracing-log = "0.1" dotenv = "0.15.0" log = "0.4" +futures = "0.3" anyhow.workspace = true tokio.workspace = true @@ -16,3 +17,8 @@ ark-starknet.workspace = true ark-metadata.workspace = true ark-storage.workspace = true starknet.workspace = true + +[dev-dependencies] +ark-starknet = { path = "../ark-starknet", features = ["mock"] } +ark-storage = { path = "../ark-storage", features = ["mock"] } +mockall = "0.11.4" diff --git a/crates/ark-indexer/src/lib.rs b/crates/ark-indexer/src/lib.rs index 9ecb7e3a4..d796674fb 100644 --- a/crates/ark-indexer/src/lib.rs +++ b/crates/ark-indexer/src/lib.rs @@ -3,7 +3,7 @@ mod managers; use anyhow::Result; use ark_starknet::client::{StarknetClient, StarknetClientHttp}; use ark_storage::storage_manager::StorageManager; -use ark_storage::types::ContractType; +use ark_storage::types::{BlockIndexingStatus, ContractType}; use dotenv::dotenv; use managers::{BlockManager, CollectionManager, EventManager, TokenManager}; use starknet::core::types::*; @@ -30,17 +30,23 @@ pub async fn main_loop(storage: T) -> Result<()> { let mut to_u64 = sn_client.block_id_to_u64(&to_block).await?; loop { - log::trace!("Indexing block: {} {}", current_u64, to_u64); + log::trace!("Indexing block range: {} {}", current_u64, to_u64); to_u64 = check_range(&sn_client, current_u64, to_u64, poll_head_of_chain).await; if current_u64 > to_u64 { continue; } - if !block_manager.check_candidate(current_u64) { + if !block_manager.check_candidate(current_u64).await { + current_u64 += 1; continue; } + // Set block as pending + block_manager + .set_block_info(current_u64, BlockIndexingStatus::Processing) + .await?; + let block_ts = sn_client.block_time(BlockId::Number(current_u64)).await?; let blocks_events = sn_client @@ -55,32 +61,37 @@ pub async fn main_loop(storage: T) -> Result<()> { for e in events { let contract_address = e.from_address; - let contract_info = - match collection_manager.identify_contract(contract_address).await { - Ok(info) => info, - Err(e) => { - log::error!("Can't identify contract {contract_address}: {:?}", e); - continue; - } - }; + let contract_type = match collection_manager + .identify_contract(contract_address, current_u64) + .await + { + Ok(info) => info, + Err(e) => { + log::error!( + "Error while identifying contract {}: {:?}", + contract_address, + e + ); + continue; + } + }; - let contract_type = contract_info.r#type; if contract_type == ContractType::Other { continue; } let token_event = match event_manager - .format_event(&e, contract_type, block_ts) + .format_and_register_event(&e, contract_type, block_ts) .await { Ok(te) => te, Err(err) => { - log::error!("Can't format event {:?}\nevent: {:?}", err, e); + log::error!("Error while registering event {:?}\n{:?}", err, e); continue; } }; - match token_manager.format_token(&token_event).await { + match token_manager.format_and_register_token(&token_event).await { Ok(()) => (), Err(err) => { log::error!("Can't format token {:?}\ntevent: {:?}", err, token_event); @@ -90,6 +101,10 @@ pub async fn main_loop(storage: T) -> Result<()> { } } + block_manager + .set_block_info(current_u64, BlockIndexingStatus::Terminated) + .await?; + // set block as indexed here current_u64 += 1; } } diff --git a/crates/ark-indexer/src/managers/block_manager.rs b/crates/ark-indexer/src/managers/block_manager.rs index 417951a29..81ae46c40 100644 --- a/crates/ark-indexer/src/managers/block_manager.rs +++ b/crates/ark-indexer/src/managers/block_manager.rs @@ -1,6 +1,6 @@ use ark_starknet::client::StarknetClient; use ark_storage::storage_manager::StorageManager; -use ark_storage::types::StorageError; +use ark_storage::types::{BlockIndexingStatus, BlockInfo, StorageError}; use starknet::core::types::*; use std::env; @@ -49,7 +49,7 @@ impl<'a, T: StorageManager, C: StarknetClient> BlockManager<'a, T, C> { /// Returns true if the given block number must be indexed. /// False otherwise. - pub fn check_candidate(&self, block_number: u64) -> bool { + pub async fn check_candidate(&self, block_number: u64) -> bool { // If we are indexing the head of the chain, we don't need to check let do_force: &bool = &env::var("FORCE_MODE") .unwrap_or("false".to_string()) @@ -57,13 +57,14 @@ impl<'a, T: StorageManager, C: StarknetClient> BlockManager<'a, T, C> { .unwrap_or(false); if *do_force { - return self.storage.clean_block(block_number).is_ok(); + return self.storage.clean_block(block_number).await.is_ok(); } - match self.storage.get_block_info(block_number) { + match self.storage.get_block_info(block_number).await { Ok(info) => { + log::debug!("Block {} already indexed", block_number); if self.indexer_version > info.indexer_version { - self.storage.clean_block(block_number).is_ok() + self.storage.clean_block(block_number).await.is_ok() } else { false } @@ -72,4 +73,99 @@ impl<'a, T: StorageManager, C: StarknetClient> BlockManager<'a, T, C> { Err(_) => false, } } + + pub async fn set_block_info( + &self, + block_number: u64, + status: BlockIndexingStatus, + ) -> Result<(), StorageError> { + self.storage + .set_block_info( + block_number, + BlockInfo { + indexer_version: self.indexer_version, + indexer_identifier: env::var("INDEXER_IDENTIFIER").unwrap_or("".to_string()), + status, + }, + ) + .await?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use ark_starknet::client::MockStarknetClient; + use ark_storage::{ + storage_manager::MockStorageManager, + types::{BlockIndexingStatus, BlockInfo}, + }; + + use super::*; + + #[test] + fn test_get_block_range() { + let mut mock_client = MockStarknetClient::default(); + let mock_storage = MockStorageManager::default(); + + mock_client + .expect_parse_block_range() + .returning(|_, _| Ok((BlockId::Number(1), BlockId::Tag(BlockTag::Latest)))); + + let manager = BlockManager { + storage: &mock_storage, + client: &mock_client, + indexer_version: 1, + }; + + env::set_var("START_BLOCK", "1"); + env::set_var("END_BLOCK", "latest"); + + let (from, to, is_head) = manager.get_block_range(); + assert_eq!(from, BlockId::Number(1)); + assert_eq!(to, BlockId::Tag(BlockTag::Latest)); + assert!(is_head); + + // Cleanup environment variables after the test + env::remove_var("START_BLOCK"); + env::remove_var("END_BLOCK"); + } + + #[tokio::test] + async fn test_check_candidate() { + let mock_client = MockStarknetClient::default(); + let mut mock_storage = MockStorageManager::default(); + + mock_storage + .expect_clean_block() + .returning(|_| Box::pin(futures::future::ready(Ok(())))); + + mock_storage + .expect_get_block_info() + .returning(|block_number| { + Box::pin(futures::future::ready(if block_number == 1 { + Ok(BlockInfo { + indexer_version: 0, + status: BlockIndexingStatus::None, + indexer_identifier: String::from("123"), + }) + } else { + Err(StorageError::NotFound) + })) + }); + + let manager = BlockManager { + storage: &mock_storage, + client: &mock_client, + indexer_version: 1, + }; + + env::set_var("FORCE_MODE", "false"); + + assert!(manager.check_candidate(1).await); + assert!(manager.check_candidate(2).await); + + // Cleanup environment variable after the test + env::remove_var("FORCE_MODE"); + } } diff --git a/crates/ark-indexer/src/managers/collection_manager.rs b/crates/ark-indexer/src/managers/collection_manager.rs index 0f7bbb380..78c04a30c 100644 --- a/crates/ark-indexer/src/managers/collection_manager.rs +++ b/crates/ark-indexer/src/managers/collection_manager.rs @@ -1,8 +1,8 @@ use anyhow::Result; use ark_starknet::client::StarknetClient; use ark_storage::storage_manager::StorageManager; +use ark_storage::types::ContractType; use ark_storage::types::StorageError; -use ark_storage::types::{ContractInfo, ContractType}; use starknet::core::types::{BlockId, BlockTag, FieldElement}; use starknet::core::utils::{get_selector_from_name, parse_cairo_short_string}; use std::collections::HashMap; @@ -10,8 +10,8 @@ use std::collections::HashMap; pub struct CollectionManager<'a, T: StorageManager, C: StarknetClient> { storage: &'a T, client: &'a C, - /// A cache with contract address mapped to it's type. - cache: HashMap, + /// A cache with contract address mapped to its type. + cache: HashMap, } impl<'a, T: StorageManager, C: StarknetClient> CollectionManager<'a, T, C> { @@ -25,28 +25,31 @@ impl<'a, T: StorageManager, C: StarknetClient> CollectionManager<'a, T, C> { } /// Gets the contract info from local cache, or fetch is from the DB. - fn get_cached_or_fetch_info( + async fn get_cached_or_fetch_info( &mut self, address: FieldElement, - ) -> Result { - if let Some(info) = self.cache.get(&address) { - return Ok(info.clone()); + ) -> Result { + if let Some(contract_type) = self.cache.get(&address) { + return Ok(contract_type.clone()); } log::trace!("Cache miss for contract {}", address); - let info = self.storage.get_contract_info(&address)?; + let contract_type = self.storage.get_contract_type(&address).await?; - self.cache.insert(address, info.clone()); // Adding to the cache + self.cache.insert(address, contract_type.clone()); // Adding to the cache - Ok(info) + Ok(contract_type) } - /// Identifies a contract from it's address only. - pub async fn identify_contract(&mut self, address: FieldElement) -> Result { - // The cache is more efficient that formatting to check the BLACKLIST. - match self.get_cached_or_fetch_info(address) { - Ok(info) => Ok(info), + /// Identifies a contract from its address only. + pub async fn identify_contract( + &mut self, + address: FieldElement, + block_number: u64, + ) -> Result { + match self.get_cached_or_fetch_info(address).await { + Ok(contract_type) => Ok(contract_type), Err(_) => { // Can't find info, try to identify with calls. let contract_type = self.get_contract_type(address).await?; @@ -57,17 +60,13 @@ impl<'a, T: StorageManager, C: StarknetClient> CollectionManager<'a, T, C> { contract_type.to_string() ); - let info = ContractInfo { - name: String::new(), - symbol: String::new(), - r#type: contract_type, - }; - - self.cache.insert(address, info.clone()); + self.cache.insert(address, contract_type.clone()); - self.storage.register_contract_info(&address, &info)?; + self.storage + .register_contract_info(&address, &contract_type, block_number) + .await?; - Ok(info) + Ok(contract_type) } } } diff --git a/crates/ark-indexer/src/managers/event_manager.rs b/crates/ark-indexer/src/managers/event_manager.rs index 07067b936..3c73d8d65 100644 --- a/crates/ark-indexer/src/managers/event_manager.rs +++ b/crates/ark-indexer/src/managers/event_manager.rs @@ -4,6 +4,7 @@ use ark_storage::storage_manager::StorageManager; use ark_storage::types::{EventType, TokenEvent, TokenId}; use log::info; use starknet::core::types::{EmittedEvent, FieldElement}; +use starknet::core::utils::starknet_keccak; use starknet::macros::selector; const TRANSFER_SELECTOR: FieldElement = selector!("Transfer"); @@ -28,10 +29,9 @@ impl<'a, T: StorageManager> EventManager<'a, T> { Some(vec![vec![TRANSFER_SELECTOR]]) } - /// Formats a token event based on the event content. - /// Returns the token_id if the event were identified, - /// an Err otherwise. - pub async fn format_event( + /// Formats & register a token event based on the event content. + /// Returns the token_id if the event were identified. + pub async fn format_and_register_event( &mut self, event: &EmittedEvent, contract_type: ContractType, @@ -47,16 +47,11 @@ impl<'a, T: StorageManager> EventManager<'a, T> { } else if let Some(k_info) = Self::get_event_info_from_felts(&event.keys[1..]) { k_info } else { - log::warn!("Can't find event data into this event"); - return Err(anyhow!("Can't format event")); + return Err(anyhow!("Can't find event data into this event")); }; let (from, to, token_id) = event_info; - // TODO: why do we need this entry 2 times for the felt and the string? - // TODO move that to storage - // self.token_event.from_address = format!("{:#064x}", from); - // self.token_event.to_address = format!("{:#064x}", to); self.token_event.from_address_field_element = from; self.token_event.to_address_field_element = to; self.token_event.contract_address = format!("{:#064x}", event.from_address); @@ -67,10 +62,12 @@ impl<'a, T: StorageManager> EventManager<'a, T> { self.token_event.timestamp = timestamp; self.token_event.contract_type = contract_type.to_string(); self.token_event.event_type = Self::get_event_type(from, to); + self.token_event.event_id = self.get_event_id_as_field_element(); info!("Event identified: {:?}", self.token_event.event_type); - - self.storage.register_event(&self.token_event)?; + self.storage + .register_event(&self.token_event, event.block_number) + .await?; Ok(self.token_event.clone()) } @@ -85,6 +82,19 @@ impl<'a, T: StorageManager> EventManager<'a, T> { } } + /// Returns the event id as a field element. + pub fn get_event_id_as_field_element(&self) -> FieldElement { + let mut bytes = Vec::new(); + bytes.extend_from_slice(&self.token_event.token_id.low.to_bytes_be()); + bytes.extend_from_slice(&self.token_event.token_id.high.to_bytes_be()); + bytes.extend_from_slice(&self.token_event.from_address_field_element.to_bytes_be()); + bytes.extend_from_slice(&self.token_event.to_address_field_element.to_bytes_be()); + bytes.extend_from_slice(self.token_event.contract_address.as_bytes()); + bytes.extend_from_slice(self.token_event.transaction_hash.as_bytes()); + bytes.extend_from_slice(&self.token_event.block_number.to_le_bytes()); + starknet_keccak(&bytes) + } + /// Returns the event info from vector of felts. /// Event info are (from, to, token_id). /// @@ -111,3 +121,70 @@ impl<'a, T: StorageManager> EventManager<'a, T> { self.token_event = TokenEvent::default(); } } + +#[cfg(test)] +mod tests { + use super::*; + use ark_storage::storage_manager::MockStorageManager; + + #[test] + fn test_keys_selector() { + let mock_storage = MockStorageManager::default(); + let event_manager = EventManager::new(&mock_storage); + + let selectors = event_manager.keys_selector().unwrap(); + assert_eq!(selectors[0][0], TRANSFER_SELECTOR); + } + + #[test] + fn test_get_event_type() { + let mint_event = EventManager::::get_event_type( + FieldElement::ZERO, + FieldElement::from_dec_str("1").unwrap(), + ); + assert_eq!(mint_event, EventType::Mint); + + let burn_event = EventManager::::get_event_type( + FieldElement::from_dec_str("1").unwrap(), + FieldElement::ZERO, + ); + assert_eq!(burn_event, EventType::Burn); + + let transfer_event = EventManager::::get_event_type( + FieldElement::from_dec_str("1").unwrap(), + FieldElement::from_dec_str("2").unwrap(), + ); + assert_eq!(transfer_event, EventType::Transfer); + } + + #[test] + fn test_get_event_info_from_felts() { + let felts = vec![ + FieldElement::from_dec_str("1").unwrap(), + FieldElement::from_dec_str("2").unwrap(), + FieldElement::from_dec_str("3").unwrap(), + FieldElement::from_dec_str("4").unwrap(), + ]; + + let result = EventManager::::get_event_info_from_felts(&felts); + + assert!(result.is_some()); + let (field1, field2, token_id) = result.unwrap(); + + assert_eq!(field1, FieldElement::from_dec_str("1").unwrap()); + assert_eq!(field2, FieldElement::from_dec_str("2").unwrap()); + assert_eq!(token_id.low, FieldElement::from_dec_str("3").unwrap()); + assert_eq!(token_id.high, FieldElement::from_dec_str("4").unwrap()); + } + + #[test] + fn test_reset_event() { + let mock_storage = MockStorageManager::new(); + let mut manager = EventManager::new(&mock_storage); + + manager.token_event.block_number = 12345; + manager.reset_event(); + + assert_eq!(manager.token_event, TokenEvent::default()); + } +} diff --git a/crates/ark-indexer/src/managers/token_manager.rs b/crates/ark-indexer/src/managers/token_manager.rs index 6f1ba8351..dd2ba2031 100644 --- a/crates/ark-indexer/src/managers/token_manager.rs +++ b/crates/ark-indexer/src/managers/token_manager.rs @@ -9,8 +9,6 @@ use starknet::macros::selector; pub struct TokenManager<'a, T: StorageManager, C: StarknetClient> { storage: &'a T, client: &'a C, - // TODO: Same as event manager, we should use the stack instead. - // check with @kwiss. token: TokenFromEvent, } @@ -25,27 +23,12 @@ impl<'a, T: StorageManager, C: StarknetClient> TokenManager<'a, T, C> { } /// Formats a token registry from the token event data. - pub async fn format_token(&mut self, event: &TokenEvent) -> Result<()> { + pub async fn format_and_register_token(&mut self, event: &TokenEvent) -> Result<()> { self.reset_token(); self.token.address = event.contract_address.clone(); - self.token.padded_token_id = event.padded_token_id.clone(); - self.token.from_address = event.from_address.clone(); - self.token.to_address = event.to_address.clone(); - self.token.timestamp = event.timestamp; - self.token.mint_transaction_hash = if event.event_type == EventType::Mint { - Some(event.transaction_hash.clone()) - } else { - None - }; - self.token.block_number_minted = if event.event_type == EventType::Mint { - Some(event.block_number) - } else { - None - }; - - // TODO: @kwiss, do we want a default value in case we can't get the token owner? - // or do we want to return an error and abort before saving in the storage? + self.token.token_id = event.token_id.clone(); + self.token.formated_token_id = event.formated_token_id.clone(); let token_owner = self .get_token_owner( FieldElement::from_hex_be(&event.contract_address) @@ -54,28 +37,25 @@ impl<'a, T: StorageManager, C: StarknetClient> TokenManager<'a, T, C> { event.token_id.high, ) .await?[0]; - self.token.owner = format!("{:#064x}", token_owner); - log::trace!( - "Registering token: {} {}", - event.token_id.format().token_id, - event.contract_address - ); - - // TODO: do we need to be atomic for register_token and register_mint? - // What is the logic if one of the two fails? - if event.event_type == EventType::Mint { - self.storage.register_mint(&self.token)?; + self.token.mint_address = Some(event.to_address_field_element); + self.token.mint_timestamp = Some(event.timestamp); + self.token.mint_transaction_hash = Some(event.transaction_hash.clone()); + self.token.mint_block_number = Some(event.block_number); + self.storage + .register_mint(&self.token, event.block_number) + .await?; } else { - self.storage.register_token(&self.token)?; + self.storage + .register_token(&self.token, event.block_number) + .await?; } - Ok(()) } - /// + /// Resets the token registry. pub fn reset_token(&mut self) { self.token = TokenFromEvent::default(); } @@ -113,3 +93,52 @@ impl<'a, T: StorageManager, C: StarknetClient> TokenManager<'a, T, C> { } } } + +#[cfg(test)] +mod tests { + use ark_starknet::client::MockStarknetClient; + use ark_storage::storage_manager::MockStorageManager; + + use super::*; + + #[test] + fn test_reset_token() { + let mock_storage = MockStorageManager::default(); + let mock_client = MockStarknetClient::default(); + + let mut token_manager = TokenManager::new(&mock_storage, &mock_client); + + // Modify some values + token_manager.token.owner = String::from("some_owner"); + + token_manager.reset_token(); + + assert_eq!(token_manager.token, TokenFromEvent::default()); + } + + #[tokio::test] + async fn test_get_token_owner() { + let mock_storage = MockStorageManager::default(); + let mut mock_client = MockStarknetClient::default(); + + let contract_address = FieldElement::from_dec_str("12345").unwrap(); + let token_id_low = FieldElement::from_dec_str("23456").unwrap(); + let token_id_high = FieldElement::from_dec_str("34567").unwrap(); + + mock_client + .expect_call_contract() + .returning(|_, _, _, _| Ok(vec![FieldElement::from_dec_str("1").unwrap()])); + + let token_manager = TokenManager::new(&mock_storage, &mock_client); + + let result = token_manager + .get_token_owner(contract_address, token_id_low, token_id_high) + .await; + + assert!(result.is_ok()); + let owners = result.unwrap(); + + assert_eq!(owners.len(), 1); + assert_eq!(owners[0], FieldElement::from_dec_str("1").unwrap()); + } +} diff --git a/crates/ark-prisma-cli/Cargo.toml b/crates/ark-prisma-cli/Cargo.toml new file mode 100644 index 000000000..c80fb2078 --- /dev/null +++ b/crates/ark-prisma-cli/Cargo.toml @@ -0,0 +1,8 @@ + +[package] +name = "ark-prisma-cli" +version = "0.1.0" +edition = "2021" + +[dependencies] +prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.9" } \ No newline at end of file diff --git a/crates/ark-prisma-cli/src/bin/prisma.rs b/crates/ark-prisma-cli/src/bin/prisma.rs new file mode 100644 index 000000000..f7580155a --- /dev/null +++ b/crates/ark-prisma-cli/src/bin/prisma.rs @@ -0,0 +1,3 @@ +fn main() { + prisma_client_rust_cli::run(); +} diff --git a/crates/ark-starknet/Cargo.toml b/crates/ark-starknet/Cargo.toml index 00b9dfc3c..2cf0f4e59 100644 --- a/crates/ark-starknet/Cargo.toml +++ b/crates/ark-starknet/Cargo.toml @@ -13,4 +13,4 @@ mockall = "0.11.2" num-bigint = { version = "0.4.3", default-features = false } [features] -mock = [] \ No newline at end of file +mock = [] diff --git a/crates/ark-storage/Cargo.toml b/crates/ark-storage/Cargo.toml index 7b7930c06..cbab9fd33 100644 --- a/crates/ark-storage/Cargo.toml +++ b/crates/ark-storage/Cargo.toml @@ -4,12 +4,14 @@ version = "0.1.0" edition = "2021" [dependencies] +async-trait = "0.1.73" starknet = "0.5.0" num-bigint = { version = "0.4.3", default-features = false } serde = { version = "1.0.130", features = ["derive"] } log = "0.4.14" serde_json = "1.0" mockall = "0.11.2" +prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.9" } [features] -mock = [] \ No newline at end of file +mock = [] diff --git a/crates/ark-storage/src/default_storage.rs b/crates/ark-storage/src/default_storage.rs new file mode 100644 index 000000000..b16a9f5f6 --- /dev/null +++ b/crates/ark-storage/src/default_storage.rs @@ -0,0 +1,383 @@ +use crate::prisma::PrismaClient; +use crate::prisma::{block, collection, event, token}; +use crate::types::{ + BlockIndexing, BlockInfo, ContractType, StorageError, TokenEvent, TokenFromEvent, +}; +use crate::StorageManager; +use async_trait::async_trait; +use log; +use prisma_client_rust::NewClientError; +use starknet::core::types::FieldElement; + +pub struct DefaultStorage { + prisma_client: PrismaClient, +} + +impl DefaultStorage { + pub async fn new() -> Result { + let client = PrismaClient::_builder().build().await?; + Ok(Self { + prisma_client: client, + }) + } +} + +// TODO - add indexer version check with @remi +// TODO - add tests + +#[async_trait] +impl StorageManager for DefaultStorage { + async fn register_mint( + &self, + token: &TokenFromEvent, + block_number: u64, + ) -> Result<(), StorageError> { + log::debug!("Registering mint {:?}", token); + + let token_from_db: Option = self + .prisma_client + .token() + .find_first(vec![ + token::token_id::equals(token.formated_token_id.token_id.clone()), + token::address::equals(token.address.clone()), + ]) + .exec() + .await + .unwrap(); + + log::debug!("Token found in the database: {:?}\n", token_from_db); + match token_from_db { + Some(data) => { + let result = self + .prisma_client + .token() + .update( + token::id::equals(data.id.clone()), + vec![ + token::owner::set(token.owner.clone()), + token::mint_address::set(Some(format!( + "{:#064x}", + token.mint_address.unwrap() + ))), + token::mint_timestamp::set(Some( + token.mint_timestamp.unwrap().try_into().unwrap(), + )), + token::mint_transaction_hash::set(token.mint_transaction_hash.clone()), + token::mint_block_number::set(Some( + token.mint_block_number.unwrap().try_into().unwrap(), + )), + ], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(e) => { + log::error!("Database error: {:?}", e); + Err(StorageError::DatabaseError) + } + } + } + None => { + let result = self + .prisma_client + .token() + .create( + token.address.clone(), + token.formated_token_id.token_id.clone(), + token.formated_token_id.padded_token_id.clone(), + token.owner.clone(), + block_number as i32, + vec![ + token::mint_address::set(Some(format!( + "{:#064x}", + token.mint_address.unwrap() + ))), + token::mint_timestamp::set(Some( + token.mint_timestamp.unwrap().try_into().unwrap(), + )), + token::mint_transaction_hash::set(token.mint_transaction_hash.clone()), + token::mint_block_number::set(Some( + token.mint_block_number.unwrap().try_into().unwrap(), + )), + ], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(e) => { + log::error!("Database error: {:?}", e); + Err(StorageError::DatabaseError) + } + } + } + } + } + + async fn register_token( + &self, + token: &TokenFromEvent, + block_number: u64, + ) -> Result<(), StorageError> { + log::debug!("Registering token {:?}", token); + + let token_from_db: Option = self + .prisma_client + .token() + .find_first(vec![ + token::token_id::equals(token.formated_token_id.token_id.clone()), + token::address::equals(token.address.clone()), + ]) + .exec() + .await + .unwrap(); + + match token_from_db { + Some(data) => { + let result = self + .prisma_client + .token() + .update( + token::id::equals(data.id.clone()), + vec![token::owner::set(token.owner.clone())], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(e) => { + log::error!("Database error: {:?}", e); + Err(StorageError::DatabaseError) + } + } + } + None => { + let result = self + .prisma_client + .token() + .create( + token.address.clone(), + token.formated_token_id.token_id.clone(), + token.formated_token_id.padded_token_id.clone(), + token.owner.clone(), + block_number as i32, + vec![], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(e) => { + log::error!("Database error: {:?}", e); + Err(StorageError::DatabaseError) + } + } + } + } + } + + async fn register_event( + &self, + event: &TokenEvent, + block_number: u64, + ) -> Result<(), StorageError> { + log::debug!("Registering event {:?}", event); + let event_from_db: Option = self + .prisma_client + .event() + .find_unique(event::event_id::equals(event.event_id.to_string())) + .exec() + .await + .unwrap(); + + match event_from_db { + Some(_) => Err(StorageError::AlreadyExists), + None => { + let from_address = format!("{:#064x}", event.from_address_field_element); + + let to_address = format!("{:#064x}", event.to_address_field_element); + + let result = self + .prisma_client + .event() + .create( + event.event_id.to_string(), + event.timestamp as i32, + from_address, + to_address, + event.contract_address.clone(), + event.transaction_hash.clone(), + event.formated_token_id.token_id.clone(), + event.formated_token_id.padded_token_id.clone(), + event.block_number as i32, + event.contract_type.clone(), + event.event_type.clone().to_string(), + block_number as i32, + vec![], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(e) => { + log::error!("Database error: {:?}", e); + Err(StorageError::DatabaseError) + } + } + } + } + } + + async fn get_contract_type( + &self, + contract_address: &FieldElement, + ) -> Result { + log::debug!("Getting contract info for contract {}", contract_address); + let contract_data: Option = self + .prisma_client + .collection() + .find_unique(collection::contract_address::equals( + contract_address.to_string(), + )) + .exec() + .await + .unwrap(); + match contract_data { + Some(data) => Ok(data.r#type.parse().unwrap()), + None => Err(StorageError::NotFound), + } + } + + async fn register_contract_info( + &self, + contract_address: &FieldElement, + contract_type: &ContractType, + block_number: u64, + ) -> Result<(), StorageError> { + log::debug!( + "Registering contract info {:?} for contract {}", + contract_type, + contract_address + ); + let formated_contract_address = format!("{:#064x}", contract_address); + + let result = self + .prisma_client + .collection() + .create( + formated_contract_address, + contract_type.clone().to_string(), + block_number as i32, + vec![], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(_) => Err(StorageError::AlreadyExists), + } + } + + async fn set_block_info(&self, block_number: u64, info: BlockInfo) -> Result<(), StorageError> { + log::debug!("Setting block info {:?} for block #{}", info, block_number); + let result = self + .prisma_client + .block() + .upsert( + block::number::equals(block_number as i32), + block::create( + block_number as i32, + info.indexer_version.to_string(), + info.indexer_identifier, + info.status.to_string(), + block_number as i32, + vec![], + ), + vec![block::status::set(info.status.to_string())], + ) + .exec() + .await; + match result { + Ok(_) => Ok(()), + Err(_) => Err(StorageError::AlreadyExists), + } + } + + async fn get_block_info(&self, block_number: u64) -> Result { + log::debug!("Getting block info for block #{}", block_number); + let block_data: Option = self + .prisma_client + .block() + .find_unique(block::number::equals(block_number as i32)) + .exec() + .await + .unwrap(); + match block_data { + Some(data) => Ok(BlockInfo { + indexer_version: data.indexer_version.parse().unwrap(), + indexer_identifier: data.indexer_identifier, + status: data + .status + .parse() + .map_err(|_| StorageError::InvalidStatus)?, + }), + None => Err(StorageError::NotFound), + } + } + + async fn clean_block(&self, block_number: u64) -> Result<(), StorageError> { + log::debug!("Cleaning block #{}", block_number); + // TODO: In future, handle and return potential errors + let block_result = self + .prisma_client + .block() + .delete_many(vec![block::indexed_at_block_number::equals( + block_number as i32, + )]) + .exec() + .await; + let event_result = self + .prisma_client + .event() + .delete_many(vec![event::indexed_at_block_number::equals( + block_number as i32, + )]) + .exec() + .await; + let token_result = self + .prisma_client + .token() + .delete_many(vec![token::indexed_at_block_number::equals( + block_number as i32, + )]) + .exec() + .await; + let collection_result = self + .prisma_client + .collection() + .delete_many(vec![collection::indexed_at_block_number::equals( + block_number as i32, + )]) + .exec() + .await; + match (block_result, event_result, token_result, collection_result) { + (Ok(_), Ok(_), Ok(_), Ok(_)) => Ok(()), + _ => Err(StorageError::DatabaseError), + } + } + + // TODO check with @remi + async fn set_indexer_progress( + &self, + indexer_progress: BlockIndexing, + ) -> Result<(), StorageError> { + log::debug!( + "Setting indexer progress to block #{}", + indexer_progress.percentage + ); + // TODO: In future, handle and return potential errors + // Err(StorageError::DatabaseError) + Ok(()) + } +} diff --git a/crates/ark-storage/src/lib.rs b/crates/ark-storage/src/lib.rs index 1eec42c0c..6ea044ec4 100644 --- a/crates/ark-storage/src/lib.rs +++ b/crates/ark-storage/src/lib.rs @@ -1,5 +1,11 @@ +#[allow(warnings, unused)] +pub mod prisma; + +pub mod default_storage; pub mod storage_manager; -pub use storage_manager::{DefaultStorage, StorageManager}; + +pub use default_storage::DefaultStorage; +pub use storage_manager::StorageManager; pub mod types; pub mod utils; diff --git a/crates/ark-storage/src/storage_manager.rs b/crates/ark-storage/src/storage_manager.rs index 0fb2ae899..b5465c59c 100644 --- a/crates/ark-storage/src/storage_manager.rs +++ b/crates/ark-storage/src/storage_manager.rs @@ -1,132 +1,50 @@ use crate::types::{ - BlockIndexing, BlockIndexingStatus, BlockInfo, ContractInfo, StorageError, TokenEvent, - TokenFromEvent, + BlockIndexing, BlockInfo, ContractType, StorageError, TokenEvent, TokenFromEvent, }; -use log; +use async_trait::async_trait; +use starknet::core::types::FieldElement; + #[cfg(any(test, feature = "mock"))] use mockall::automock; -use starknet::core::types::FieldElement; +#[async_trait] #[cfg_attr(any(test, feature = "mock"), automock)] pub trait StorageManager { - fn register_mint(&self, token: &TokenFromEvent) -> Result<(), StorageError>; - - fn register_token(&self, token: &TokenFromEvent) -> Result<(), StorageError>; - - fn clean_block(&self, block_number: u64) -> Result<(), StorageError>; - - fn get_block_info(&self, block_number: u64) -> Result; - - fn get_contract_info( + async fn register_mint( &self, - contract_address: &FieldElement, - ) -> Result; + token: &TokenFromEvent, + block_number: u64, + ) -> Result<(), StorageError>; - fn register_contract_info( + async fn register_token( &self, - contract_address: &FieldElement, - info: &ContractInfo, + token: &TokenFromEvent, + block_number: u64, ) -> Result<(), StorageError>; - fn register_event(&self, event: &TokenEvent) -> Result<(), StorageError>; - - fn set_block_info(&self, block_number: u64, info: BlockInfo) -> Result<(), StorageError>; - - fn set_indexer_progress(&self, progress: BlockIndexing) -> Result<(), StorageError>; -} - -pub struct DefaultStorage; - -impl DefaultStorage { - pub fn new() -> Self { - Self - } -} - -impl Default for DefaultStorage { - fn default() -> Self { - Self::new() - } -} - -impl StorageManager for DefaultStorage { - fn register_token(&self, token: &TokenFromEvent) -> Result<(), StorageError> { - log::debug!("Registering token {:?}", token); - // TODO: In future, handle and return potential errors - // Err(StorageError::DuplicateToken) - Ok(()) - } - - fn register_mint(&self, token: &TokenFromEvent) -> Result<(), StorageError> { - log::debug!("Registering mint {:?}", token); - // TODO: In future, handle and return potential errors - // Err(StorageError::InvalidMintData) - Ok(()) - } - - fn clean_block(&self, block_number: u64) -> Result<(), StorageError> { - log::debug!("Cleaning block #{}", block_number); - // TODO: In future, handle and return potential errors - // Err(StorageError::DatabaseError) - Ok(()) - } - - fn get_block_info(&self, block_number: u64) -> Result { - log::debug!("Getting block info for block #{}", block_number); - // TODO: In future, handle and return potential errors - // Err(StorageError::NotFound) - Ok(BlockInfo { - indexer_version: 0, - indexer_indentifier: "42".to_string(), - status: BlockIndexingStatus::None, - }) - } + async fn register_event( + &self, + event: &TokenEvent, + block_number: u64, + ) -> Result<(), StorageError>; - fn get_contract_info( + async fn get_contract_type( &self, contract_address: &FieldElement, - ) -> Result { - log::debug!("Getting contract info for contract {}", contract_address); - // TODO: In future, handle and return potential errors - Err(StorageError::NotFound) - } + ) -> Result; - fn register_contract_info( + async fn register_contract_info( &self, contract_address: &FieldElement, - info: &ContractInfo, - ) -> Result<(), StorageError> { - log::debug!( - "Registering contract info {:?} for contract {}", - info, - contract_address - ); - // TODO: In future, handle and return potential errors - // Err(StorageError::DuplicateToken) - Ok(()) - } + contract_type: &ContractType, + block_number: u64, + ) -> Result<(), StorageError>; + + async fn set_block_info(&self, block_number: u64, info: BlockInfo) -> Result<(), StorageError>; - fn register_event(&self, event: &TokenEvent) -> Result<(), StorageError> { - log::debug!("Registering event {:?}", event); - // TODO: In future, handle and return potential errors - // Err(StorageError::DatabaseError) - Ok(()) - } + async fn get_block_info(&self, block_number: u64) -> Result; - fn set_block_info(&self, block_number: u64, info: BlockInfo) -> Result<(), StorageError> { - log::debug!("Setting block info {:?} for block #{}", info, block_number); - // TODO: In future, handle and return potential errors - // Err(StorageError::DatabaseError) - Ok(()) - } + async fn clean_block(&self, block_number: u64) -> Result<(), StorageError>; - fn set_indexer_progress(&self, indexer_progress: BlockIndexing) -> Result<(), StorageError> { - log::debug!( - "Setting indexer progress to block #{}", - indexer_progress.percentage - ); - // TODO: In future, handle and return potential errors - // Err(StorageError::DatabaseError) - Ok(()) - } + async fn set_indexer_progress(&self, progress: BlockIndexing) -> Result<(), StorageError>; } diff --git a/crates/ark-storage/src/types.rs b/crates/ark-storage/src/types.rs index ac2210cd0..0b6ef06a0 100644 --- a/crates/ark-storage/src/types.rs +++ b/crates/ark-storage/src/types.rs @@ -3,13 +3,16 @@ use num_bigint::BigUint; use serde::{Deserialize, Serialize}; use starknet::core::types::FieldElement; use std::fmt; +use std::str::FromStr; #[derive(Debug)] pub enum StorageError { DatabaseError, NotFound, + InvalidStatus, DuplicateToken, InvalidMintData, + AlreadyExists, } impl fmt::Display for StorageError { @@ -18,8 +21,10 @@ impl fmt::Display for StorageError { match self { StorageError::DatabaseError => write!(f, "Database error occurred"), StorageError::NotFound => write!(f, "Item not found in storage"), + StorageError::InvalidStatus => write!(f, "Invalid status"), StorageError::DuplicateToken => write!(f, "Token already exists in storage"), StorageError::InvalidMintData => write!(f, "Provided mint data is invalid"), + StorageError::AlreadyExists => write!(f, "Item already exists in storage"), } } } @@ -34,7 +39,18 @@ pub enum EventType { Uninitialized, } -#[derive(Debug, Clone)] +impl fmt::Display for EventType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + EventType::Mint => write!(f, "mint"), + EventType::Burn => write!(f, "burn"), + EventType::Transfer => write!(f, "transfer"), + EventType::Uninitialized => write!(f, "uninitialized"), + } + } +} + +#[derive(Debug, Clone, PartialEq)] pub struct TokenEvent { pub timestamp: u64, pub from_address_field_element: FieldElement, @@ -47,8 +63,8 @@ pub struct TokenEvent { pub formated_token_id: FormattedTokenId, pub block_number: u64, pub contract_type: String, - pub padded_token_id: String, pub event_type: EventType, + pub event_id: FieldElement, } impl Default for TokenEvent { @@ -66,28 +82,46 @@ impl Default for TokenEvent { high: FieldElement::ZERO, }, formated_token_id: FormattedTokenId::default(), - padded_token_id: FormattedTokenId::default().padded_token_id, block_number: 0, contract_type: String::new(), event_type: EventType::Uninitialized, + event_id: FieldElement::ZERO, } } } // Token struct based on the informations we get from an event -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone, PartialEq)] pub struct TokenFromEvent { pub address: String, - pub padded_token_id: String, - pub from_address: String, - pub to_address: String, - pub timestamp: u64, + pub token_id: TokenId, + pub formated_token_id: FormattedTokenId, pub owner: String, + pub mint_address: Option, + pub mint_timestamp: Option, pub mint_transaction_hash: Option, - pub block_number_minted: Option, + pub mint_block_number: Option, +} + +impl Default for TokenFromEvent { + fn default() -> Self { + TokenFromEvent { + address: String::new(), + token_id: TokenId { + low: FieldElement::ZERO, + high: FieldElement::ZERO, + }, + formated_token_id: FormattedTokenId::default(), + owner: String::new(), + mint_address: None, + mint_timestamp: None, + mint_transaction_hash: None, + mint_block_number: None, + } + } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct FormattedTokenId { pub low: u128, pub high: u128, @@ -106,7 +140,7 @@ impl Default for FormattedTokenId { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct TokenId { pub low: FieldElement, pub high: FieldElement, @@ -151,6 +185,29 @@ pub enum BlockIndexingStatus { Terminated, } +impl ToString for BlockIndexingStatus { + fn to_string(&self) -> String { + match self { + BlockIndexingStatus::None => "None".to_string(), + BlockIndexingStatus::Processing => "Processing".to_string(), + BlockIndexingStatus::Terminated => "Terminated".to_string(), + } + } +} + +impl FromStr for BlockIndexingStatus { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + "None" => Ok(BlockIndexingStatus::None), + "Processing" => Ok(BlockIndexingStatus::Processing), + "Terminated" => Ok(BlockIndexingStatus::Terminated), + _ => Err(()), + } + } +} + pub enum IndexerStatus { Running, Stopped, @@ -172,7 +229,7 @@ pub struct BlockIndexing { #[derive(Debug)] pub struct BlockInfo { pub indexer_version: u64, - pub indexer_indentifier: String, + pub indexer_identifier: String, pub status: BlockIndexingStatus, } @@ -194,9 +251,14 @@ impl ToString for ContractType { } } -#[derive(Debug, Clone)] -pub struct ContractInfo { - pub name: String, - pub symbol: String, - pub r#type: ContractType, +impl FromStr for ContractType { + type Err = (); // You can use a more descriptive error type if needed + + fn from_str(s: &str) -> Result { + match s { + "erc721" => Ok(ContractType::ERC721), + "erc1155" => Ok(ContractType::ERC1155), + _ => Ok(ContractType::Other), + } + } } diff --git a/examples/nft_indexer.rs b/examples/nft_indexer.rs index 45a8151f2..65c0447f5 100644 --- a/examples/nft_indexer.rs +++ b/examples/nft_indexer.rs @@ -3,12 +3,14 @@ //! Can be run with `cargo run --example nft_indexer`. //! use anyhow::Result; -use ark_rs::{nft_indexer, nft_storage::DefaultStorage}; +use ark_rs::nft_storage::DefaultStorage; +// use ark_storage::DefaultStorage; +// use ark_indexer; #[tokio::main] async fn main() -> Result<()> { // Initialized any storage implementing the StorageManager trait. - let storage = DefaultStorage::new(); + let storage = DefaultStorage::new().await?; // TODO: the node URL can be passed here, we don't // have to rely on env variables in deeper libraries. @@ -21,7 +23,7 @@ async fn main() -> Result<()> { // the block ranges. // Start the indexer using the storage. - nft_indexer::main_loop(storage).await?; + ark_indexer::main_loop(storage).await?; Ok(()) } diff --git a/prisma/dev.db b/prisma/dev.db new file mode 100644 index 000000000..16f6b8928 Binary files /dev/null and b/prisma/dev.db differ diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 000000000..f5fccbda8 --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,61 @@ +datasource db { + provider = "sqlite" + url = "file:dev.db" +} + +generator client { + // Corresponds to the cargo alias created earlier + provider = "cargo prisma" + // The location to generate the client. Is relative to the position of the schema + output = "../crates/ark-storage/src/prisma.rs" +} + +model Token { + id String @id @default(cuid()) + address String + token_id String + padded_token_id String + owner String + mint_address String? + mint_timestamp Int? + mint_transaction_hash String? + mint_block_number Int? + indexer_version String? + indexed_at_block_number Int + + @@unique([address, token_id]) +} + +model Event { + id String @id @default(cuid()) + event_id String @unique + timestamp Int + from_address String + to_address String + contract_address String + transaction_hash String + token_id String + padded_token_id String + block_number Int + contract_type String + event_type String + indexer_version String? + indexed_at_block_number Int +} + +model Collection { + id String @id @default(cuid()) + contract_address String @unique + type String + indexer_version String? + indexed_at_block_number Int +} + +model Block { + id String @id @default(cuid()) + number Int @unique + indexer_version String + indexer_identifier String + status String + indexed_at_block_number Int +}