diff --git a/.gitattributes b/.gitattributes index 8becc95c1f..3fd6286740 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,7 @@ /frontend/console/src/protos/**/* linguist-generated=true go.sum linguist-generated=true go.work.sum linguist-generated=true -/python-runtime/ftl/src/ftl/protos/**/* linguist-generated=true \ No newline at end of file +/python-runtime/ftl/src/ftl/protos/**/* linguist-generated=true +/sqlc-gen-ftl/src/protos/**/* linguist-generated=true +/sqlc-gen-ftl/src/protos/mod.rs linguist-generated=false +/sqlc-gen-ftl/src/protos/plugin.rs linguist-generated=false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96155d6509..81a512a057 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,18 @@ jobs: run: just build-frontend - name: Console Test run: just test-frontend + test-wasm: + name: Test sqlc-gen-ftl + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Init Hermit + uses: cashapp/activate-hermit@v1.1.3 + - name: Build Cache + uses: ./.github/actions/build-cache + - name: Test WASM + run: cd sqlc-gen-ftl && cargo test --features ci --test sqlc_gen_ftl_test -- --nocapture extension: name: VSCode Extension runs-on: ubuntu-latest diff --git a/Justfile b/Justfile index 69cd770af5..dcc2e885cf 100644 --- a/Justfile +++ b/Justfile @@ -19,6 +19,7 @@ ZIP_DIRS := "go-runtime/compile/build-template " + \ CONSOLE_ROOT := "frontend/console" FRONTEND_OUT := CONSOLE_ROOT + "/dist/index.html" EXTENSION_OUT := "frontend/vscode/dist/extension.js" +SQLC_GEN_FTL_OUT := "sqlc-gen-ftl/target/wasm32-wasip1/release/sqlc-gen-ftl.wasm" PROTOS_IN := "common/protos" PROTOS_OUT := "backend/protos/xyz/block/ftl/console/v1/console.pb.go " + \ "backend/protos/xyz/block/ftl//v1/ftl.pb.go " + \ @@ -73,6 +74,7 @@ clean: rm -rf python-runtime/ftl/.venv find . -name '*.zip' -exec rm {} \; mvn -f jvm-runtime/ftl-runtime clean + cd sqlc-gen-ftl && cargo clean # Live rebuild the ftl binary whenever source changes. live-rebuild: @@ -83,7 +85,7 @@ dev *args: watchexec -r {{WATCHEXEC_ARGS}} -- "ftl dev --plain {{args}}" # Build everything -build-all: build-protos-unconditionally build-backend build-frontend build-backend-tests build-generate build-zips lsp-generate build-jvm build-language-plugins build-go2proto-testdata +build-all: build-protos-unconditionally build-backend build-frontend build-backend-tests build-generate build-zips lsp-generate build-jvm build-language-plugins build-go2proto-testdata build-sqlc-gen-ftl # Run "go generate" on all packages build-generate: @@ -162,6 +164,18 @@ build-frontend: pnpm-install build-extension: pnpm-install @mk {{EXTENSION_OUT}} : frontend/vscode/src frontend/vscode/package.json -- "cd frontend/vscode && rm -f ftl-*.vsix && pnpm run compile" +# Build the sqlc-ftl-gen plugin, used to generate FTL schema from SQL +build-sqlc-gen-ftl: build-protos + @mk {{SQLC_GEN_FTL_OUT}} : sqlc-gen-ftl/src -- \ + "cd sqlc-gen-ftl && \ + cargo build --target wasm32-wasip1 --release" + +cargo-install: + @mk sqlc-gen-ftl/target : sqlc-gen-ftl/Cargo.toml -- \ + "cd sqlc-gen-ftl && \ + cargo install protoc-gen-prost && \ + cargo build" + # Install development version of VSCode extension install-extension: build-extension @cd frontend/vscode && vsce package && code --install-extension ftl-*.vsix @@ -186,6 +200,10 @@ format-frontend: pnpm-install: @for i in {1..3}; do mk frontend/**/node_modules : frontend/**/package.json -- "pnpm install --frozen-lockfile" && break || sleep 5; done +# Copy plugin protos from the SQLC release +update-sqlc-plugin-codegen-proto: + @bash scripts/sqlc-codegen-proto + # Regenerate protos build-protos: go2proto @mk {{PROTOS_OUT}} : {{PROTOS_IN}} -- "@just build-protos-unconditionally" @@ -200,7 +218,6 @@ go2proto: # Unconditionally rebuild protos build-protos-unconditionally: go2proto lint-protos pnpm-install cd common/protos && buf generate - cd backend/protos && buf generate # Run integration test(s) integration-tests *test: diff --git a/backend/protos/buf.gen.yaml b/backend/protos/buf.gen.yaml index dd8e9a8765..b20b039648 100644 --- a/backend/protos/buf.gen.yaml +++ b/backend/protos/buf.gen.yaml @@ -16,3 +16,7 @@ plugins: out: ../../python-runtime/ftl/src/ftl/protos opt: - pyi_out=../../python-runtime/ftl/src/ftl/protos + - plugin: prost + out: ../../sqlc-gen-ftl/src/protos + opt: + - bytes=. diff --git a/bin/.rustup-1.25.2.pkg b/bin/.rustup-1.25.2.pkg new file mode 120000 index 0000000000..383f4511d4 --- /dev/null +++ b/bin/.rustup-1.25.2.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/cargo b/bin/cargo new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/cargo @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-clippy b/bin/cargo-clippy new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/cargo-clippy @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-fmt b/bin/cargo-fmt new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/cargo-fmt @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/cargo-miri b/bin/cargo-miri new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/cargo-miri @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/clippy-driver b/bin/clippy-driver new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/clippy-driver @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rls b/bin/rls new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rls @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-analyzer b/bin/rust-analyzer new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rust-analyzer @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-gdb b/bin/rust-gdb new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rust-gdb @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-gdbgui b/bin/rust-gdbgui new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rust-gdbgui @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rust-lldb b/bin/rust-lldb new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rust-lldb @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustc b/bin/rustc new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rustc @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustdoc b/bin/rustdoc new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rustdoc @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustfmt b/bin/rustfmt new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rustfmt @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/bin/rustup b/bin/rustup new file mode 120000 index 0000000000..5046e66f85 --- /dev/null +++ b/bin/rustup @@ -0,0 +1 @@ +.rustup-1.25.2.pkg \ No newline at end of file diff --git a/scripts/autofmt b/scripts/autofmt index de66eeab7d..1e85c9bd06 100755 --- a/scripts/autofmt +++ b/scripts/autofmt @@ -24,6 +24,8 @@ find backend/protos \( -name '*.pb.go' -o -name '*.connect.go' \) -print0 | xarg just pnpm-install +just cargo-install + (cd backend/protos && buf generate) echo "Formatting TypeScript..." diff --git a/scripts/protoc-gen-prost b/scripts/protoc-gen-prost new file mode 100644 index 0000000000..d23952b803 --- /dev/null +++ b/scripts/protoc-gen-prost @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ ! "${HERMIT_ENV:-}" ]; then + # shellcheck disable=SC1091 + . "$(dirname "$(dirname "$0")")/bin/activate-hermit" +fi + +# Ensure the binary exists, install if it doesn't +mk "${HERMIT_ENV}/.hermit/rust/bin/protoc-gen-prost" : -- cargo install protoc-gen-prost + +# Execute the binary with any passed arguments +exec "${HERMIT_ENV}/.hermit/rust/bin/protoc-gen-prost" "$@" diff --git a/scripts/sqlc-codegen-proto b/scripts/sqlc-codegen-proto new file mode 100644 index 0000000000..3f43dde730 --- /dev/null +++ b/scripts/sqlc-codegen-proto @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Get sqlc version from hermit +if [ ! "${HERMIT_ENV:-}" ]; then + # shellcheck disable=SC1091 + . "$(dirname "$(dirname "$0")")/bin/activate-hermit" +fi + +SQLC_VERSION=$(hermit info sqlc | grep "Version:" | cut -d' ' -f2) +if [[ -z "$SQLC_VERSION" ]]; then + echo "Error: Could not determine sqlc version from hermit" + exit 1 +fi + +# Create temp directory +TEMP_DIR=$(mktemp -d) +trap 'rm -rf $TEMP_DIR' EXIT + +# Download and extract the release source +echo "Fetching sqlc version ${SQLC_VERSION}..." +curl -L --fail --silent \ + "https://github.com/sqlc-dev/sqlc/archive/refs/tags/v${SQLC_VERSION}.tar.gz" \ + -o "${TEMP_DIR}/sqlc.tar.gz" + +tar xzf "${TEMP_DIR}/sqlc.tar.gz" -C "${TEMP_DIR}" + +# Copy the proto file +PROTO_PATH="${TEMP_DIR}/sqlc-${SQLC_VERSION}/protos/plugin/codegen.proto" +if [[ ! -f "$PROTO_PATH" ]]; then + echo "Error: Proto file not found in release archive" + exit 1 +fi + +cp "$PROTO_PATH" "sqlc-gen-ftl/proto/codegen.proto" +echo "Updated proto file to version ${SQLC_VERSION}" diff --git a/sqlc-gen-ftl/Cargo.lock b/sqlc-gen-ftl/Cargo.lock new file mode 100644 index 0000000000..242cb725b4 --- /dev/null +++ b/sqlc-gen-ftl/Cargo.lock @@ -0,0 +1,1707 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + +[[package]] +name = "cc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "cpp_demangle" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba4f80548f22dc9c43911907b5e322c5555544ee85f785115701e6a28c9abe1" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-bitset" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005884e3649c3e5ff2dc79e8a94b138f11569cc08a91244a292714d2a86e9156" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-codegen" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4036255ec33ce9a37495dfbcfc4e1118fd34e693eff9a1e106336b7cd16a9b" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "serde", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ca74f4b68319da11d39e894437cb6e20ec7c2e11fbbda823c3bf207beedff7" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e54f433a0269c4187871aa06d452214d5515d228d5bdc22219585e9eef895" + +[[package]] +name = "cranelift-control" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29cb4018f5bf59fb53f515fa9d80e6f8c5ce19f198dc538984ebd23ecf8965ec" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305399fd781a2953ac78c1396f02ff53144f39c33eb7fc7789cf4e8936d13a96" +dependencies = [ + "cranelift-bitset", + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9230b460a128d53653456137751d27baf567947a3ab8c0c4d6e31fd08036d81e" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b961e24ae3ec9813a24a15ae64bbd2a42e4de4d79a7f3225a412e3b94e78d1c8" + +[[package]] +name = "cranelift-native" +version = "0.114.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d5bd76df6c9151188dfa428c863b33da5b34561b67f43c0cf3f24a794f9fa1f" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[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 = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fastrand" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +dependencies = [ + "foldhash", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.1", + "serde", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.164" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" + +[[package]] +name = "libm" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "crc32fast", + "hashbrown 0.15.1", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "postcard" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" +dependencies = [ + "bytes", + "heck", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" +dependencies = [ + "prost", +] + +[[package]] +name = "protoc-gen-prost" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77eb17a7657a703f30cb9b7ba4d981e4037b8af2d819ab0077514b0bef537406" +dependencies = [ + "once_cell", + "prost", + "prost-build", + "prost-types", + "regex", +] + +[[package]] +name = "psm" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" +dependencies = [ + "cc", +] + +[[package]] +name = "pulley-interpreter" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b8d81cf799e20564931e9867ca32de545188c6ee4c2e0f6e41d32f0c7dc6fb" +dependencies = [ + "cranelift-bitset", + "log", + "sptr", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12908dbeb234370af84d0579b9f68258a0f67e201412dd9a2814e6f45b2fc0f0" +dependencies = [ + "hashbrown 0.14.5", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] +name = "rustix" +version = "0.38.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "sqlc-gen-ftl" +version = "0.1.0" +dependencies = [ + "bytes", + "hex", + "prost", + "prost-build", + "prost-types", + "protoc-gen-prost", + "serde", + "serde_json", + "sha2", + "tempfile", + "wasm-bindgen", + "wasmtime", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "2.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tempfile" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" + +[[package]] +name = "wasm-encoder" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +dependencies = [ + "leb128", + "wasmparser 0.219.1", +] + +[[package]] +name = "wasm-encoder" +version = "0.220.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" +dependencies = [ + "leb128", + "wasmparser 0.220.0", +] + +[[package]] +name = "wasmparser" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmparser" +version = "0.220.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" +dependencies = [ + "bitflags", + "indexmap", +] + +[[package]] +name = "wasmprinter" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228cdc1f30c27816da225d239ce4231f28941147d34713dee8f1fff7cb330e54" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.219.1", +] + +[[package]] +name = "wasmtime" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b79302e3e084713249cc5622e8608e7410afdeeea8c8026d04f491d1fab0b4b" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bitflags", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.5", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "pulley-interpreter", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.219.1", + "wasmparser 0.219.1", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe53a24e7016a5222875d8ca3ad6024b464465985693c42098cd0bb710002c28" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0677a7e76c24746b68e3657f7cc50c0ff122ee7e97bbda6e710c1b790ebc93cb" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys 0.59.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e118acbd2bc09b32ad8606bc7cef793bf5019c1b107772e64dc6c76b5055d40b" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6db4f3ee18c699629eabb9c64e77efe5a93a5137f098db7cab295037ba41c2" + +[[package]] +name = "wasmtime-cranelift" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b87e6c78f562b50aff1afd87ff32a57e241424c846c1c8f3c5fd352d2d62906" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "gimli", + "itertools", + "log", + "object", + "smallvec", + "target-lexicon", + "thiserror", + "wasmparser 0.219.1", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c25bfeaa16432d59a0706e2463d315ef4c9ebcfaf5605670b99d46373bdf9f27" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bitset", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasm-encoder 0.219.1", + "wasmparser 0.219.1", + "wasmprinter", + "wasmtime-component-util", +] + +[[package]] +name = "wasmtime-fiber" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759ab0caa3821a6211743fe1eed448ab9df439e3af6c60dea15486c055611806" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2a056056e9ac6916c2b8e4743408560300c1355e078c344211f13210d449b3" +dependencies = [ + "object", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91b218a92866f74f35162f5d03a4e0f62cd0e1cc624285b1014275e5d4575fad" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-slab" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d5f8acf677ee6b3b8ba400dd9753ea4769e56a95c4b30b045ac6d2d54b2f8ea" + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df09be00c38f49172ca9936998938476e3f2df782673a39ae2ef9fb0838341b6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-winch" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d6b5297bea14d8387c3974b2b011de628cc9b188f135cec752b74fd368964b" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser 0.219.1", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3963c9c29df91564d8bd181eb00d0dbaeafa1b2a01e15952bb7391166b704e" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser", +] + +[[package]] +name = "wast" +version = "220.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e708c8de08751fd66e70961a32bae9d71901f14a70871e181cb8461a3bb3165" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.220.0", +] + +[[package]] +name = "wat" +version = "1.220.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de4f1d7d59614ba690541360102b995c4eb1b9ed373701d5102cc1a968b1c5a3" +dependencies = [ + "wast", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b42b678c8651ec4900d7600037d235429fc985c31cbc33515885ec0d2a9e158" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.219.1", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-parser" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a86f669283257e8e424b9a4fc3518e3ade0b95deb9fbc0f93a1876be3eda598" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.219.1", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/sqlc-gen-ftl/Cargo.toml b/sqlc-gen-ftl/Cargo.toml new file mode 100644 index 0000000000..86d0ed91f0 --- /dev/null +++ b/sqlc-gen-ftl/Cargo.toml @@ -0,0 +1,45 @@ +[package] +name = "sqlc-gen-ftl" +version = "0.1.0" +edition = "2021" + +[profile.release] +lto = true +opt-level = 's' +strip = true + +[build] +target = "wasm32-wasip1" + +[dependencies] +bytes = { version = "1.6.0", default-features = false, features = ["std"] } +prost = { version = "0.13.3", default-features = false, features = ["std"] } +prost-types = { version = "0.13.3", default-features = false, features = ["std"] } +protoc-gen-prost = { version = "0.4.0" } +serde = { version = "1.0", default-features = false, features = ["derive", "alloc", "std"] } +serde_json = { version = "1.0", default-features = false, features = ["alloc", "std"] } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-bindgen = "0.2" + +[build-dependencies] +prost-build = "0.13.3" + +[dev-dependencies] +hex = "0.4.3" +sha2 = "0.10.6" +tempfile = "3.6.0" +wasmtime = "27.0.0" + +[[bin]] +name = "sqlc-gen-ftl" +path = "src/main.rs" + +[[test]] +name = "sqlc_gen_ftl_test" +path = "test/sqlc_gen_ftl_test.rs" + +[features] +default = [] +ci = [] + diff --git a/sqlc-gen-ftl/build.rs b/sqlc-gen-ftl/build.rs new file mode 100644 index 0000000000..aac872fbfb --- /dev/null +++ b/sqlc-gen-ftl/build.rs @@ -0,0 +1,10 @@ +fn main() -> Result<(), Box> { + let mut config = prost_build::Config::new(); + config + .out_dir("src/protos") + .compile_protos( + &["proto/codegen.proto"], + &["proto/"] + )?; + Ok(()) +} diff --git a/sqlc-gen-ftl/proto/codegen.proto b/sqlc-gen-ftl/proto/codegen.proto new file mode 100644 index 0000000000..e6faf19bad --- /dev/null +++ b/sqlc-gen-ftl/proto/codegen.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; + +package plugin; + +service CodegenService { + rpc Generate (GenerateRequest) returns (GenerateResponse); +} + +message File { + string name = 1 [json_name = "name"]; + bytes contents = 2 [json_name = "contents"]; +} + +message Settings { + // Rename message was field 5 + // Overides message was field 6 + // PythonCode message was field 8 + // KotlinCode message was field 9 + // GoCode message was field 10; + // JSONCode message was field 11; + reserved 5, 8, 9, 10, 11; + + string version = 1 [json_name = "version"]; + string engine = 2 [json_name = "engine"]; + repeated string schema = 3 [json_name = "schema"]; + repeated string queries = 4 [json_name = "queries"]; + Codegen codegen = 12 [json_name = "codegen"]; +} + +message Codegen { + message Process { + string cmd = 1; + } + message WASM { + string url = 1; + string sha256 = 2; + } + string out = 1 [json_name = "out"]; + string plugin = 2 [json_name = "plugin"]; + bytes options = 3 [json_name = "options"]; + repeated string env = 4 [json_name = "env"]; + Process process = 5 [json_name = "process"]; + WASM wasm = 6 [json_name = "wasm"]; +} + +message Catalog { + string comment = 1; + string default_schema = 2; + string name = 3; + repeated Schema schemas = 4; +} + +message Schema { + string comment = 1; + string name = 2; + repeated Table tables = 3; + repeated Enum enums = 4; + repeated CompositeType composite_types = 5; +} + +message CompositeType { + string name = 1; + string comment = 2; +} + +message Enum { + string name = 1; + repeated string vals = 2; + string comment = 3; +} + +message Table { + Identifier rel = 1; + repeated Column columns = 2; + string comment = 3; +} + +message Identifier { + string catalog = 1; + string schema = 2; + string name = 3; +} + +message Column { + string name = 1; + bool not_null = 3; + bool is_array = 4; + string comment = 5; + int32 length = 6; + bool is_named_param = 7; + bool is_func_call = 8; + + // XXX: Figure out what PostgreSQL calls `foo.id` + string scope = 9; + Identifier table = 10; + string table_alias = 11; + Identifier type = 12; + bool is_sqlc_slice = 13; + Identifier embed_table = 14; + string original_name = 15; + bool unsigned = 16; + int32 array_dims = 17; +} + +message Query { + string text = 1 [json_name = "text"]; + string name = 2 [json_name = "name"]; + string cmd = 3 [json_name = "cmd"]; + repeated Column columns = 4 [json_name = "columns"]; + repeated Parameter params = 5 [json_name = "parameters"]; + repeated string comments = 6 [json_name = "comments"]; + string filename = 7 [json_name = "filename"]; + Identifier insert_into_table = 8 [json_name = "insert_into_table"]; +} + +message Parameter { + int32 number = 1 [json_name = "number"]; + Column column = 2 [json_name = "column"]; +} + +message GenerateRequest { + Settings settings = 1 [json_name = "settings"]; + Catalog catalog = 2 [json_name = "catalog"]; + repeated Query queries = 3 [json_name = "queries"]; + string sqlc_version = 4 [json_name = "sqlc_version"]; + bytes plugin_options = 5 [json_name = "plugin_options"]; + bytes global_options = 6 [json_name = "global_options"]; +} + +message GenerateResponse { + repeated File files = 1 [json_name = "files"]; +} diff --git a/sqlc-gen-ftl/rust-toolchain.toml b/sqlc-gen-ftl/rust-toolchain.toml new file mode 100644 index 0000000000..fe32dde078 --- /dev/null +++ b/sqlc-gen-ftl/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +profile = "default" +targets = ["wasm32-wasip1"] diff --git a/sqlc-gen-ftl/src/main.rs b/sqlc-gen-ftl/src/main.rs new file mode 100644 index 0000000000..d3810b6560 --- /dev/null +++ b/sqlc-gen-ftl/src/main.rs @@ -0,0 +1,27 @@ +mod protos; +mod plugin; + +use std::io::{Read, Write}; +pub use plugin::Plugin; + +fn main() -> Result<(), Box> { + let mut input_bytes = Vec::new(); + if let Err(e) = std::io::stdin().read_to_end(&mut input_bytes) { + eprintln!("Failed to read stdin: {}", e); + std::process::exit(1); + } + + match Plugin::generate_from_input(&input_bytes) { + Ok(output_bytes) => { + if let Err(e) = std::io::stdout().write_all(&output_bytes.as_slice()) { + eprintln!("Failed to write to stdout: {}", e); + std::process::exit(1); + } + Ok(()) + } + Err(e) => { + eprintln!("Plugin execution failed: {}", e); + std::process::exit(1); + } + } +} diff --git a/sqlc-gen-ftl/src/plugin/mod.rs b/sqlc-gen-ftl/src/plugin/mod.rs new file mode 100644 index 0000000000..0b77e39891 --- /dev/null +++ b/sqlc-gen-ftl/src/plugin/mod.rs @@ -0,0 +1,188 @@ +#![allow(dead_code)] + +use crate::protos::pluginpb; +use crate::protos::schemapb; +use crate::protos::schemapb::r#type::Value as TypeValue; +use prost::Message; +use std::io; + +pub struct Plugin; + +impl Plugin { + pub fn generate_from_input(input: &[u8]) -> Result, io::Error> { + let req = pluginpb::GenerateRequest::decode(input) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + let resp = Self::handle_generate(req)?; + Ok(resp.encode_to_vec()) + } + + fn handle_generate(req: pluginpb::GenerateRequest) -> Result { + let module = generate_schema(&req)?; + Ok(pluginpb::GenerateResponse { + files: vec![pluginpb::File { + name: "queries.pb".to_string(), + contents: module.encode_to_vec(), + }], + }) + } +} + +fn generate_schema(request: &pluginpb::GenerateRequest) -> Result { + let mut decls = Vec::new(); + let module_name = get_module_name(request)?; + + for query in &request.queries { + if !query.params.is_empty() { + decls.push(to_verb_request(query)); + } + + if !query.columns.is_empty() { + decls.push(to_verb_response(query)); + } + + decls.push(to_verb(query, &module_name)); + } + + Ok(schemapb::Module { + name: module_name, + builtin: false, + runtime: None, + comments: Vec::new(), + pos: None, + decls, + }) +} + +fn to_verb(query: &pluginpb::Query, module_name: &str) -> schemapb::Decl { + let request_type = if !query.params.is_empty() { + Some(to_schema_ref(module_name, &format!("{}Query", query.name))) + } else { + None + }; + + let response_type = if query.cmd == ":exec" { + None + } else { + Some(to_schema_ref(module_name, &format!("{}Result", query.name))) + }; + + schemapb::Decl { + value: Some(schemapb::decl::Value::Verb(schemapb::Verb { + name: query.name.clone(), + export: false, + runtime: None, + request: request_type, + response: response_type, + pos: None, + comments: Vec::new(), + metadata: Vec::new(), + })), + } +} + +fn to_verb_request(query: &pluginpb::Query) -> schemapb::Decl { + schemapb::Decl { + value: Some(schemapb::decl::Value::Data(schemapb::Data { + name: format!("{}Query", query.name), + export: false, + type_parameters: Vec::new(), + fields: query.params.iter().map(|param| { + let name = param.column.as_ref() + .map(|col| col.name.clone()) + .unwrap_or_else(|| format!("param{}", param.number)); + let sql_type = param.column.as_ref().and_then(|col| col.r#type.as_ref()); + to_schema_field(name, sql_type) + }).collect(), + pos: None, + comments: Vec::new(), + metadata: Vec::new(), + })), + } +} + +fn to_verb_response(query: &pluginpb::Query) -> schemapb::Decl { + schemapb::Decl { + value: Some(schemapb::decl::Value::Data(schemapb::Data { + name: format!("{}Result", query.name), + export: false, + type_parameters: Vec::new(), + fields: query.columns.iter().map(|col| { + to_schema_field(col.name.clone(), col.r#type.as_ref()) + }).collect(), + pos: None, + comments: Vec::new(), + metadata: Vec::new(), + })), + } +} + +fn to_schema_field(name: String, sql_type: Option<&pluginpb::Identifier>) -> schemapb::Field { + schemapb::Field { + name, + r#type: Some(sql_type.map_or_else( + || schemapb::Type { + value: Some(TypeValue::Any(schemapb::Any { pos: None })), + }, + to_schema_type + )), + pos: None, + comments: Vec::new(), + metadata: Vec::new(), + } +} + +fn to_schema_ref(module_name: &str, name: &str) -> schemapb::Type { + schemapb::Type { + value: Some(schemapb::r#type::Value::Ref(schemapb::Ref { + module: module_name.to_string(), + name: name.to_string(), + pos: None, + type_parameters: vec![], + })) + } +} + +fn to_schema_type(sql_type: &pluginpb::Identifier) -> schemapb::Type { + let value = match sql_type.name.as_str() { + "integer" | "bigint" | "smallint" | "serial" | "bigserial" => + TypeValue::Int(schemapb::Int { pos: None }), + "real" | "float" | "double" | "numeric" | "decimal" => + TypeValue::Float(schemapb::Float { pos: None }), + "text" | "varchar" | "char" | "uuid" => + TypeValue::String(schemapb::String { pos: None }), + "boolean" => + TypeValue::Bool(schemapb::Bool { pos: None }), + "timestamp" | "date" | "time" => + TypeValue::Time(schemapb::Time { pos: None }), + "json" | "jsonb" => + TypeValue::Any(schemapb::Any { pos: None }), + "bytea" | "blob" => + TypeValue::Bytes(schemapb::Bytes { pos: None }), + _ => + TypeValue::Any(schemapb::Any { pos: None }), + }; + + schemapb::Type { + value: Some(value), + } +} + +fn get_module_name(req: &pluginpb::GenerateRequest) -> Result { + let codegen = req.settings + .as_ref() + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "Missing settings"))? + .codegen + .as_ref() + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "Missing codegen settings"))?; + + let options_str = String::from_utf8(codegen.options.clone()) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, format!("Invalid UTF-8 in options: {}", e)))?; + + let options: serde_json::Value = serde_json::from_str(&options_str) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, format!("Failed to parse JSON options: {}", e)))?; + + options.get("module") + .and_then(|v| v.as_str()) + .map(|s| s.to_string()) + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "Missing module name in options")) +} diff --git a/sqlc-gen-ftl/src/protos/mod.rs b/sqlc-gen-ftl/src/protos/mod.rs new file mode 100644 index 0000000000..e1630c4317 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/mod.rs @@ -0,0 +1,4 @@ +#[path = "plugin.rs"] +pub mod pluginpb; +#[path = "xyz.block.ftl.v1.schema.rs"] +pub mod schemapb; diff --git a/sqlc-gen-ftl/src/protos/plugin.rs b/sqlc-gen-ftl/src/protos/plugin.rs new file mode 100644 index 0000000000..a676e257ae --- /dev/null +++ b/sqlc-gen-ftl/src/protos/plugin.rs @@ -0,0 +1,191 @@ +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct File { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub contents: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Settings { + #[prost(string, tag = "1")] + pub version: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub engine: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "3")] + pub schema: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "4")] + pub queries: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(message, optional, tag = "12")] + pub codegen: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Codegen { + #[prost(string, tag = "1")] + pub out: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub plugin: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "3")] + pub options: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag = "4")] + pub env: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(message, optional, tag = "5")] + pub process: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub wasm: ::core::option::Option, +} +/// Nested message and enum types in `Codegen`. +pub mod codegen { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Process { + #[prost(string, tag = "1")] + pub cmd: ::prost::alloc::string::String, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Wasm { + #[prost(string, tag = "1")] + pub url: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub sha256: ::prost::alloc::string::String, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Catalog { + #[prost(string, tag = "1")] + pub comment: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub default_schema: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub schemas: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schema { + #[prost(string, tag = "1")] + pub comment: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub tables: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub enums: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "5")] + pub composite_types: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompositeType { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub comment: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Enum { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "2")] + pub vals: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "3")] + pub comment: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Table { + #[prost(message, optional, tag = "1")] + pub rel: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub columns: ::prost::alloc::vec::Vec, + #[prost(string, tag = "3")] + pub comment: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Identifier { + #[prost(string, tag = "1")] + pub catalog: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Column { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(bool, tag = "3")] + pub not_null: bool, + #[prost(bool, tag = "4")] + pub is_array: bool, + #[prost(string, tag = "5")] + pub comment: ::prost::alloc::string::String, + #[prost(int32, tag = "6")] + pub length: i32, + #[prost(bool, tag = "7")] + pub is_named_param: bool, + #[prost(bool, tag = "8")] + pub is_func_call: bool, + /// XXX: Figure out what PostgreSQL calls `foo.id` + #[prost(string, tag = "9")] + pub scope: ::prost::alloc::string::String, + #[prost(message, optional, tag = "10")] + pub table: ::core::option::Option, + #[prost(string, tag = "11")] + pub table_alias: ::prost::alloc::string::String, + #[prost(message, optional, tag = "12")] + pub r#type: ::core::option::Option, + #[prost(bool, tag = "13")] + pub is_sqlc_slice: bool, + #[prost(message, optional, tag = "14")] + pub embed_table: ::core::option::Option, + #[prost(string, tag = "15")] + pub original_name: ::prost::alloc::string::String, + #[prost(bool, tag = "16")] + pub unsigned: bool, + #[prost(int32, tag = "17")] + pub array_dims: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Query { + #[prost(string, tag = "1")] + pub text: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub cmd: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub columns: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "5")] + pub params: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag = "6")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "7")] + pub filename: ::prost::alloc::string::String, + #[prost(message, optional, tag = "8")] + pub insert_into_table: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Parameter { + #[prost(int32, tag = "1")] + pub number: i32, + #[prost(message, optional, tag = "2")] + pub column: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenerateRequest { + #[prost(message, optional, tag = "1")] + pub settings: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub catalog: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub queries: ::prost::alloc::vec::Vec, + #[prost(string, tag = "4")] + pub sqlc_version: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "5")] + pub plugin_options: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "6")] + pub global_options: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenerateResponse { + #[prost(message, repeated, tag = "1")] + pub files: ::prost::alloc::vec::Vec, +} diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.console.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.console.v1.rs new file mode 100644 index 0000000000..22f65a69bf --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.console.v1.rs @@ -0,0 +1,174 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Config { + #[prost(message, optional, tag="1")] + pub config: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Data { + #[prost(message, optional, tag="1")] + pub data: ::core::option::Option, + #[prost(string, tag="2")] + pub schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="3")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Database { + #[prost(message, optional, tag="1")] + pub database: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Enum { + #[prost(message, optional, tag="1")] + pub r#enum: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topic { + #[prost(message, optional, tag="1")] + pub topic: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeAlias { + #[prost(message, optional, tag="1")] + pub typealias: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Secret { + #[prost(message, optional, tag="1")] + pub secret: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Verb { + #[prost(message, optional, tag="1")] + pub verb: ::core::option::Option, + #[prost(string, tag="2")] + pub schema: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub json_request_schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub language: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub verbs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub secrets: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="8")] + pub configs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="9")] + pub databases: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="10")] + pub enums: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="11")] + pub topics: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="12")] + pub typealiases: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TopologyGroup { + #[prost(string, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topology { + #[prost(message, repeated, tag="1")] + pub levels: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetModulesRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetModulesResponse { + #[prost(message, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub topology: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct StreamModulesRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamModulesResponse { + #[prost(message, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub topology: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetConfigRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetConfigResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetConfigRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetConfigResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSecretRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSecretResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSecretRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSecretResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.deployment.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.deployment.v1.rs new file mode 100644 index 0000000000..3e8224ed36 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.deployment.v1.rs @@ -0,0 +1,71 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentContextRequest { + #[prost(string, tag="1")] + pub deployment: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentContextResponse { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub deployment: ::prost::alloc::string::String, + #[prost(map="string, bytes", tag="3")] + pub configs: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>, + #[prost(map="string, bytes", tag="4")] + pub secrets: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>, + #[prost(message, repeated, tag="5")] + pub databases: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub routes: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `GetDeploymentContextResponse`. +pub mod get_deployment_context_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Dsn { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(enumeration="DbType", tag="2")] + pub r#type: i32, + #[prost(string, tag="3")] + pub dsn: ::prost::alloc::string::String, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Route { + #[prost(string, tag="1")] + pub deployment: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub uri: ::prost::alloc::string::String, + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum DbType { + Unspecified = 0, + Postgres = 1, + Mysql = 2, + } + impl DbType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "DB_TYPE_UNSPECIFIED", + Self::Postgres => "DB_TYPE_POSTGRES", + Self::Mysql => "DB_TYPE_MYSQL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "DB_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "DB_TYPE_POSTGRES" => Some(Self::Postgres), + "DB_TYPE_MYSQL" => Some(Self::Mysql), + _ => None, + } + } + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.language.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.language.v1.rs new file mode 100644 index 0000000000..7bdeee1efc --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.language.v1.rs @@ -0,0 +1,411 @@ +// @generated +// This file is @generated by prost-build. +/// ModuleConfig contains the configuration for a module, found in the module's ftl.toml file. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfig { + /// Name of the module + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + /// Absolute path to the module's directory + #[prost(string, tag="2")] + pub dir: ::prost::alloc::string::String, + /// The language of the module + #[prost(string, tag="3")] + pub language: ::prost::alloc::string::String, + /// Absolute path to the directory containing all of this module's build artifacts for deployments + #[prost(string, tag="4")] + pub deploy_dir: ::prost::alloc::string::String, + /// Build is the command to build the module. + #[prost(string, optional, tag="5")] + pub build: ::core::option::Option<::prost::alloc::string::String>, + /// DevModeBuild is the command to build the module in dev mode. + #[prost(string, optional, tag="6")] + pub dev_mode_build: ::core::option::Option<::prost::alloc::string::String>, + /// Build lock path to prevent concurrent builds + #[prost(string, tag="7")] + pub build_lock: ::prost::alloc::string::String, + /// The directory to generate protobuf schema files into. These can be picked up by language specific build tools + #[prost(string, optional, tag="8")] + pub generated_schema_dir: ::core::option::Option<::prost::alloc::string::String>, + /// Patterns to watch for file changes + #[prost(string, repeated, tag="9")] + pub watch: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// LanguageConfig contains any metadata specific to a specific language. + /// These are stored in the ftl.toml file under the same key as the language (eg: "go", "java") + #[prost(message, optional, tag="10")] + pub language_config: ::core::option::Option<::prost_types::Struct>, + /// The directory containing the SQL migration files + #[prost(string, tag="11")] + pub sql_migration_dir: ::prost::alloc::string::String, +} +/// ProjectConfig contains the configuration for a project, found in the ftl-project.toml file. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProjectConfig { + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(bool, tag="3")] + pub no_git: bool, + #[prost(bool, tag="4")] + pub hermit: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetCreateModuleFlagsRequest { + #[prost(string, tag="1")] + pub language: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetCreateModuleFlagsResponse { + #[prost(message, repeated, tag="1")] + pub flags: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `GetCreateModuleFlagsResponse`. +pub mod get_create_module_flags_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Flag { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub help: ::prost::alloc::string::String, + #[prost(string, optional, tag="3")] + pub envar: ::core::option::Option<::prost::alloc::string::String>, + /// short must be a single character + #[prost(string, optional, tag="4")] + pub short: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub placeholder: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="6")] + pub default: ::core::option::Option<::prost::alloc::string::String>, + } +} +/// Request to create a new module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateModuleRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + /// The root directory for the module, which does not yet exist. + /// The plugin should create the directory. + #[prost(string, tag="2")] + pub dir: ::prost::alloc::string::String, + /// The project configuration + #[prost(message, optional, tag="3")] + pub project_config: ::core::option::Option, + /// Flags contains any values set for those configured in the GetCreateModuleFlags call + #[prost(message, optional, tag="4")] + pub flags: ::core::option::Option<::prost_types::Struct>, +} +/// Response to a create module request. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct CreateModuleResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfigDefaultsRequest { + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, +} +/// ModuleConfigDefaultsResponse provides defaults for ModuleConfig. +/// +/// The result may be cached by FTL, so defaulting logic should not be changing due to normal module changes. +/// For example, it is valid to return defaults based on which build tool is configured within the module directory, +/// as that is not expected to change during normal operation. +/// It is not recommended to read the module's toml file to determine defaults, as when the toml file is updated, +/// the module defaults will not be recalculated. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfigDefaultsResponse { + /// Default relative path to the directory containing all build artifacts for deployments + #[prost(string, tag="1")] + pub deploy_dir: ::prost::alloc::string::String, + /// Default build command + #[prost(string, optional, tag="2")] + pub build: ::core::option::Option<::prost::alloc::string::String>, + /// Dev mode build command, if different from the regular build command + #[prost(string, optional, tag="3")] + pub dev_mode_build: ::core::option::Option<::prost::alloc::string::String>, + /// Build lock path to prevent concurrent builds + #[prost(string, optional, tag="4")] + pub build_lock: ::core::option::Option<::prost::alloc::string::String>, + /// Default relative path to the directory containing generated schema files + #[prost(string, optional, tag="5")] + pub generated_schema_dir: ::core::option::Option<::prost::alloc::string::String>, + /// Default patterns to watch for file changes, relative to the module directory + #[prost(string, repeated, tag="6")] + pub watch: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Default language specific configuration. + /// These defaults are filled in by looking at each root key only. If the key is not present, the default is used. + #[prost(message, optional, tag="7")] + pub language_config: ::core::option::Option<::prost_types::Struct>, + /// Default directory containing the SQL migration files + #[prost(string, tag="8")] + pub sql_migration_dir: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDependenciesRequest { + #[prost(message, optional, tag="1")] + pub module_config: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDependenciesResponse { + #[prost(string, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// BuildContext contains contextual information needed to build. +/// +/// Plugins must include the build context's id when a build succeeds or fails. +/// For automatic rebuilds, plugins must use the most recent build context they have received. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildContext { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + /// The configuration for the module + #[prost(message, optional, tag="2")] + pub module_config: ::core::option::Option, + /// The FTL schema including all dependencies + #[prost(message, optional, tag="3")] + pub schema: ::core::option::Option, + /// The dependencies for the module + #[prost(string, repeated, tag="4")] + pub dependencies: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Build environment provides environment variables to be set for the build command + #[prost(string, repeated, tag="5")] + pub build_env: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildContextUpdatedRequest { + #[prost(message, optional, tag="1")] + pub build_context: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct BuildContextUpdatedResponse { +} +/// Error contains information about an error that occurred during a build. +/// Errors do not always cause a build failure. Use lesser levels to help guide the user. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(string, tag="1")] + pub msg: ::prost::alloc::string::String, + #[prost(enumeration="error::ErrorLevel", tag="4")] + pub level: i32, + #[prost(message, optional, tag="5")] + pub pos: ::core::option::Option, + #[prost(enumeration="error::ErrorType", tag="6")] + pub r#type: i32, +} +/// Nested message and enum types in `Error`. +pub mod error { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ErrorLevel { + Unspecified = 0, + Info = 1, + Warn = 2, + Error = 3, + } + impl ErrorLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ERROR_LEVEL_UNSPECIFIED", + Self::Info => "ERROR_LEVEL_INFO", + Self::Warn => "ERROR_LEVEL_WARN", + Self::Error => "ERROR_LEVEL_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ERROR_LEVEL_UNSPECIFIED" => Some(Self::Unspecified), + "ERROR_LEVEL_INFO" => Some(Self::Info), + "ERROR_LEVEL_WARN" => Some(Self::Warn), + "ERROR_LEVEL_ERROR" => Some(Self::Error), + _ => None, + } + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ErrorType { + Unspecified = 0, + Ftl = 1, + /// Compiler errors are errors that are from the compiler. This is useful to avoid duplicate errors + /// being shown to the user when combining errors from multiple sources (eg: an IDE showing compiler + /// errors and FTL errors via LSP). + Compiler = 2, + } + impl ErrorType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ERROR_TYPE_UNSPECIFIED", + Self::Ftl => "ERROR_TYPE_FTL", + Self::Compiler => "ERROR_TYPE_COMPILER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ERROR_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "ERROR_TYPE_FTL" => Some(Self::Ftl), + "ERROR_TYPE_COMPILER" => Some(Self::Compiler), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + #[prost(string, tag="1")] + pub filename: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub line: i64, + #[prost(int64, tag="3")] + pub start_column: i64, + #[prost(int64, tag="4")] + pub end_column: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ErrorList { + #[prost(message, repeated, tag="1")] + pub errors: ::prost::alloc::vec::Vec, +} +/// Request to build a module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildRequest { + /// The root path for the FTL project + #[prost(string, tag="1")] + pub project_root: ::prost::alloc::string::String, + /// The path to the directory containing all module stubs. Each module stub is in a subdirectory. + #[prost(string, tag="2")] + pub stubs_root: ::prost::alloc::string::String, + /// Indicates whether to watch for file changes and automatically rebuild + #[prost(bool, tag="3")] + pub rebuild_automatically: bool, + #[prost(message, optional, tag="4")] + pub build_context: ::core::option::Option, +} +/// AutoRebuildStarted should be sent when the plugin decides to start rebuilding automatically. +/// +/// It is not required to send this event, though it helps inform the user that their changes are not yet built. +/// FTL may ignore this event if it does not match FTL's current build context and state. +/// If the plugin decides to cancel the build because another build started, no failure or cancellation event needs +/// to be sent. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AutoRebuildStarted { + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, +} +/// BuildSuccess should be sent when a build succeeds. +/// +/// FTL may ignore this event if it does not match FTL's current build context and state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildSuccess { + /// The id of build context used while building. + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, + /// Indicates whether the build was automatically started by the plugin, rather than due to a Build rpc call. + #[prost(bool, tag="2")] + pub is_automatic_rebuild: bool, + /// Module schema for the built module + #[prost(message, optional, tag="3")] + pub module: ::core::option::Option, + /// Paths for files/directories to be deployed + #[prost(string, repeated, tag="4")] + pub deploy: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Name of the docker image to use for the runner + #[prost(string, tag="5")] + pub docker_image: ::prost::alloc::string::String, + /// Errors contains any errors that occurred during the build + /// No errors can have a level of ERROR, instead a BuildFailure should be sent + /// Instead this is useful for INFO and WARN level errors. + #[prost(message, optional, tag="6")] + pub errors: ::core::option::Option, + /// Dev mode endpoint URI. If this is set then rather than trying to deploy the module, FTL will start a runner that + /// connects to this endpoint. + #[prost(string, optional, tag="7")] + pub dev_endpoint: ::core::option::Option<::prost::alloc::string::String>, + /// Dev mode debug port + #[prost(int32, optional, tag="8")] + pub debug_port: ::core::option::Option, + /// Dev mode runner info file, this file is used to allow the runner to communicate provisioner info back to the plugin + #[prost(string, optional, tag="9")] + pub dev_runner_info_file: ::core::option::Option<::prost::alloc::string::String>, +} +/// BuildFailure should be sent when a build fails. +/// +/// FTL may ignore this event if it does not match FTL's current build context and state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildFailure { + /// The id of build context used while building. + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, + /// Indicates whether the build was automatically started by the plugin, rather than due to a Build rpc call. + #[prost(bool, tag="2")] + pub is_automatic_rebuild: bool, + /// Errors contains any errors that occurred during the build + #[prost(message, optional, tag="3")] + pub errors: ::core::option::Option, + /// Indicates the plugin determined that the dependencies in the BuildContext are out of date. + /// If a Build stream is being kept open for automatic rebuilds, FTL will call GetDependencies, followed by + /// BuildContextUpdated. + #[prost(bool, tag="4")] + pub invalidate_dependencies: bool, +} +/// Every type of message that can be streamed from the language plugin for a build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildResponse { + #[prost(oneof="build_response::Event", tags="2, 3, 4")] + pub event: ::core::option::Option, +} +/// Nested message and enum types in `BuildResponse`. +pub mod build_response { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Event { + #[prost(message, tag="2")] + AutoRebuildStarted(super::AutoRebuildStarted), + #[prost(message, tag="3")] + BuildSuccess(super::BuildSuccess), + #[prost(message, tag="4")] + BuildFailure(super::BuildFailure), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenerateStubsRequest { + /// The directory path to generate stubs into + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, + /// The schema of the module to generate stubs for + #[prost(message, optional, tag="2")] + pub module: ::core::option::Option, + /// The module's configuration to generate stubs for + #[prost(message, optional, tag="3")] + pub module_config: ::core::option::Option, + /// Native module configuration is the configuration for a module that uses the plugin's language, if + /// the main moduleConfig provided is of a different language. It is provided as a mechanism to derive + /// language specific information. For example, the language version. + #[prost(message, optional, tag="4")] + pub native_module_config: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GenerateStubsResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncStubReferencesRequest { + #[prost(message, optional, tag="1")] + pub module_config: ::core::option::Option, + /// The path of the directory containing all module stubs. Each module is in a subdirectory + #[prost(string, tag="2")] + pub stubs_root: ::prost::alloc::string::String, + /// The names of all modules that have had stubs generated + #[prost(string, repeated, tag="3")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct SyncStubReferencesResponse { +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.lease.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.lease.v1.rs new file mode 100644 index 0000000000..9000b83491 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.lease.v1.rs @@ -0,0 +1,13 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AcquireLeaseRequest { + #[prost(string, repeated, tag="1")] + pub key: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub ttl: ::core::option::Option<::prost_types::Duration>, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct AcquireLeaseResponse { +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.provisioner.v1beta1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.provisioner.v1beta1.rs new file mode 100644 index 0000000000..772a7f2370 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.provisioner.v1beta1.rs @@ -0,0 +1,105 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProvisionRequest { + #[prost(string, tag="1")] + pub ftl_cluster_id: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub desired_module: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub previous_module: ::core::option::Option, + #[prost(string, repeated, tag="4")] + pub kinds: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProvisionResponse { + #[prost(string, tag="1")] + pub provisioning_token: ::prost::alloc::string::String, + #[prost(enumeration="provision_response::ProvisionResponseStatus", tag="2")] + pub status: i32, +} +/// Nested message and enum types in `ProvisionResponse`. +pub mod provision_response { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ProvisionResponseStatus { + Unspecified = 0, + Submitted = 1, + } + impl ProvisionResponseStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "PROVISION_RESPONSE_STATUS_UNSPECIFIED", + Self::Submitted => "PROVISION_RESPONSE_STATUS_SUBMITTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PROVISION_RESPONSE_STATUS_UNSPECIFIED" => Some(Self::Unspecified), + "PROVISION_RESPONSE_STATUS_SUBMITTED" => Some(Self::Submitted), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusRequest { + #[prost(string, tag="1")] + pub provisioning_token: ::prost::alloc::string::String, + /// The outputs of this module are updated if the the status is a success + #[prost(message, optional, tag="2")] + pub desired_module: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProvisioningEvent { + #[prost(oneof="provisioning_event::Value", tags="1, 2, 3, 4")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `ProvisioningEvent`. +pub mod provisioning_event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + ModuleRuntimeEvent(super::super::super::schema::v1::ModuleRuntimeEvent), + #[prost(message, tag="2")] + DatabaseRuntimeEvent(super::super::super::schema::v1::DatabaseRuntimeEvent), + #[prost(message, tag="3")] + TopicRuntimeEvent(super::super::super::schema::v1::TopicRuntimeEvent), + #[prost(message, tag="4")] + VerbRuntimeEvent(super::super::super::schema::v1::VerbRuntimeEvent), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + #[prost(oneof="status_response::Status", tags="1, 2")] + pub status: ::core::option::Option, +} +/// Nested message and enum types in `StatusResponse`. +pub mod status_response { + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct ProvisioningRunning { + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ProvisioningFailed { + #[prost(string, tag="1")] + pub error_message: ::prost::alloc::string::String, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ProvisioningSuccess { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, + } + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Status { + #[prost(message, tag="1")] + Running(ProvisioningRunning), + #[prost(message, tag="2")] + Success(ProvisioningSuccess), + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.publish.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.publish.v1.rs new file mode 100644 index 0000000000..5ceecca335 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.publish.v1.rs @@ -0,0 +1,18 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PublishEventRequest { + #[prost(message, optional, tag="1")] + pub topic: ::core::option::Option, + #[prost(bytes="bytes", tag="2")] + pub body: ::prost::bytes::Bytes, + #[prost(string, tag="3")] + pub key: ::prost::alloc::string::String, + /// Only verb name is included because this verb will be in the same module as topic + #[prost(string, tag="4")] + pub caller: ::prost::alloc::string::String, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PublishEventResponse { +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.schema.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.schema.v1.rs new file mode 100644 index 0000000000..305665a364 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.schema.v1.rs @@ -0,0 +1,803 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AwsiamAuthDatabaseConnector { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub username: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub database: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Any { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Array { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub element: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bool { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bytes { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Config { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DsnDatabaseConnector { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub dsn: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Data { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub type_parameters: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub fields: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Database { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="4")] + pub r#type: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseConnector { + #[prost(oneof="database_connector::Value", tags="2, 1")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `DatabaseConnector`. +pub mod database_connector { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="2")] + AwsiamAuthDatabaseConnector(super::AwsiamAuthDatabaseConnector), + #[prost(message, tag="1")] + DsnDatabaseConnector(super::DsnDatabaseConnector), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntime { + #[prost(message, optional, tag="1")] + pub connections: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntimeConnections { + #[prost(message, optional, tag="1")] + pub read: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub write: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntimeConnectionsEvent { + #[prost(message, optional, tag="1")] + pub connections: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntimeEvent { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub payload: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntimeEventPayload { + #[prost(oneof="database_runtime_event_payload::Value", tags="1")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `DatabaseRuntimeEventPayload`. +pub mod database_runtime_event_payload { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + DatabaseRuntimeConnectionsEvent(super::DatabaseRuntimeConnectionsEvent), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Decl { + #[prost(oneof="decl::Value", tags="6, 1, 3, 4, 7, 9, 5, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Decl`. +pub mod decl { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="6")] + Config(super::Config), + #[prost(message, tag="1")] + Data(super::Data), + #[prost(message, tag="3")] + Database(super::Database), + #[prost(message, tag="4")] + Enum(super::Enum), + #[prost(message, tag="7")] + Secret(super::Secret), + #[prost(message, tag="9")] + Topic(super::Topic), + #[prost(message, tag="5")] + TypeAlias(super::TypeAlias), + #[prost(message, tag="2")] + Verb(super::Verb), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Enum { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="6")] + pub variants: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EnumVariant { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub value: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Field { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="3")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="5")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Float { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathComponent { + #[prost(oneof="ingress_path_component::Value", tags="1, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `IngressPathComponent`. +pub mod ingress_path_component { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + IngressPathLiteral(super::IngressPathLiteral), + #[prost(message, tag="2")] + IngressPathParameter(super::IngressPathParameter), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathLiteral { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub text: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathParameter { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Int { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IntValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(int64, tag="2")] + pub value: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Map { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub key: ::core::option::Option<::prost::alloc::boxed::Box>, + #[prost(message, optional, boxed, tag="3")] + pub value: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Metadata { + #[prost(oneof="metadata::Value", tags="5, 14, 1, 10, 3, 4, 9, 2, 12, 6, 13, 11, 7, 8")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Metadata`. +pub mod metadata { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="5")] + Alias(super::MetadataAlias), + #[prost(message, tag="14")] + Artefact(super::MetadataArtefact), + #[prost(message, tag="1")] + Calls(super::MetadataCalls), + #[prost(message, tag="10")] + Config(super::MetadataConfig), + #[prost(message, tag="3")] + CronJob(super::MetadataCronJob), + #[prost(message, tag="4")] + Databases(super::MetadataDatabases), + #[prost(message, tag="9")] + Encoding(super::MetadataEncoding), + #[prost(message, tag="2")] + Ingress(super::MetadataIngress), + #[prost(message, tag="12")] + Publisher(super::MetadataPublisher), + #[prost(message, tag="6")] + Retry(super::MetadataRetry), + #[prost(message, tag="13")] + SqlMigration(super::MetadataSqlMigration), + #[prost(message, tag="11")] + Secrets(super::MetadataSecrets), + #[prost(message, tag="7")] + Subscriber(super::MetadataSubscriber), + #[prost(message, tag="8")] + TypeMap(super::MetadataTypeMap), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataAlias { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(enumeration="AliasKind", tag="2")] + pub kind: i32, + #[prost(string, tag="3")] + pub alias: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataArtefact { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub path: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub digest: ::prost::alloc::string::String, + #[prost(bool, tag="4")] + pub executable: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataCalls { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub calls: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataConfig { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub config: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataCronJob { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub cron: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataDatabases { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub calls: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataEncoding { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub r#type: ::prost::alloc::string::String, + #[prost(bool, tag="3")] + pub lenient: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataIngress { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub r#type: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub method: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub path: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataPublisher { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub topics: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataRetry { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(int64, optional, tag="2")] + pub count: ::core::option::Option, + #[prost(string, tag="3")] + pub min_backoff: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub max_backoff: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub catch: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataSqlMigration { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub digest: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataSecrets { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub secrets: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataSubscriber { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub topic: ::core::option::Option, + #[prost(enumeration="FromOffset", tag="3")] + pub from_offset: i32, + #[prost(bool, tag="4")] + pub dead_letter: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataTypeMap { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub runtime: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub native_name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub builtin: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="6")] + pub metadata: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="5")] + pub decls: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleRuntime { + #[prost(message, optional, tag="1")] + pub base: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub scaling: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub deployment: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleRuntimeBase { + #[prost(message, optional, tag="1")] + pub create_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="2")] + pub language: ::prost::alloc::string::String, + #[prost(string, optional, tag="3")] + pub os: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="4")] + pub arch: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub image: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleRuntimeDeployment { + #[prost(string, tag="1")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub deployment_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleRuntimeEvent { + #[prost(oneof="module_runtime_event::Value", tags="1, 3, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `ModuleRuntimeEvent`. +pub mod module_runtime_event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + ModuleRuntimeBase(super::ModuleRuntimeBase), + #[prost(message, tag="3")] + ModuleRuntimeDeployment(super::ModuleRuntimeDeployment), + #[prost(message, tag="2")] + ModuleRuntimeScaling(super::ModuleRuntimeScaling), + } +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ModuleRuntimeScaling { + #[prost(int32, tag="1")] + pub min_replicas: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Optional { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub r#type: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + #[prost(string, tag="1")] + pub filename: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub line: i64, + #[prost(int64, tag="3")] + pub column: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Ref { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="3")] + pub module: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub type_parameters: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RuntimeEvent { + #[prost(oneof="runtime_event::Value", tags="5, 1, 3, 2, 6, 4")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `RuntimeEvent`. +pub mod runtime_event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="5")] + DatabaseRuntimeEvent(super::DatabaseRuntimeEvent), + #[prost(message, tag="1")] + ModuleRuntimeBase(super::ModuleRuntimeBase), + #[prost(message, tag="3")] + ModuleRuntimeDeployment(super::ModuleRuntimeDeployment), + #[prost(message, tag="2")] + ModuleRuntimeScaling(super::ModuleRuntimeScaling), + #[prost(message, tag="6")] + TopicRuntimeEvent(super::TopicRuntimeEvent), + #[prost(message, tag="4")] + VerbRuntimeEvent(super::VerbRuntimeEvent), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schema { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub modules: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Secret { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct String { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StringValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub value: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Time { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topic { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub event: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TopicRuntime { + #[prost(string, repeated, tag="1")] + pub kafka_brokers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub topic_id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TopicRuntimeEvent { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub payload: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Type { + #[prost(oneof="r#type::Value", tags="9, 7, 5, 4, 2, 1, 8, 12, 11, 3, 6, 10")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Type`. +pub mod r#type { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="9")] + Any(super::Any), + #[prost(message, tag="7")] + Array(::prost::alloc::boxed::Box), + #[prost(message, tag="5")] + Bool(super::Bool), + #[prost(message, tag="4")] + Bytes(super::Bytes), + #[prost(message, tag="2")] + Float(super::Float), + #[prost(message, tag="1")] + Int(super::Int), + #[prost(message, tag="8")] + Map(::prost::alloc::boxed::Box), + #[prost(message, tag="12")] + Optional(::prost::alloc::boxed::Box), + #[prost(message, tag="11")] + Ref(super::Ref), + #[prost(message, tag="3")] + String(super::String), + #[prost(message, tag="6")] + Time(super::Time), + #[prost(message, tag="10")] + Unit(super::Unit), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeAlias { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="6")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeParameter { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub value: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Unit { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Value { + #[prost(oneof="value::Value", tags="2, 1, 3")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Value`. +pub mod value { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="2")] + IntValue(super::IntValue), + #[prost(message, tag="1")] + StringValue(super::StringValue), + #[prost(message, tag="3")] + TypeValue(super::TypeValue), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Verb { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub request: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub response: ::core::option::Option, + #[prost(message, repeated, tag="7")] + pub metadata: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerbRuntime { + #[prost(message, optional, tag="1")] + pub base: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub subscription: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct VerbRuntimeBase { + #[prost(message, optional, tag="1")] + pub create_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="2")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerbRuntimeEvent { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub payload: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerbRuntimePayload { + #[prost(oneof="verb_runtime_payload::Value", tags="1, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `VerbRuntimePayload`. +pub mod verb_runtime_payload { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + VerbRuntimeBase(super::VerbRuntimeBase), + #[prost(message, tag="2")] + VerbRuntimeSubscription(super::VerbRuntimeSubscription), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerbRuntimeSubscription { + #[prost(string, repeated, tag="1")] + pub kafka_brokers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AliasKind { + Unspecified = 0, + Json = 1, +} +impl AliasKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ALIAS_KIND_UNSPECIFIED", + Self::Json => "ALIAS_KIND_JSON", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ALIAS_KIND_UNSPECIFIED" => Some(Self::Unspecified), + "ALIAS_KIND_JSON" => Some(Self::Json), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum FromOffset { + Unspecified = 0, + Beginning = 1, + Latest = 2, +} +impl FromOffset { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "FROM_OFFSET_UNSPECIFIED", + Self::Beginning => "FROM_OFFSET_BEGINNING", + Self::Latest => "FROM_OFFSET_LATEST", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "FROM_OFFSET_UNSPECIFIED" => Some(Self::Unspecified), + "FROM_OFFSET_BEGINNING" => Some(Self::Beginning), + "FROM_OFFSET_LATEST" => Some(Self::Latest), + _ => None, + } + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.timeline.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.timeline.v1.rs new file mode 100644 index 0000000000..5042f7da33 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.timeline.v1.rs @@ -0,0 +1,534 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(int32, tag="4")] + pub log_level: i32, + #[prost(map="string, string", tag="5")] + pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(string, tag="6")] + pub message: ::prost::alloc::string::String, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="8")] + pub stack: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallEvent { + #[prost(string, optional, tag="1")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="11")] + pub source_verb_ref: ::core::option::Option, + #[prost(message, optional, tag="12")] + pub destination_verb_ref: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="7")] + pub request: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub response: ::prost::alloc::string::String, + #[prost(string, optional, tag="9")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="10")] + pub stack: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeploymentCreatedEvent { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub language: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub module_name: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub min_replicas: i32, + #[prost(string, optional, tag="5")] + pub replaced: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeploymentUpdatedEvent { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub min_replicas: i32, + #[prost(int32, tag="3")] + pub prev_min_replicas: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(string, tag="4")] + pub method: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub path: ::prost::alloc::string::String, + #[prost(int32, tag="7")] + pub status_code: i32, + #[prost(message, optional, tag="8")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="9")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="10")] + pub request: ::prost::alloc::string::String, + #[prost(string, tag="11")] + pub request_header: ::prost::alloc::string::String, + #[prost(string, tag="12")] + pub response: ::prost::alloc::string::String, + #[prost(string, tag="13")] + pub response_header: ::prost::alloc::string::String, + #[prost(string, optional, tag="14")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CronScheduledEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="4")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(message, optional, tag="5")] + pub scheduled_at: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="6")] + pub schedule: ::prost::alloc::string::String, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncExecuteEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="5")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(enumeration="AsyncExecuteEventType", tag="6")] + pub async_event_type: i32, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubSubPublishEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="5")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="6")] + pub topic: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub request: ::prost::alloc::string::String, + #[prost(string, optional, tag="8")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(int32, tag="9")] + pub partition: i32, + #[prost(int64, tag="10")] + pub offset: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubSubConsumeEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub dest_verb_module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="4")] + pub dest_verb_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="5")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="6")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="7")] + pub topic: ::prost::alloc::string::String, + #[prost(string, optional, tag="8")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(int32, tag="9")] + pub partition: i32, + #[prost(int64, tag="10")] + pub offset: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Event { + #[prost(message, optional, tag="1")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + /// Unique ID for event. + #[prost(int64, tag="2")] + pub id: i64, + #[prost(oneof="event::Entry", tags="3, 4, 5, 6, 7, 8, 9, 10, 11")] + pub entry: ::core::option::Option, +} +/// Nested message and enum types in `Event`. +pub mod event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Entry { + #[prost(message, tag="3")] + Log(super::LogEvent), + #[prost(message, tag="4")] + Call(super::CallEvent), + #[prost(message, tag="5")] + DeploymentCreated(super::DeploymentCreatedEvent), + #[prost(message, tag="6")] + DeploymentUpdated(super::DeploymentUpdatedEvent), + #[prost(message, tag="7")] + Ingress(super::IngressEvent), + #[prost(message, tag="8")] + CronScheduled(super::CronScheduledEvent), + #[prost(message, tag="9")] + AsyncExecute(super::AsyncExecuteEvent), + #[prost(message, tag="10")] + PubsubPublish(super::PubSubPublishEvent), + #[prost(message, tag="11")] + PubsubConsume(super::PubSubConsumeEvent), + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EventType { + Unspecified = 0, + Log = 1, + Call = 2, + DeploymentCreated = 3, + DeploymentUpdated = 4, + Ingress = 5, + CronScheduled = 6, + AsyncExecute = 7, + PubsubPublish = 8, + PubsubConsume = 9, +} +impl EventType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "EVENT_TYPE_UNSPECIFIED", + Self::Log => "EVENT_TYPE_LOG", + Self::Call => "EVENT_TYPE_CALL", + Self::DeploymentCreated => "EVENT_TYPE_DEPLOYMENT_CREATED", + Self::DeploymentUpdated => "EVENT_TYPE_DEPLOYMENT_UPDATED", + Self::Ingress => "EVENT_TYPE_INGRESS", + Self::CronScheduled => "EVENT_TYPE_CRON_SCHEDULED", + Self::AsyncExecute => "EVENT_TYPE_ASYNC_EXECUTE", + Self::PubsubPublish => "EVENT_TYPE_PUBSUB_PUBLISH", + Self::PubsubConsume => "EVENT_TYPE_PUBSUB_CONSUME", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "EVENT_TYPE_LOG" => Some(Self::Log), + "EVENT_TYPE_CALL" => Some(Self::Call), + "EVENT_TYPE_DEPLOYMENT_CREATED" => Some(Self::DeploymentCreated), + "EVENT_TYPE_DEPLOYMENT_UPDATED" => Some(Self::DeploymentUpdated), + "EVENT_TYPE_INGRESS" => Some(Self::Ingress), + "EVENT_TYPE_CRON_SCHEDULED" => Some(Self::CronScheduled), + "EVENT_TYPE_ASYNC_EXECUTE" => Some(Self::AsyncExecute), + "EVENT_TYPE_PUBSUB_PUBLISH" => Some(Self::PubsubPublish), + "EVENT_TYPE_PUBSUB_CONSUME" => Some(Self::PubsubConsume), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AsyncExecuteEventType { + Unspecified = 0, + Cron = 1, + Pubsub = 2, +} +impl AsyncExecuteEventType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ASYNC_EXECUTE_EVENT_TYPE_UNSPECIFIED", + Self::Cron => "ASYNC_EXECUTE_EVENT_TYPE_CRON", + Self::Pubsub => "ASYNC_EXECUTE_EVENT_TYPE_PUBSUB", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ASYNC_EXECUTE_EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "ASYNC_EXECUTE_EVENT_TYPE_CRON" => Some(Self::Cron), + "ASYNC_EXECUTE_EVENT_TYPE_PUBSUB" => Some(Self::Pubsub), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LogLevel { + Unspecified = 0, + Trace = 1, + Debug = 5, + Info = 9, + Warn = 13, + Error = 17, +} +impl LogLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "LOG_LEVEL_UNSPECIFIED", + Self::Trace => "LOG_LEVEL_TRACE", + Self::Debug => "LOG_LEVEL_DEBUG", + Self::Info => "LOG_LEVEL_INFO", + Self::Warn => "LOG_LEVEL_WARN", + Self::Error => "LOG_LEVEL_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "LOG_LEVEL_UNSPECIFIED" => Some(Self::Unspecified), + "LOG_LEVEL_TRACE" => Some(Self::Trace), + "LOG_LEVEL_DEBUG" => Some(Self::Debug), + "LOG_LEVEL_INFO" => Some(Self::Info), + "LOG_LEVEL_WARN" => Some(Self::Warn), + "LOG_LEVEL_ERROR" => Some(Self::Error), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTimelineRequest { + #[prost(message, repeated, tag="1")] + pub filters: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub limit: i32, + /// Ordering is done by id which matches publication order. + /// This roughly corresponds to the time of the event, but not strictly. + #[prost(enumeration="get_timeline_request::Order", tag="3")] + pub order: i32, +} +/// Nested message and enum types in `GetTimelineRequest`. +pub mod get_timeline_request { + /// Filters events by log level. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct LogLevelFilter { + #[prost(enumeration="super::LogLevel", tag="1")] + pub log_level: i32, + } + /// Filters events by deployment key. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct DeploymentFilter { + #[prost(string, repeated, tag="1")] + pub deployments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + } + /// Filters events by request key. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct RequestFilter { + #[prost(string, repeated, tag="1")] + pub requests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + } + /// Filters events by event type. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct EventTypeFilter { + #[prost(enumeration="super::EventType", repeated, tag="1")] + pub event_types: ::prost::alloc::vec::Vec, + } + /// Filters events by time. + /// + /// Either end of the time range can be omitted to indicate no bound. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct TimeFilter { + #[prost(message, optional, tag="1")] + pub older_than: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="2")] + pub newer_than: ::core::option::Option<::prost_types::Timestamp>, + } + /// Filters events by ID. + /// + /// Either end of the ID range can be omitted to indicate no bound. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct IdFilter { + #[prost(int64, optional, tag="1")] + pub lower_than: ::core::option::Option, + #[prost(int64, optional, tag="2")] + pub higher_than: ::core::option::Option, + } + /// Filters events by call. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct CallFilter { + #[prost(string, tag="1")] + pub dest_module: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub dest_verb: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub source_module: ::core::option::Option<::prost::alloc::string::String>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ModuleFilter { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub verb: ::core::option::Option<::prost::alloc::string::String>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Filter { + /// These map 1:1 with filters in backend/timeline/filters.go + #[prost(oneof="filter::Filter", tags="1, 2, 3, 4, 5, 6, 7, 8")] + pub filter: ::core::option::Option, + } + /// Nested message and enum types in `Filter`. + pub mod filter { + /// These map 1:1 with filters in backend/timeline/filters.go + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Filter { + #[prost(message, tag="1")] + LogLevel(super::LogLevelFilter), + #[prost(message, tag="2")] + Deployments(super::DeploymentFilter), + #[prost(message, tag="3")] + Requests(super::RequestFilter), + #[prost(message, tag="4")] + EventTypes(super::EventTypeFilter), + #[prost(message, tag="5")] + Time(super::TimeFilter), + #[prost(message, tag="6")] + Id(super::IdFilter), + #[prost(message, tag="7")] + Call(super::CallFilter), + #[prost(message, tag="8")] + Module(super::ModuleFilter), + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Order { + Unspecified = 0, + Asc = 1, + Desc = 2, + } + impl Order { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ORDER_UNSPECIFIED", + Self::Asc => "ORDER_ASC", + Self::Desc => "ORDER_DESC", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ORDER_UNSPECIFIED" => Some(Self::Unspecified), + "ORDER_ASC" => Some(Self::Asc), + "ORDER_DESC" => Some(Self::Desc), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTimelineResponse { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, + /// For pagination, this cursor is where we should start our next query + #[prost(int64, optional, tag="2")] + pub cursor: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamTimelineRequest { + #[prost(message, optional, tag="1")] + pub update_interval: ::core::option::Option<::prost_types::Duration>, + #[prost(message, optional, tag="2")] + pub query: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamTimelineResponse { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateEventsRequest { + #[prost(message, repeated, tag="1")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `CreateEventsRequest`. +pub mod create_events_request { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct EventEntry { + #[prost(message, optional, tag="1")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(oneof="event_entry::Entry", tags="2, 3, 4, 5, 6, 7, 8, 9, 10")] + pub entry: ::core::option::Option, + } + /// Nested message and enum types in `EventEntry`. + pub mod event_entry { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Entry { + #[prost(message, tag="2")] + Log(super::super::LogEvent), + #[prost(message, tag="3")] + Call(super::super::CallEvent), + #[prost(message, tag="4")] + DeploymentCreated(super::super::DeploymentCreatedEvent), + #[prost(message, tag="5")] + DeploymentUpdated(super::super::DeploymentUpdatedEvent), + #[prost(message, tag="6")] + Ingress(super::super::IngressEvent), + #[prost(message, tag="7")] + CronScheduled(super::super::CronScheduledEvent), + #[prost(message, tag="8")] + AsyncExecute(super::super::AsyncExecuteEvent), + #[prost(message, tag="9")] + PubsubPublish(super::super::PubSubPublishEvent), + #[prost(message, tag="10")] + PubsubConsume(super::super::PubSubConsumeEvent), + } + } +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct CreateEventsResponse { +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct DeleteOldEventsRequest { + #[prost(enumeration="EventType", tag="1")] + pub event_type: i32, + #[prost(int64, tag="2")] + pub age_seconds: i64, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct DeleteOldEventsResponse { + #[prost(int64, tag="1")] + pub deleted_count: i64, +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.console.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.console.rs new file mode 100644 index 0000000000..20e42d9fa3 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.console.rs @@ -0,0 +1,656 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(int32, tag="4")] + pub log_level: i32, + #[prost(map="string, string", tag="5")] + pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(string, tag="6")] + pub message: ::prost::alloc::string::String, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="8")] + pub stack: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallEvent { + #[prost(string, optional, tag="1")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="11")] + pub source_verb_ref: ::core::option::Option, + #[prost(message, optional, tag="12")] + pub destination_verb_ref: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="7")] + pub request: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub response: ::prost::alloc::string::String, + #[prost(string, optional, tag="9")] + pub error: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="10")] + pub stack: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeploymentCreatedEvent { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub language: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub module_name: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub min_replicas: i32, + #[prost(string, optional, tag="5")] + pub replaced: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeploymentUpdatedEvent { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub min_replicas: i32, + #[prost(int32, tag="3")] + pub prev_min_replicas: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(string, tag="4")] + pub method: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub path: ::prost::alloc::string::String, + #[prost(int32, tag="7")] + pub status_code: i32, + #[prost(message, optional, tag="8")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="9")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="10")] + pub request: ::prost::alloc::string::String, + #[prost(string, tag="11")] + pub request_header: ::prost::alloc::string::String, + #[prost(string, tag="12")] + pub response: ::prost::alloc::string::String, + #[prost(string, tag="13")] + pub response_header: ::prost::alloc::string::String, + #[prost(string, optional, tag="14")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CronScheduledEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="4")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(message, optional, tag="5")] + pub scheduled_at: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="6")] + pub schedule: ::prost::alloc::string::String, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AsyncExecuteEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="5")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(enumeration="AsyncExecuteEventType", tag="6")] + pub async_event_type: i32, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubSubPublishEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub verb_ref: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="5")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="6")] + pub topic: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub request: ::prost::alloc::string::String, + #[prost(string, optional, tag="8")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubSubConsumeEvent { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub dest_verb_module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="4")] + pub dest_verb_name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="5")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="6")] + pub duration: ::core::option::Option<::prost_types::Duration>, + #[prost(string, tag="7")] + pub topic: ::prost::alloc::string::String, + #[prost(string, optional, tag="8")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Config { + #[prost(message, optional, tag="1")] + pub config: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Data { + #[prost(message, optional, tag="1")] + pub data: ::core::option::Option, + #[prost(string, tag="2")] + pub schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="3")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Database { + #[prost(message, optional, tag="1")] + pub database: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Enum { + #[prost(message, optional, tag="1")] + pub r#enum: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topic { + #[prost(message, optional, tag="1")] + pub topic: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeAlias { + #[prost(message, optional, tag="1")] + pub typealias: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Secret { + #[prost(message, optional, tag="1")] + pub secret: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Subscription { + #[prost(message, optional, tag="1")] + pub subscription: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Verb { + #[prost(message, optional, tag="1")] + pub verb: ::core::option::Option, + #[prost(string, tag="2")] + pub schema: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub json_request_schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub references: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub language: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub schema: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub verbs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub secrets: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="8")] + pub configs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="9")] + pub databases: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="10")] + pub enums: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="11")] + pub topics: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="12")] + pub typealiases: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="13")] + pub subscriptions: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TopologyGroup { + #[prost(string, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topology { + #[prost(message, repeated, tag="1")] + pub levels: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetModulesRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetModulesResponse { + #[prost(message, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub topology: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct StreamModulesRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamModulesResponse { + #[prost(message, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub topology: ::core::option::Option, +} +/// Query for events. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventsQuery { + #[prost(message, repeated, tag="1")] + pub filters: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub limit: i32, + #[prost(enumeration="events_query::Order", tag="3")] + pub order: i32, +} +/// Nested message and enum types in `EventsQuery`. +pub mod events_query { + /// Limit the number of events returned. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct LimitFilter { + #[prost(int32, tag="1")] + pub limit: i32, + } + /// Filters events by log level. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct LogLevelFilter { + #[prost(enumeration="super::LogLevel", tag="1")] + pub log_level: i32, + } + /// Filters events by deployment key. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct DeploymentFilter { + #[prost(string, repeated, tag="1")] + pub deployments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + } + /// Filters events by request key. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct RequestFilter { + #[prost(string, repeated, tag="1")] + pub requests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + } + /// Filters events by event type. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct EventTypeFilter { + #[prost(enumeration="super::EventType", repeated, tag="1")] + pub event_types: ::prost::alloc::vec::Vec, + } + /// Filters events by time. + /// + /// Either end of the time range can be omitted to indicate no bound. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct TimeFilter { + #[prost(message, optional, tag="1")] + pub older_than: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="2")] + pub newer_than: ::core::option::Option<::prost_types::Timestamp>, + } + /// Filters events by ID. + /// + /// Either end of the ID range can be omitted to indicate no bound. + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct IdFilter { + #[prost(int64, optional, tag="1")] + pub lower_than: ::core::option::Option, + #[prost(int64, optional, tag="2")] + pub higher_than: ::core::option::Option, + } + /// Filters events by call. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct CallFilter { + #[prost(string, tag="1")] + pub dest_module: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub dest_verb: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="3")] + pub source_module: ::core::option::Option<::prost::alloc::string::String>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ModuleFilter { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub verb: ::core::option::Option<::prost::alloc::string::String>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Filter { + /// These map 1:1 with filters in backend/controller/internal/dal/events.go + #[prost(oneof="filter::Filter", tags="1, 2, 3, 4, 5, 6, 7, 8, 9")] + pub filter: ::core::option::Option, + } + /// Nested message and enum types in `Filter`. + pub mod filter { + /// These map 1:1 with filters in backend/controller/internal/dal/events.go + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Filter { + #[prost(message, tag="1")] + Limit(super::LimitFilter), + #[prost(message, tag="2")] + LogLevel(super::LogLevelFilter), + #[prost(message, tag="3")] + Deployments(super::DeploymentFilter), + #[prost(message, tag="4")] + Requests(super::RequestFilter), + #[prost(message, tag="5")] + EventTypes(super::EventTypeFilter), + #[prost(message, tag="6")] + Time(super::TimeFilter), + #[prost(message, tag="7")] + Id(super::IdFilter), + #[prost(message, tag="8")] + Call(super::CallFilter), + #[prost(message, tag="9")] + Module(super::ModuleFilter), + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Order { + Asc = 0, + Desc = 1, + } + impl Order { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Asc => "ASC", + Self::Desc => "DESC", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ASC" => Some(Self::Asc), + "DESC" => Some(Self::Desc), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamEventsRequest { + #[prost(message, optional, tag="1")] + pub update_interval: ::core::option::Option<::prost_types::Duration>, + #[prost(message, optional, tag="2")] + pub query: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamEventsResponse { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Event { + #[prost(message, optional, tag="1")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + /// Unique ID for event. + #[prost(int64, tag="2")] + pub id: i64, + #[prost(oneof="event::Entry", tags="3, 4, 5, 6, 7, 8, 9, 10, 11")] + pub entry: ::core::option::Option, +} +/// Nested message and enum types in `Event`. +pub mod event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Entry { + #[prost(message, tag="3")] + Log(super::LogEvent), + #[prost(message, tag="4")] + Call(super::CallEvent), + #[prost(message, tag="5")] + DeploymentCreated(super::DeploymentCreatedEvent), + #[prost(message, tag="6")] + DeploymentUpdated(super::DeploymentUpdatedEvent), + #[prost(message, tag="7")] + Ingress(super::IngressEvent), + #[prost(message, tag="8")] + CronScheduled(super::CronScheduledEvent), + #[prost(message, tag="9")] + AsyncExecute(super::AsyncExecuteEvent), + #[prost(message, tag="10")] + PubsubPublish(super::PubSubPublishEvent), + #[prost(message, tag="11")] + PubsubConsume(super::PubSubConsumeEvent), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetEventsResponse { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, + /// For pagination, this cursor is where we should start our next query + #[prost(int64, optional, tag="2")] + pub cursor: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetConfigRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetConfigResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetConfigRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetConfigResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSecretRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSecretResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSecretRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetSecretResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EventType { + Unknown = 0, + Log = 1, + Call = 2, + DeploymentCreated = 3, + DeploymentUpdated = 4, + Ingress = 5, + CronScheduled = 6, + AsyncExecute = 7, + PubsubPublish = 8, + PubsubConsume = 9, +} +impl EventType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unknown => "EVENT_TYPE_UNKNOWN", + Self::Log => "EVENT_TYPE_LOG", + Self::Call => "EVENT_TYPE_CALL", + Self::DeploymentCreated => "EVENT_TYPE_DEPLOYMENT_CREATED", + Self::DeploymentUpdated => "EVENT_TYPE_DEPLOYMENT_UPDATED", + Self::Ingress => "EVENT_TYPE_INGRESS", + Self::CronScheduled => "EVENT_TYPE_CRON_SCHEDULED", + Self::AsyncExecute => "EVENT_TYPE_ASYNC_EXECUTE", + Self::PubsubPublish => "EVENT_TYPE_PUBSUB_PUBLISH", + Self::PubsubConsume => "EVENT_TYPE_PUBSUB_CONSUME", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EVENT_TYPE_UNKNOWN" => Some(Self::Unknown), + "EVENT_TYPE_LOG" => Some(Self::Log), + "EVENT_TYPE_CALL" => Some(Self::Call), + "EVENT_TYPE_DEPLOYMENT_CREATED" => Some(Self::DeploymentCreated), + "EVENT_TYPE_DEPLOYMENT_UPDATED" => Some(Self::DeploymentUpdated), + "EVENT_TYPE_INGRESS" => Some(Self::Ingress), + "EVENT_TYPE_CRON_SCHEDULED" => Some(Self::CronScheduled), + "EVENT_TYPE_ASYNC_EXECUTE" => Some(Self::AsyncExecute), + "EVENT_TYPE_PUBSUB_PUBLISH" => Some(Self::PubsubPublish), + "EVENT_TYPE_PUBSUB_CONSUME" => Some(Self::PubsubConsume), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AsyncExecuteEventType { + Unknown = 0, + Cron = 1, + Pubsub = 2, +} +impl AsyncExecuteEventType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unknown => "ASYNC_EXECUTE_EVENT_TYPE_UNKNOWN", + Self::Cron => "ASYNC_EXECUTE_EVENT_TYPE_CRON", + Self::Pubsub => "ASYNC_EXECUTE_EVENT_TYPE_PUBSUB", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ASYNC_EXECUTE_EVENT_TYPE_UNKNOWN" => Some(Self::Unknown), + "ASYNC_EXECUTE_EVENT_TYPE_CRON" => Some(Self::Cron), + "ASYNC_EXECUTE_EVENT_TYPE_PUBSUB" => Some(Self::Pubsub), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LogLevel { + Unknown = 0, + Trace = 1, + Debug = 5, + Info = 9, + Warn = 13, + Error = 17, +} +impl LogLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unknown => "LOG_LEVEL_UNKNOWN", + Self::Trace => "LOG_LEVEL_TRACE", + Self::Debug => "LOG_LEVEL_DEBUG", + Self::Info => "LOG_LEVEL_INFO", + Self::Warn => "LOG_LEVEL_WARN", + Self::Error => "LOG_LEVEL_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "LOG_LEVEL_UNKNOWN" => Some(Self::Unknown), + "LOG_LEVEL_TRACE" => Some(Self::Trace), + "LOG_LEVEL_DEBUG" => Some(Self::Debug), + "LOG_LEVEL_INFO" => Some(Self::Info), + "LOG_LEVEL_WARN" => Some(Self::Warn), + "LOG_LEVEL_ERROR" => Some(Self::Error), + _ => None, + } + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.language.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.language.rs new file mode 100644 index 0000000000..f94f87ff2e --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.language.rs @@ -0,0 +1,396 @@ +// @generated +// This file is @generated by prost-build. +/// ModuleConfig contains the configuration for a module, found in the module's ftl.toml file. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfig { + /// Name of the module + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + /// Absolute path to the module's directory + #[prost(string, tag="2")] + pub dir: ::prost::alloc::string::String, + /// The language of the module + #[prost(string, tag="3")] + pub language: ::prost::alloc::string::String, + /// Absolute path to the directory containing all of this module's build artifacts for deployments + #[prost(string, tag="4")] + pub deploy_dir: ::prost::alloc::string::String, + /// Build is the command to build the module. + #[prost(string, optional, tag="5")] + pub build: ::core::option::Option<::prost::alloc::string::String>, + /// DevModeBuild is the command to build the module in dev mode. + #[prost(string, optional, tag="6")] + pub dev_mode_build: ::core::option::Option<::prost::alloc::string::String>, + /// Build lock path to prevent concurrent builds + #[prost(string, tag="7")] + pub build_lock: ::prost::alloc::string::String, + /// The directory to generate protobuf schema files into. These can be picked up by language specific build tools + #[prost(string, optional, tag="8")] + pub generated_schema_dir: ::core::option::Option<::prost::alloc::string::String>, + /// Patterns to watch for file changes + #[prost(string, repeated, tag="9")] + pub watch: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// LanguageConfig contains any metadata specific to a specific language. + /// These are stored in the ftl.toml file under the same key as the language (eg: "go", "java") + #[prost(message, optional, tag="10")] + pub language_config: ::core::option::Option<::prost_types::Struct>, +} +/// ProjectConfig contains the configuration for a project, found in the ftl-project.toml file. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProjectConfig { + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(bool, tag="3")] + pub no_git: bool, + #[prost(bool, tag="4")] + pub hermit: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetCreateModuleFlagsRequest { + #[prost(string, tag="1")] + pub language: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetCreateModuleFlagsResponse { + #[prost(message, repeated, tag="1")] + pub flags: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `GetCreateModuleFlagsResponse`. +pub mod get_create_module_flags_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Flag { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub help: ::prost::alloc::string::String, + #[prost(string, optional, tag="3")] + pub envar: ::core::option::Option<::prost::alloc::string::String>, + /// short must be a single character + #[prost(string, optional, tag="4")] + pub short: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub placeholder: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="6")] + pub default: ::core::option::Option<::prost::alloc::string::String>, + } +} +/// Request to create a new module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateModuleRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + /// The root directory for the module, which does not yet exist. + /// The plugin should create the directory. + #[prost(string, tag="2")] + pub dir: ::prost::alloc::string::String, + /// The project configuration + #[prost(message, optional, tag="3")] + pub project_config: ::core::option::Option, + /// Flags contains any values set for those configured in the GetCreateModuleFlags call + #[prost(message, optional, tag="4")] + pub flags: ::core::option::Option<::prost_types::Struct>, +} +/// Response to a create module request. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct CreateModuleResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfigDefaultsRequest { + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, +} +/// ModuleConfigDefaultsResponse provides defaults for ModuleConfig. +/// +/// The result may be cached by FTL, so defaulting logic should not be changing due to normal module changes. +/// For example, it is valid to return defaults based on which build tool is configured within the module directory, +/// as that is not expected to change during normal operation. +/// It is not recommended to read the module's toml file to determine defaults, as when the toml file is updated, +/// the module defaults will not be recalculated. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleConfigDefaultsResponse { + /// Default relative path to the directory containing all build artifacts for deployments + #[prost(string, tag="1")] + pub deploy_dir: ::prost::alloc::string::String, + /// Default build command + #[prost(string, optional, tag="2")] + pub build: ::core::option::Option<::prost::alloc::string::String>, + /// Dev mode build command, if different from the regular build command + #[prost(string, optional, tag="3")] + pub dev_mode_build: ::core::option::Option<::prost::alloc::string::String>, + /// Build lock path to prevent concurrent builds + #[prost(string, optional, tag="4")] + pub build_lock: ::core::option::Option<::prost::alloc::string::String>, + /// Default relative path to the directory containing generated schema files + #[prost(string, optional, tag="5")] + pub generated_schema_dir: ::core::option::Option<::prost::alloc::string::String>, + /// Default patterns to watch for file changes, relative to the module directory + #[prost(string, repeated, tag="6")] + pub watch: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// SQLQueryDir is the path to the SQL query directory, relative to the module directory. + #[prost(string, tag="8")] + pub sql_query_dir: ::prost::alloc::string::String, + /// Default language specific configuration. + /// These defaults are filled in by looking at each root key only. If the key is not present, the default is used. + #[prost(message, optional, tag="7")] + pub language_config: ::core::option::Option<::prost_types::Struct>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DependenciesRequest { + #[prost(message, optional, tag="1")] + pub module_config: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DependenciesResponse { + #[prost(string, repeated, tag="1")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// BuildContext contains contextual information needed to build. +/// +/// Plugins must include the build context's id when a build succeeds or fails. +/// For automatic rebuilds, plugins must use the most recent build context they have received. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildContext { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + /// The configuration for the module + #[prost(message, optional, tag="2")] + pub module_config: ::core::option::Option, + /// The FTL schema including all dependencies + #[prost(message, optional, tag="3")] + pub schema: ::core::option::Option, + /// The dependencies for the module + #[prost(string, repeated, tag="4")] + pub dependencies: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Build environment provides environment variables to be set for the build command + #[prost(string, repeated, tag="5")] + pub build_env: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildContextUpdatedRequest { + #[prost(message, optional, tag="1")] + pub build_context: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct BuildContextUpdatedResponse { +} +/// Error contains information about an error that occurred during a build. +/// Errors do not always cause a build failure. Use lesser levels to help guide the user. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(string, tag="1")] + pub msg: ::prost::alloc::string::String, + #[prost(enumeration="error::ErrorLevel", tag="4")] + pub level: i32, + #[prost(message, optional, tag="5")] + pub pos: ::core::option::Option, + #[prost(enumeration="error::ErrorType", tag="6")] + pub r#type: i32, +} +/// Nested message and enum types in `Error`. +pub mod error { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ErrorLevel { + Info = 0, + Warn = 1, + Error = 2, + } + impl ErrorLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Info => "INFO", + Self::Warn => "WARN", + Self::Error => "ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "INFO" => Some(Self::Info), + "WARN" => Some(Self::Warn), + "ERROR" => Some(Self::Error), + _ => None, + } + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ErrorType { + Ftl = 0, + /// Compiler errors are errors that are from the compiler. This is useful to avoid duplicate errors + /// being shown to the user when combining errors from multiple sources (eg: an IDE showing compiler + /// errors and FTL errors via LSP). + Compiler = 1, + } + impl ErrorType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Ftl => "FTL", + Self::Compiler => "COMPILER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "FTL" => Some(Self::Ftl), + "COMPILER" => Some(Self::Compiler), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + #[prost(string, tag="1")] + pub filename: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub line: i64, + #[prost(int64, tag="3")] + pub start_column: i64, + #[prost(int64, tag="4")] + pub end_column: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ErrorList { + #[prost(message, repeated, tag="1")] + pub errors: ::prost::alloc::vec::Vec, +} +/// Request to build a module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildRequest { + /// The root path for the FTL project + #[prost(string, tag="1")] + pub project_root: ::prost::alloc::string::String, + /// The path to the directory containing all module stubs. Each module stub is in a subdirectory. + #[prost(string, tag="2")] + pub stubs_root: ::prost::alloc::string::String, + /// Indicates whether to watch for file changes and automatically rebuild + #[prost(bool, tag="3")] + pub rebuild_automatically: bool, + #[prost(message, optional, tag="4")] + pub build_context: ::core::option::Option, +} +/// AutoRebuildStarted should be sent when the plugin decides to start rebuilding automatically. +/// +/// It is not required to send this event, though it helps inform the user that their changes are not yet built. +/// FTL may ignore this event if it does not match FTL's current build context and state. +/// If the plugin decides to cancel the build because another build started, no failure or cancellation event needs +/// to be sent. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AutoRebuildStarted { + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, +} +/// BuildSuccess should be sent when a build succeeds. +/// +/// FTL may ignore this event if it does not match FTL's current build context and state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildSuccess { + /// The id of build context used while building. + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, + /// Indicates whether the build was automatically started by the plugin, rather than due to a Build rpc call. + #[prost(bool, tag="2")] + pub is_automatic_rebuild: bool, + /// Module schema for the built module + #[prost(message, optional, tag="3")] + pub module: ::core::option::Option, + /// Paths for files/directories to be deployed + #[prost(string, repeated, tag="4")] + pub deploy: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Name of the docker image to use for the runner + #[prost(string, tag="5")] + pub docker_image: ::prost::alloc::string::String, + /// Errors contains any errors that occurred during the build + /// No errors can have a level of ERROR, instead a BuildFailure should be sent + /// Instead this is useful for INFO and WARN level errors. + #[prost(message, optional, tag="6")] + pub errors: ::core::option::Option, + /// Dev mode endpoint URI. If this is set then rather than trying to deploy the module, FTL will start a runner that + /// connects to this endpoint. + #[prost(string, optional, tag="7")] + pub dev_endpoint: ::core::option::Option<::prost::alloc::string::String>, +} +/// BuildFailure should be sent when a build fails. +/// +/// FTL may ignore this event if it does not match FTL's current build context and state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildFailure { + /// The id of build context used while building. + #[prost(string, tag="1")] + pub context_id: ::prost::alloc::string::String, + /// Indicates whether the build was automatically started by the plugin, rather than due to a Build rpc call. + #[prost(bool, tag="2")] + pub is_automatic_rebuild: bool, + /// Errors contains any errors that occurred during the build + #[prost(message, optional, tag="3")] + pub errors: ::core::option::Option, + /// Indicates the plugin determined that the dependencies in the BuildContext are out of date. + /// If a Build stream is being kept open for automatic rebuilds, FTL will call GetDependencies, followed by + /// BuildContextUpdated. + #[prost(bool, tag="4")] + pub invalidate_dependencies: bool, +} +/// Every type of message that can be streamed from the language plugin for a build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuildEvent { + #[prost(oneof="build_event::Event", tags="2, 3, 4")] + pub event: ::core::option::Option, +} +/// Nested message and enum types in `BuildEvent`. +pub mod build_event { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Event { + #[prost(message, tag="2")] + AutoRebuildStarted(super::AutoRebuildStarted), + #[prost(message, tag="3")] + BuildSuccess(super::BuildSuccess), + #[prost(message, tag="4")] + BuildFailure(super::BuildFailure), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenerateStubsRequest { + /// The directory path to generate stubs into + #[prost(string, tag="1")] + pub dir: ::prost::alloc::string::String, + /// The schema of the module to generate stubs for + #[prost(message, optional, tag="2")] + pub module: ::core::option::Option, + /// The module's configuration to generate stubs for + #[prost(message, optional, tag="3")] + pub module_config: ::core::option::Option, + /// Native module configuration is the configuration for a module that uses the plugin's language, if + /// the main moduleConfig provided is of a different language. It is provided as a mechanism to derive + /// language specific information. For example, the language version. + #[prost(message, optional, tag="4")] + pub native_module_config: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GenerateStubsResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncStubReferencesRequest { + #[prost(message, optional, tag="1")] + pub module_config: ::core::option::Option, + /// The path of the directory containing all module stubs. Each module is in a subdirectory + #[prost(string, tag="2")] + pub stubs_root: ::prost::alloc::string::String, + /// The names of all modules that have had stubs generated + #[prost(string, repeated, tag="3")] + pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct SyncStubReferencesResponse { +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.rs new file mode 100644 index 0000000000..4f1cb6b865 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.rs @@ -0,0 +1,567 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PingRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PingResponse { + /// If present, the service is not ready to accept requests and this is the + /// reason. + #[prost(string, optional, tag="1")] + pub not_ready: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Metadata { + #[prost(message, repeated, tag="1")] + pub values: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Metadata`. +pub mod metadata { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Pair { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub value: ::prost::alloc::string::String, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigRef { + #[prost(string, optional, tag="1")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigListRequest { + #[prost(string, optional, tag="1")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="2")] + pub include_values: ::core::option::Option, + #[prost(enumeration="ConfigProvider", optional, tag="3")] + pub provider: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigListResponse { + #[prost(message, repeated, tag="1")] + pub configs: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `ConfigListResponse`. +pub mod config_list_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Config { + #[prost(string, tag="1")] + pub ref_path: ::prost::alloc::string::String, + #[prost(bytes="bytes", optional, tag="2")] + pub value: ::core::option::Option<::prost::bytes::Bytes>, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigGetRequest { + #[prost(message, optional, tag="1")] + pub r#ref: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigGetResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigSetRequest { + #[prost(enumeration="ConfigProvider", optional, tag="1")] + pub provider: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub r#ref: ::core::option::Option, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ConfigSetResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigUnsetRequest { + #[prost(enumeration="ConfigProvider", optional, tag="1")] + pub provider: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub r#ref: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ConfigUnsetResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretsListRequest { + #[prost(string, optional, tag="1")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bool, optional, tag="2")] + pub include_values: ::core::option::Option, + #[prost(enumeration="SecretProvider", optional, tag="3")] + pub provider: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretsListResponse { + #[prost(message, repeated, tag="1")] + pub secrets: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `SecretsListResponse`. +pub mod secrets_list_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Secret { + #[prost(string, tag="1")] + pub ref_path: ::prost::alloc::string::String, + #[prost(bytes="bytes", optional, tag="2")] + pub value: ::core::option::Option<::prost::bytes::Bytes>, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretGetRequest { + #[prost(message, optional, tag="1")] + pub r#ref: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretGetResponse { + #[prost(bytes="bytes", tag="1")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretSetRequest { + #[prost(enumeration="SecretProvider", optional, tag="1")] + pub provider: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub r#ref: ::core::option::Option, + #[prost(bytes="bytes", tag="3")] + pub value: ::prost::bytes::Bytes, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct SecretSetResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SecretUnsetRequest { + #[prost(enumeration="SecretProvider", optional, tag="1")] + pub provider: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub r#ref: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct SecretUnsetResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MapConfigsForModuleRequest { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MapConfigsForModuleResponse { + #[prost(map="string, bytes", tag="1")] + pub values: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MapSecretsForModuleRequest { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MapSecretsForModuleResponse { + #[prost(map="string, bytes", tag="1")] + pub values: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ConfigProvider { + Unspecified = 0, + /// Write values inline in the configuration file. + Inline = 1, + /// Print configuration as environment variables. + Envar = 2, +} +impl ConfigProvider { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "CONFIG_PROVIDER_UNSPECIFIED", + Self::Inline => "CONFIG_PROVIDER_INLINE", + Self::Envar => "CONFIG_PROVIDER_ENVAR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CONFIG_PROVIDER_UNSPECIFIED" => Some(Self::Unspecified), + "CONFIG_PROVIDER_INLINE" => Some(Self::Inline), + "CONFIG_PROVIDER_ENVAR" => Some(Self::Envar), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SecretProvider { + Unspecified = 0, + /// Write values inline in the configuration file. + Inline = 1, + /// Print configuration as environment variables. + Envar = 2, + /// Write to the system keychain. + Keychain = 3, + /// Store a secret in the 1Password vault. + Op = 4, + /// Store a secret in the AWS Secrets Manager. + Asm = 5, +} +impl SecretProvider { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SECRET_PROVIDER_UNSPECIFIED", + Self::Inline => "SECRET_PROVIDER_INLINE", + Self::Envar => "SECRET_PROVIDER_ENVAR", + Self::Keychain => "SECRET_PROVIDER_KEYCHAIN", + Self::Op => "SECRET_PROVIDER_OP", + Self::Asm => "SECRET_PROVIDER_ASM", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SECRET_PROVIDER_UNSPECIFIED" => Some(Self::Unspecified), + "SECRET_PROVIDER_INLINE" => Some(Self::Inline), + "SECRET_PROVIDER_ENVAR" => Some(Self::Envar), + "SECRET_PROVIDER_KEYCHAIN" => Some(Self::Keychain), + "SECRET_PROVIDER_OP" => Some(Self::Op), + "SECRET_PROVIDER_ASM" => Some(Self::Asm), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetArtefactDiffsRequest { + #[prost(string, repeated, tag="1")] + pub client_digests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetArtefactDiffsResponse { + #[prost(string, repeated, tag="1")] + pub missing_digests: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Artefacts that the client already has, and their path+executable status. + #[prost(message, repeated, tag="2")] + pub client_artefacts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UploadArtefactRequest { + #[prost(bytes="bytes", tag="1")] + pub content: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UploadArtefactResponse { + #[prost(bytes="bytes", tag="2")] + pub digest: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeploymentArtefact { + #[prost(string, tag="1")] + pub digest: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub path: ::prost::alloc::string::String, + #[prost(bool, tag="3")] + pub executable: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateDeploymentRequest { + #[prost(message, optional, tag="1")] + pub schema: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub artefacts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateDeploymentResponse { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + /// Currently active deployment for this module, if any. + #[prost(string, optional, tag="2")] + pub active_deployment_key: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentArtefactsRequest { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(message, repeated, tag="2")] + pub have_artefacts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentArtefactsResponse { + #[prost(message, optional, tag="1")] + pub artefact: ::core::option::Option, + #[prost(bytes="bytes", tag="2")] + pub chunk: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentRequest { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDeploymentResponse { + #[prost(message, optional, tag="1")] + pub schema: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub artefacts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegisterRunnerRequest { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub deployment: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub labels: ::core::option::Option<::prost_types::Struct>, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct RegisterRunnerResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateDeployRequest { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(int32, optional, tag="2")] + pub min_replicas: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct UpdateDeployResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReplaceDeployRequest { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub min_replicas: i32, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ReplaceDeployResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamDeploymentLogsRequest { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + #[prost(string, optional, tag="2")] + pub request_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="3")] + pub time_stamp: ::core::option::Option<::prost_types::Timestamp>, + #[prost(int32, tag="4")] + pub log_level: i32, + #[prost(map="string, string", tag="5")] + pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + #[prost(string, tag="6")] + pub message: ::prost::alloc::string::String, + #[prost(string, optional, tag="7")] + pub error: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct StreamDeploymentLogsResponse { +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct StatusRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + #[prost(message, repeated, tag="1")] + pub controllers: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub runners: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub deployments: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="5")] + pub routes: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `StatusResponse`. +pub mod status_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Controller { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub version: ::prost::alloc::string::String, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Runner { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, optional, tag="3")] + pub deployment: ::core::option::Option<::prost::alloc::string::String>, + #[prost(message, optional, tag="4")] + pub labels: ::core::option::Option<::prost_types::Struct>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Deployment { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub language: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub min_replicas: i32, + #[prost(int32, tag="7")] + pub replicas: i32, + #[prost(message, optional, tag="5")] + pub labels: ::core::option::Option<::prost_types::Struct>, + #[prost(message, optional, tag="6")] + pub schema: ::core::option::Option, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Route { + #[prost(string, tag="1")] + pub module: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub deployment: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub endpoint: ::prost::alloc::string::String, + } +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ProcessListRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProcessListResponse { + #[prost(message, repeated, tag="1")] + pub processes: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `ProcessListResponse`. +pub mod process_list_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ProcessRunner { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub endpoint: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub labels: ::core::option::Option<::prost_types::Struct>, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Process { + #[prost(string, tag="1")] + pub deployment: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub min_replicas: i32, + #[prost(message, optional, tag="3")] + pub labels: ::core::option::Option<::prost_types::Struct>, + #[prost(message, optional, tag="4")] + pub runner: ::core::option::Option, + } +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetSchemaRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetSchemaResponse { + #[prost(message, optional, tag="1")] + pub schema: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PullSchemaRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PullSchemaResponse { + /// Will not be set for builtin modules. + #[prost(string, optional, tag="1")] + pub deployment_key: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub module_name: ::prost::alloc::string::String, + /// For deletes this will not be present. + #[prost(message, optional, tag="4")] + pub schema: ::core::option::Option, + /// If true there are more schema changes immediately following this one as part of the initial batch. + /// If false this is the last schema change in the initial batch, but others may follow later. + #[prost(bool, tag="3")] + pub more: bool, + #[prost(enumeration="DeploymentChangeType", tag="5")] + pub change_type: i32, + /// If this is true then the module was removed as well as the deployment. This is only set for DEPLOYMENT_REMOVED. + #[prost(bool, tag="6")] + pub module_removed: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateDeploymentRuntimeRequest { + #[prost(string, tag="1")] + pub deployment: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub event: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct UpdateDeploymentRuntimeResponse { +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum DeploymentChangeType { + Unspecified = 0, + Added = 1, + Removed = 2, + Changed = 3, +} +impl DeploymentChangeType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "DEPLOYMENT_CHANGE_TYPE_UNSPECIFIED", + Self::Added => "DEPLOYMENT_CHANGE_TYPE_ADDED", + Self::Removed => "DEPLOYMENT_CHANGE_TYPE_REMOVED", + Self::Changed => "DEPLOYMENT_CHANGE_TYPE_CHANGED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "DEPLOYMENT_CHANGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified), + "DEPLOYMENT_CHANGE_TYPE_ADDED" => Some(Self::Added), + "DEPLOYMENT_CHANGE_TYPE_REMOVED" => Some(Self::Removed), + "DEPLOYMENT_CHANGE_TYPE_CHANGED" => Some(Self::Changed), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallRequest { + #[prost(message, optional, tag="1")] + pub metadata: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub verb: ::core::option::Option, + #[prost(bytes="bytes", tag="3")] + pub body: ::prost::bytes::Bytes, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CallResponse { + #[prost(oneof="call_response::Response", tags="1, 2")] + pub response: ::core::option::Option, +} +/// Nested message and enum types in `CallResponse`. +pub mod call_response { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Error { + #[prost(string, tag="1")] + pub message: ::prost::alloc::string::String, + /// TODO: Richer error type. + #[prost(string, optional, tag="2")] + pub stack: ::core::option::Option<::prost::alloc::string::String>, + } + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Response { + #[prost(bytes, tag="1")] + Body(::prost::bytes::Bytes), + #[prost(message, tag="2")] + Error(Error), + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.schema.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.schema.rs new file mode 100644 index 0000000000..4a7cbcde6e --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1.schema.rs @@ -0,0 +1,580 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Any { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Array { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub element: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bool { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bytes { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Config { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Data { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub type_parameters: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub fields: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Database { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="4")] + pub r#type: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DatabaseRuntime { + #[prost(string, tag="1")] + pub dsn: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Decl { + #[prost(oneof="decl::Value", tags="6, 1, 3, 4, 7, 10, 9, 5, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Decl`. +pub mod decl { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="6")] + Config(super::Config), + #[prost(message, tag="1")] + Data(super::Data), + #[prost(message, tag="3")] + Database(super::Database), + #[prost(message, tag="4")] + Enum(super::Enum), + #[prost(message, tag="7")] + Secret(super::Secret), + #[prost(message, tag="10")] + Subscription(super::Subscription), + #[prost(message, tag="9")] + Topic(super::Topic), + #[prost(message, tag="5")] + TypeAlias(super::TypeAlias), + #[prost(message, tag="2")] + Verb(super::Verb), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Enum { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="6")] + pub variants: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EnumVariant { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub value: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Field { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="3")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="5")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Float { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathComponent { + #[prost(oneof="ingress_path_component::Value", tags="1, 2")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `IngressPathComponent`. +pub mod ingress_path_component { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + IngressPathLiteral(super::IngressPathLiteral), + #[prost(message, tag="2")] + IngressPathParameter(super::IngressPathParameter), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathLiteral { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub text: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngressPathParameter { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Int { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IntValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(int64, tag="2")] + pub value: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Map { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub key: ::core::option::Option<::prost::alloc::boxed::Box>, + #[prost(message, optional, boxed, tag="3")] + pub value: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Metadata { + #[prost(oneof="metadata::Value", tags="5, 1, 10, 3, 4, 9, 2, 12, 6, 11, 7, 8")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Metadata`. +pub mod metadata { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="5")] + Alias(super::MetadataAlias), + #[prost(message, tag="1")] + Calls(super::MetadataCalls), + #[prost(message, tag="10")] + Config(super::MetadataConfig), + #[prost(message, tag="3")] + CronJob(super::MetadataCronJob), + #[prost(message, tag="4")] + Databases(super::MetadataDatabases), + #[prost(message, tag="9")] + Encoding(super::MetadataEncoding), + #[prost(message, tag="2")] + Ingress(super::MetadataIngress), + #[prost(message, tag="12")] + Publisher(super::MetadataPublisher), + #[prost(message, tag="6")] + Retry(super::MetadataRetry), + #[prost(message, tag="11")] + Secrets(super::MetadataSecrets), + #[prost(message, tag="7")] + Subscriber(super::MetadataSubscriber), + #[prost(message, tag="8")] + TypeMap(super::MetadataTypeMap), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataAlias { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(enumeration="AliasKind", tag="2")] + pub kind: i32, + #[prost(string, tag="3")] + pub alias: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataCalls { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub calls: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataConfig { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub config: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataCronJob { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub cron: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataDatabases { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub calls: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataEncoding { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub r#type: ::prost::alloc::string::String, + #[prost(bool, tag="3")] + pub lenient: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataIngress { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub r#type: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub method: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub path: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataPublisher { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub topics: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataRetry { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(int64, optional, tag="2")] + pub count: ::core::option::Option, + #[prost(string, tag="3")] + pub min_backoff: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub max_backoff: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub catch: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataSecrets { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub secrets: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataSubscriber { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataTypeMap { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub runtime: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub native_name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Module { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub builtin: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub decls: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleRuntime { + #[prost(message, optional, tag="1")] + pub create_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="2")] + pub language: ::prost::alloc::string::String, + #[prost(int32, tag="3")] + pub min_replicas: i32, + #[prost(string, optional, tag="4")] + pub os: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="5")] + pub arch: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag="6")] + pub image: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Optional { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, boxed, tag="2")] + pub r#type: ::core::option::Option<::prost::alloc::boxed::Box>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Position { + #[prost(string, tag="1")] + pub filename: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub line: i64, + #[prost(int64, tag="3")] + pub column: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Ref { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="3")] + pub module: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub type_parameters: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schema { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub modules: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Secret { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub r#type: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct String { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StringValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub value: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Subscription { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="4")] + pub topic: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Time { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Topic { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub event: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Type { + #[prost(oneof="r#type::Value", tags="9, 7, 5, 4, 2, 1, 8, 12, 11, 3, 6, 10")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Type`. +pub mod r#type { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="9")] + Any(super::Any), + #[prost(message, tag="7")] + Array(::prost::alloc::boxed::Box), + #[prost(message, tag="5")] + Bool(super::Bool), + #[prost(message, tag="4")] + Bytes(super::Bytes), + #[prost(message, tag="2")] + Float(super::Float), + #[prost(message, tag="1")] + Int(super::Int), + #[prost(message, tag="8")] + Map(::prost::alloc::boxed::Box), + #[prost(message, tag="12")] + Optional(::prost::alloc::boxed::Box), + #[prost(message, tag="11")] + Ref(super::Ref), + #[prost(message, tag="3")] + String(super::String), + #[prost(message, tag="6")] + Time(super::Time), + #[prost(message, tag="10")] + Unit(super::Unit), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeAlias { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub r#type: ::core::option::Option, + #[prost(message, repeated, tag="6")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeParameter { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TypeValue { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub value: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Unit { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Value { + #[prost(oneof="value::Value", tags="2, 1, 3")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Value`. +pub mod value { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="2")] + IntValue(super::IntValue), + #[prost(message, tag="1")] + StringValue(super::StringValue), + #[prost(message, tag="3")] + TypeValue(super::TypeValue), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Verb { + #[prost(message, optional, tag="1")] + pub pos: ::core::option::Option, + #[prost(string, repeated, tag="2")] + pub comments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="3")] + pub export: bool, + #[prost(string, tag="4")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="5")] + pub request: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub response: ::core::option::Option, + #[prost(message, repeated, tag="7")] + pub metadata: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="31634")] + pub runtime: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct VerbRuntime { + #[prost(message, optional, tag="1")] + pub create_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="2")] + pub start_time: ::core::option::Option<::prost_types::Timestamp>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AliasKind { + Json = 0, +} +impl AliasKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Json => "ALIAS_KIND_JSON", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ALIAS_KIND_JSON" => Some(Self::Json), + _ => None, + } + } +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1beta1.provisioner.rs b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1beta1.provisioner.rs new file mode 100644 index 0000000000..5afa82d799 --- /dev/null +++ b/sqlc-gen-ftl/src/protos/xyz.block.ftl.v1beta1.provisioner.rs @@ -0,0 +1,189 @@ +// @generated +// This file is @generated by prost-build. +/// Resource is an abstract resource extracted from FTL Schema. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Resource { + /// id unique within the module + #[prost(string, tag="1")] + pub resource_id: ::prost::alloc::string::String, + #[prost(oneof="resource::Resource", tags="102, 103, 104")] + pub resource: ::core::option::Option, +} +/// Nested message and enum types in `Resource`. +pub mod resource { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Resource { + #[prost(message, tag="102")] + Postgres(super::PostgresResource), + #[prost(message, tag="103")] + Mysql(super::MysqlResource), + #[prost(message, tag="104")] + Module(super::ModuleResource), + } +} +// Resource types +// +// any output created by the provisioner is stored in a field called "output" + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PostgresResource { + #[prost(message, optional, tag="1")] + pub output: ::core::option::Option, +} +/// Nested message and enum types in `PostgresResource`. +pub mod postgres_resource { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct PostgresResourceOutput { + #[prost(string, tag="1")] + pub read_dsn: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub write_dsn: ::prost::alloc::string::String, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MysqlResource { + #[prost(message, optional, tag="1")] + pub output: ::core::option::Option, +} +/// Nested message and enum types in `MysqlResource`. +pub mod mysql_resource { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct MysqlResourceOutput { + #[prost(string, tag="1")] + pub read_dsn: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub write_dsn: ::prost::alloc::string::String, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModuleResource { + #[prost(message, optional, tag="1")] + pub output: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub schema: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub artefacts: ::prost::alloc::vec::Vec, + /// Runner labels required to run this deployment. + #[prost(message, optional, tag="4")] + pub labels: ::core::option::Option<::prost_types::Struct>, +} +/// Nested message and enum types in `ModuleResource`. +pub mod module_resource { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ModuleResourceOutput { + #[prost(string, tag="1")] + pub deployment_key: ::prost::alloc::string::String, + } +} +/// ResourceContext is the context used to create a new resource +/// This includes the direct dependencies of the new resource, that can impact +/// the resource creation. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResourceContext { + #[prost(message, optional, tag="1")] + pub resource: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub dependencies: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProvisionRequest { + #[prost(string, tag="1")] + pub ftl_cluster_id: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub module: ::prost::alloc::string::String, + /// The resource FTL thinks exists currently + #[prost(message, repeated, tag="3")] + pub existing_resources: ::prost::alloc::vec::Vec, + /// The resource FTL would like to exist after this provisioning run. + /// This includes all new, existing, and changes resources in this change. + #[prost(message, repeated, tag="4")] + pub desired_resources: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProvisionResponse { + #[prost(string, tag="1")] + pub provisioning_token: ::prost::alloc::string::String, + #[prost(enumeration="provision_response::ProvisionResponseStatus", tag="2")] + pub status: i32, +} +/// Nested message and enum types in `ProvisionResponse`. +pub mod provision_response { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ProvisionResponseStatus { + Unknown = 0, + Submitted = 1, + } + impl ProvisionResponseStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unknown => "UNKNOWN", + Self::Submitted => "SUBMITTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "SUBMITTED" => Some(Self::Submitted), + _ => None, + } + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusRequest { + #[prost(string, tag="1")] + pub provisioning_token: ::prost::alloc::string::String, + /// The set of desired_resources used to initiate this provisioning request + /// We need this as input here, so we can populate any resource fields in them + /// when the provisioning finishes + #[prost(message, repeated, tag="2")] + pub desired_resources: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + #[prost(oneof="status_response::Status", tags="1, 2")] + pub status: ::core::option::Option, +} +/// Nested message and enum types in `StatusResponse`. +pub mod status_response { + #[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct ProvisioningRunning { + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ProvisioningFailed { + #[prost(string, tag="1")] + pub error_message: ::prost::alloc::string::String, + } + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ProvisioningSuccess { + /// Some fields in the resources might have been populated + /// during the provisioning. The new state is returned here + #[prost(message, repeated, tag="1")] + pub updated_resources: ::prost::alloc::vec::Vec, + } + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Status { + #[prost(message, tag="1")] + Running(ProvisioningRunning), + #[prost(message, tag="2")] + Success(ProvisioningSuccess), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PlanRequest { + #[prost(message, optional, tag="1")] + pub provisioning: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PlanResponse { + /// a detailed, implementation specific, plan of changes this deployment would do + #[prost(string, tag="1")] + pub plan: ::prost::alloc::string::String, +} +// @@protoc_insertion_point(module) diff --git a/sqlc-gen-ftl/test/sqlc_gen_ftl_test.rs b/sqlc-gen-ftl/test/sqlc_gen_ftl_test.rs new file mode 100644 index 0000000000..28977762cf --- /dev/null +++ b/sqlc-gen-ftl/test/sqlc_gen_ftl_test.rs @@ -0,0 +1,279 @@ +use std::process::Command; +use std::path::PathBuf; +use std::fs; +use prost::Message; +use tempfile::TempDir; +use sha2::{Sha256, Digest}; + +#[path = "../src/plugin/mod.rs"] +mod plugin; +#[path = "../src/protos/mod.rs"] +mod protos; + +use protos::schemapb; + +fn build_wasm() -> Result<(), Box> { + let status = Command::new("just") + .arg("build-sqlc-gen-ftl") + .status()?; + + if !status.success() { + return Err("Failed to build WASM".into()); + } + Ok(()) +} + +fn expected_module_schema() -> schemapb::Module { + schemapb::Module { + name: "echo".to_string(), + builtin: false, + runtime: None, + comments: vec![], + pos: None, + decls: vec![ + schemapb::Decl { + value: Some(schemapb::decl::Value::Data(schemapb::Data { + name: "GetUserByIDQuery".to_string(), + export: false, + type_parameters: vec![], + fields: vec![ + schemapb::Field { + name: "id".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::Int(schemapb::Int { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + } + ], + pos: None, + comments: vec![], + metadata: vec![], + })), + }, + schemapb::Decl { + value: Some(schemapb::decl::Value::Data(schemapb::Data { + name: "GetUserByIDResult".to_string(), + export: false, + type_parameters: vec![], + fields: vec![ + schemapb::Field { + name: "id".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::Int(schemapb::Int { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + }, + schemapb::Field { + name: "name".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::String(schemapb::String { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + }, + schemapb::Field { + name: "email".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::String(schemapb::String { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + } + ], + pos: None, + comments: vec![], + metadata: vec![], + })), + }, + schemapb::Decl { + value: Some(schemapb::decl::Value::Verb(schemapb::Verb { + name: "GetUserByID".to_string(), + export: false, + runtime: None, + request: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::Ref(schemapb::Ref { + module: "echo".to_string(), + name: "GetUserByIDQuery".to_string(), + pos: None, + type_parameters: vec![], + })) + }), + response: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::Ref(schemapb::Ref { + module: "echo".to_string(), + name: "GetUserByIDResult".to_string(), + pos: None, + type_parameters: vec![], + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + })), + }, + schemapb::Decl { + value: Some(schemapb::decl::Value::Data(schemapb::Data { + name: "CreateUserQuery".to_string(), + export: false, + type_parameters: vec![], + fields: vec![ + schemapb::Field { + name: "name".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::String(schemapb::String { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + }, + schemapb::Field { + name: "email".to_string(), + r#type: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::String(schemapb::String { + pos: None, + })) + }), + pos: None, + comments: vec![], + metadata: vec![], + } + ], + pos: None, + comments: vec![], + metadata: vec![], + })), + }, + schemapb::Decl { + value: Some(schemapb::decl::Value::Verb(schemapb::Verb { + name: "CreateUser".to_string(), + export: false, + runtime: None, + request: Some(schemapb::Type { + value: Some(schemapb::r#type::Value::Ref(schemapb::Ref { + module: "echo".to_string(), + name: "CreateUserQuery".to_string(), + pos: None, + type_parameters: vec![], + })) + }), + response: None, + pos: None, + comments: vec![], + metadata: vec![], + })), + }, + ], + } +} + +fn get_sqlc_config(wasm_path: &PathBuf) -> Result> { + let wasm_contents = fs::read(wasm_path)?; + let mut hasher = Sha256::new(); + hasher.update(&wasm_contents); + let sha256_hash = hex::encode(hasher.finalize()); + + Ok(format!( + r#"version: '2' +plugins: +- name: ftl + wasm: + url: file://sqlc-gen-ftl.wasm + sha256: {} +sql: +- schema: schema.sql + queries: queries.sql + engine: postgresql + codegen: + - out: gen + plugin: ftl + options: + module: echo"#, + sha256_hash, + )) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + #[cfg_attr(not(feature = "ci"), ignore)] + fn test_wasm_generate() -> Result<(), Box> { + if let Err(e) = build_wasm() { + return Err(format!("Failed to build WASM: {}", e).into()); + } + + let temp_dir = TempDir::new()?; + let gen_dir = temp_dir.path().join("gen"); + std::fs::create_dir(&gen_dir)?; + + let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let test_dir = root_dir.join("test"); + let wasm_path = temp_dir.path().join("sqlc-gen-ftl.wasm"); + + std::fs::copy( + test_dir.join("testdata/schema.sql"), + temp_dir.path().join("schema.sql") + )?; + std::fs::copy( + test_dir.join("testdata/queries.sql"), + temp_dir.path().join("queries.sql") + )?; + std::fs::copy( + root_dir.join("target/wasm32-wasip1/release/sqlc-gen-ftl.wasm"), + &wasm_path + )?; + + let config_contents = get_sqlc_config(&wasm_path)?; + let config_path = temp_dir.path().join("sqlc.yaml"); + std::fs::write(&config_path, config_contents)?; + + let output = Command::new("sqlc") + .arg("generate") + .arg("--file") + .arg(&config_path) + .current_dir(temp_dir.path()) + .env("SQLC_VERSION", "dev") + .env("SQLCDEBUG", "true") + .output()?; + + if !output.status.success() { + return Err(format!( + "sqlc generate failed with status: {}\nstderr: {}", + output.status, + String::from_utf8_lossy(&output.stderr) + ).into()); + } + + let pb_contents = std::fs::read(gen_dir.join("queries.pb"))?; + let actual_module = schemapb::Module::decode(&*pb_contents)?; + let expected_module = expected_module_schema(); + + assert_eq!( + &actual_module, + &expected_module, + "Schema mismatch.\nActual: {:#?}\nExpected: {:#?}", + actual_module, + expected_module + ); + + Ok(()) + } +} + diff --git a/sqlc-gen-ftl/test/testdata/queries.sql b/sqlc-gen-ftl/test/testdata/queries.sql new file mode 100644 index 0000000000..78dc04a589 --- /dev/null +++ b/sqlc-gen-ftl/test/testdata/queries.sql @@ -0,0 +1,5 @@ +-- name: GetUserByID :one +SELECT id, name, email FROM users WHERE id = $1; + +-- name: CreateUser :exec +INSERT INTO users (name, email) VALUES ($1, $2); diff --git a/sqlc-gen-ftl/test/testdata/schema.sql b/sqlc-gen-ftl/test/testdata/schema.sql new file mode 100644 index 0000000000..7caa7bce2c --- /dev/null +++ b/sqlc-gen-ftl/test/testdata/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + email TEXT +);