diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..b0e7996b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +proto/gen linguist-generated=true +js/packages/proto/src/generated linguist-generated=true +cargo.lock linguist-generated=true diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md new file mode 100644 index 00000000..0809731d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md @@ -0,0 +1,16 @@ +--- +name: Feature Request Template +about: 'For feature requests. Please search for existing issues first. Also see CONTRIBUTING.' +--- + +### Please Describe The Problem To Be Solved + + + +### Optional: Suggest A Solution + + diff --git a/.github/ISSUE_TEMPLATE/RFC.md b/.github/ISSUE_TEMPLATE/RFC.md new file mode 100644 index 00000000..88770550 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/RFC.md @@ -0,0 +1,19 @@ +--- +name: ๐Ÿ“„ RFC +about: Write a proposal and request comments +title: '[RFC] ' +labels: rfc +assignees: '' +--- + +# Background + +# Proposal + +## Abandoned Ideas + +## Sections + +### Implementation + +### UX diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 526df976..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'cargo' - directory: '/' - schedule: - interval: 'weekly' - - package-ecosystem: 'github-actions' - directory: '/' - schedule: - interval: 'weekly' diff --git a/.github/dependabot.yml.disabled b/.github/dependabot.yml.disabled new file mode 100644 index 00000000..10ac2a7a --- /dev/null +++ b/.github/dependabot.yml.disabled @@ -0,0 +1,14 @@ +version: 2 +updates: [] +# - package-ecosystem: 'npm' +# directory: '/' +# schedule: +# interval: 'weekly' +# - package-ecosystem: 'cargo' +# directory: '/' +# schedule: +# interval: 'weekly' +# - package-ecosystem: 'github-actions' +# directory: '/' +# schedule: +# interval: 'weekly' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..42de1d25 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build and Release + +on: + push: +# branches: +# - refresh_replace + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] +# target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.78.0 + target: ${{ matrix.target }} + profile: minimal + override: true + + - name: Cache Cargo registry + uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo index + uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib + + - name: Install cross-compilation tools + if: matrix.target == 'aarch64-unknown-linux-gnu' + run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross + + - name: Build + run: | + cargo build --release --target=${{ matrix.target }} + strip target/${{ matrix.target }}/release/quary + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: quary-${{ matrix.target }}-${{ github.ref_name }} + path: target/${{ matrix.target }}/release/quary diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 3742b042..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: pr-checks -on: - merge_group: - pull_request: - branches: - - main -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true -env: - CARGO_INCREMENTAL: 0 -jobs: - github-actions-ratchet-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # ratchet:actions/setup-go@v4 - - name: Install ratchet - run: go install github.com/sethvargo/ratchet@latest - - name: Ratchet Check - run: make ratchet_check - rust-lint: - name: Rust Lint - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - name: Install stable toolchain - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@35cdeaf60df48fb1fb7eac25fea4ebde1f72fc46 # ratchet:Homebrew/actions/setup-homebrew@master - - name: Install buf - run: brew install bufbuild/buf/buf - - run: make proto - - name: Run cargo fmt - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - name: Run clippy - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 - with: - command: clippy - rust-test: - name: Rust Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@35cdeaf60df48fb1fb7eac25fea4ebde1f72fc46 # ratchet:Homebrew/actions/setup-homebrew@master - - name: Install buf - run: brew install bufbuild/buf/buf - - run: make proto - - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 - with: - command: test - rust-build: - name: Rust Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - name: Install stable toolchain - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt, clippy - - name: Install wasm target - run: rustup target add wasm32-unknown-unknown - - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 - - uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # ratchet:taiki-e/cache-cargo-install-action@v1 - with: - tool: wasm-bindgen-cli - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@35cdeaf60df48fb1fb7eac25fea4ebde1f72fc46 # ratchet:Homebrew/actions/setup-homebrew@master - - name: Install buf - run: brew install bufbuild/buf/buf - - run: make proto - - name: Check CI scripts - run: make rust_build - sqlfluff-template: - name: Lint template with SQLFluff - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - name: Install SQLFluff - run: pip install sqlfluff - - name: Lint template - run: make sql_lint_template - prettier-yaml-lint: - name: Prettier YAML Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v4 - - run: make prettier_lint diff --git a/.github/workflows/pr.yml.disabled b/.github/workflows/pr.yml.disabled new file mode 100644 index 00000000..3ccd4fb0 --- /dev/null +++ b/.github/workflows/pr.yml.disabled @@ -0,0 +1,155 @@ +name: pr-checks +on: + merge_group: + pull_request: + branches: + - main +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + CARGO_INCREMENTAL: 0 +jobs: + github-actions-ratchet-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # ratchet:actions/setup-go@v4 + - name: Install ratchet + run: go install github.com/sethvargo/ratchet@latest + - name: Ratchet Check + run: make ratchet_check + commitlint-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + with: + fetch-depth: '0' + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v2 + id: pnpm-install + with: + version: 9 + run_install: false + - name: Install dependencies + run: pnpm install --filter "@quary/root" --frozen-lockfile + - name: Validate all commits from PR + run: pnpx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose + node-check: + runs-on: ubicloud-standard-16 + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + with: + submodules: 'true' + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + override: true + profile: minimal + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # ratchet:taiki-e/cache-cargo-install-action@v1 + with: + tool: wasm-bindgen-cli + - name: Build rust wasm + run: make rust_build_wasm + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v2 + with: + version: 9 + - name: Install dependencies + run: pnpm install -r --frozen-lockfile + - name: Run CI tests + run: pnpm run ci + bash-scripts-check: + runs-on: ubuntu-latest + env: + PLAYWRIGHT_SKIP_DOWNLOAD_BROWSER: true + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + # Comes from https://github.com/ludeeus/action-shellcheck/blob/master/action.yaml + - name: Download shellcheck + run: sudo apt-get install -y shellcheck + - name: Check shells + run: make bash_lint + rust-test: + name: Rust Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 + with: + command: test + rust-build: + name: Rust Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Install stable toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt, clippy + - name: Install wasm target + run: rustup target add wasm32-unknown-unknown + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # ratchet:taiki-e/cache-cargo-install-action@v1 + with: + tool: wasm-bindgen-cli + - name: Check CI scripts + run: make rust_build + rust-build-windows: + name: Rust Build Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Install stable toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - name: Check CI scripts + run: cargo build + sqlfluff-template: + name: Lint template with SQLFluff + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Install SQLFluff + run: pip install sqlfluff + - name: Lint template + run: make sql_lint_template + check-versions-match: + name: Check versions match + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + - name: Install jq + run: sudo apt-get install jq + - run: make check_versions_match + prettier-yaml-lint: + name: Prettier YAML Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v2 + name: Install pnpm + with: + version: 9 + run_install: false + - run: pnpm install --filter "@quary/root" --frozen-lockfile + - run: make prettier_lint diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml.disabled similarity index 60% rename from .github/workflows/release-cli.yml rename to .github/workflows/release-cli.yml.disabled index bde7eee6..7149c533 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml.disabled @@ -3,13 +3,14 @@ on: release: types: [published] env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true CARGO_INCREMENTAL: 0 jobs: check-versions-match: name: Check versions match runs-on: ubuntu-latest steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 - name: Install jq run: sudo apt-get install jq - name: Check release version matches code @@ -17,7 +18,7 @@ jobs: RELEASE_VERSION=${{ github.event.release.tag_name }} STRIPPED_VERSION=${RELEASE_VERSION#v} make check_versions_match GITHUB_RELEASE_VERSION=$STRIPPED_VERSION - upload-cli-release-linux: + upload_cli_release_linux: strategy: fail-fast: false matrix: @@ -31,10 +32,11 @@ jobs: # name: quary-windows-x86_64-gnu.zip # runs-on: ubuntu-latest runs-on: ${{ matrix.platform.runs-on }} + continue-on-error: true needs: - check-versions-match steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 - name: Set up Rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 @@ -42,9 +44,6 @@ jobs: toolchain: stable profile: minimal if: ${{ !matrix.platform.cross }} - - name: Install buf - run: BIN="/usr/local/bin" && VERSION="1.31.0" && curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && chmod +x "${BIN}/buf" - - run: make proto - name: Install cross run: cargo install cross - name: Build binary (*nix) @@ -60,22 +59,13 @@ jobs: shell: bash run: | cd target/${{ matrix.platform.target }}/release - zip -j quary-${{ env.VERSION }}-${{ matrix.platform.name }} ${{ matrix.platform.bin }} - mv quary-${{ env.VERSION }}-${{ matrix.platform.name }} ../../../ + zip -j ${{ matrix.platform.name }} ${{ matrix.platform.bin }} + mv ${{ matrix.platform.name }} ../../../ - name: Upload Release Asset - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # ratchet:softprops/action-gh-release@v2.0.5 with: files: 'quary-*' - - name: Upload Release Asset (quary open source repository) - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 - with: - files: 'quary-*' - token: ${{ secrets.GITHUB_TOKEN }} - repository: quarylabs/quary - tag_name: ${{ env.VERSION }} - draft: false - prerelease: false - upload-cli-release-linux-aarch: + upload_cli_release_linux_aarch: strategy: fail-fast: false matrix: @@ -85,14 +75,12 @@ jobs: name: quary-linux-aarch64-gnu.zip runs-on: ubicloud-standard-2-arm runs-on: ${{ matrix.platform.runs-on }} + continue-on-error: true needs: - check-versions-match steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 - - name: Install buf - run: BIN="/usr/local/bin" && VERSION="1.31.0" && curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && chmod +x "${BIN}/buf" - - run: make proto - name: Set up Rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 with: @@ -114,21 +102,12 @@ jobs: shell: bash run: | cd target/${{ matrix.platform.target }}/release - zip -j quary-${{ env.VERSION }}-${{ matrix.platform.name }} ${{ matrix.platform.bin }} - mv quary-${{ env.VERSION }}-${{ matrix.platform.name }} ../../../ + zip -j ${{ matrix.platform.name }} ${{ matrix.platform.bin }} + mv ${{ matrix.platform.name }} ../../../ - name: Upload Release Asset - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 - with: - files: 'quary-*' - - name: Upload Release Asset (quary open source repository) - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # ratchet:softprops/action-gh-release@v2.0.5 with: files: 'quary-*' - token: ${{ secrets.GITHUB_TOKEN }} - repository: quarylabs/quary - tag_name: ${{ env.VERSION }} - draft: false - prerelease: false upload_cli_release_mac: name: Release CLI strategy: @@ -142,10 +121,11 @@ jobs: bin: quary name: quary-macos-aarch64-gnu.zip runs-on: macos-latest + continue-on-error: true needs: - check-versions-match steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 - name: Set up Rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 @@ -154,9 +134,6 @@ jobs: profile: minimal if: ${{ !matrix.platform.cross }} - run: rustup target add x86_64-apple-darwin - - name: Install buf - run: BIN="/usr/local/bin" && VERSION="1.31.0" && curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && chmod +x "${BIN}/buf" - - run: make proto - name: Install cross run: cargo install cross - name: Install aarch rust target @@ -194,8 +171,8 @@ jobs: - name: Package as archive run: | cd target/${{ matrix.platform.target }}/release - zip -j quary-${{ env.VERSION }}-${{ matrix.platform.name }} ${{ matrix.platform.bin }} - mv quary-${{ env.VERSION }}-${{ matrix.platform.name }} ../../../ + zip -j ${{ matrix.platform.name }} ${{ matrix.platform.bin }} + mv ${{ matrix.platform.name }} ../../../ - name: Notarize app bundle timeout-minutes: 30 # Extract the secrets we defined earlier as environment variables @@ -216,7 +193,7 @@ jobs: # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if # you're curious echo "Notarize app" - xcrun notarytool submit "quary-${{ env.VERSION }}-${{ matrix.platform.name }}" --keychain-profile "notarytool-profile" --wait + xcrun notarytool submit "${{ matrix.platform.name }}" --keychain-profile "notarytool-profile" --wait # Finally, we need to "attach the staple" to our executable, which will allow our app to be # validated by macOS even when an internet connection is not available. # Cannot yet staple binary "Although tickets are created for standalone binaries, itโ€™s not currently possible to staple tickets to them." @@ -224,15 +201,103 @@ jobs: # echo "Attach staple" # xcrun stapler staple -v notarization.zip - name: Upload Release Asset - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # ratchet:softprops/action-gh-release@v2.0.5 with: files: 'quary-*' - - name: Upload Release Asset (quary open source repository) - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 + upload_cli_release_windows: + runs-on: windows-latest + continue-on-error: true + needs: + - check-versions-match + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Install stable toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - run: cargo build --release + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $env:GITHUB_ENV + - name: Package as archive + run: | + cd target/release + Compress-Archive -Path quary.exe -DestinationPath "quary-windows-x86_64-gnu.zip" + Move-Item -Path "quary-windows-x86_64-gnu.zip" -Destination "../../" + - name: Upload Release Asset + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # ratchet:softprops/action-gh-release@v2.0.5 with: files: 'quary-*' - token: ${{ secrets.GITHUB_TOKEN }} - repository: quarylabs/quary - tag_name: ${{ env.VERSION }} - draft: false - prerelease: false + calculate-hash: + runs-on: ubuntu-latest + needs: + - upload_cli_release_linux + - upload_cli_release_linux_aarch + - upload_cli_release_mac + - upload_cli_release_windows + steps: + - name: Checkout Repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - name: Fetch Release Assets + id: fetch-assets + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # ratchet:actions/github-script@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + script: | + const fs = require('fs'); + + const response = await github.rest.repos.listReleaseAssets({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: context.payload.release.id + }); + + const assets = response.data.map(asset => ({ url: asset.url, name: asset.name })); + fs.writeFileSync('assets.json', JSON.stringify(assets)); + + - name: Download and Calculate SHA-256 Hashes + run: | + mkdir -p downloads + echo "File Name | SHA-256 Hash" >> SHA256SUMS.txt + echo "--------- | ------------" >> SHA256SUMS.txt + jq -c '.[]' assets.json | while read -r asset; do + url=$(echo $asset | jq -r '.url') + name=$(echo $asset | jq -r '.name') + curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" -o "downloads/$name" "$url" + echo "Calculating SHA-256 for $name" + hash=$(sha256sum "downloads/$name" | awk '{print $1}') + echo "$name | $hash" >> SHA256SUMS.txt + done + - name: Update Release Description with SHA-256 Hashes + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # ratchet:actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const sha256sums = fs.readFileSync('SHA256SUMS.txt', 'utf8'); + const { owner, repo } = context.repo; + const release = context.payload.release; + const newBody = release.body + '\n\n### SHA-256 Hashes\n' + sha256sums; + await github.rest.repos.updateRelease({ + owner, + repo, + release_id: release.id, + body: newBody + }); + + update-homebrew-formula: + name: Update Homebrew Formula + runs-on: ubuntu-latest + needs: + - upload_cli_release_linux + - upload_cli_release_linux_aarch + - upload_cli_release_mac + - upload_cli_release_windows + permissions: write-all + env: + HOMEBREW_ACCESS_TOKEN: ${{ secrets.HOMEBREW_ACCESS_TOKEN }} + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v4 + - run: ./.hacking/scripts/update_homebrew_pr.sh $HOMEBREW_ACCESS_TOKEN diff --git a/.github/workflows/release-vsix.yml.disabled b/.github/workflows/release-vsix.yml.disabled new file mode 100644 index 00000000..84171af7 --- /dev/null +++ b/.github/workflows/release-vsix.yml.disabled @@ -0,0 +1,56 @@ +name: Release VSIX Workflow +on: + release: + types: [published] +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + CARGO_INCREMENTAL: 0 +jobs: + check-versions-match: + name: Check versions match + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + with: + submodules: 'true' + - name: Install jq + run: sudo apt-get install jq + - run: make check_versions_match + upload-vsix-release: + name: Upload VSIX Release + runs-on: ubuntu-latest + needs: + - check-versions-match + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + with: + submodules: 'true' + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + override: true + profile: minimal + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 + - uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # ratchet:taiki-e/cache-cargo-install-action@v1 + with: + tool: wasm-bindgen-cli + - name: Build rust wasm + run: make rust_build_wasm + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v2 + with: + version: 9 + - name: Install dependencies + run: pnpm install -r --frozen-lockfile + - name: Build extension + run: pnpm run build_extension + - name: Upload Release Asset + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # ratchet:softprops/action-gh-release@v2.0.5 + with: + files: ./js/packages/quary-extension/quary-*.vsix + - run: pnpx vsce publish --packagePath $(find ./js/packages/quary-extension/quary-*.vsix) + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9c900335..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Post-Release SHA-256 Hash Calculation -on: - release: - types: [published] -jobs: - calculate-hash: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v4 - - name: Fetch Release Assets - id: fetch-assets - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # ratchet:actions/github-script@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - script: | - const fs = require('fs'); - - const response = await github.rest.repos.listReleaseAssets({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: context.payload.release.id - }); - - const assets = response.data.map(asset => ({ url: asset.url, name: asset.name })); - fs.writeFileSync('assets.json', JSON.stringify(assets)); - - - name: Download and Calculate SHA-256 Hashes - run: | - mkdir -p downloads - echo "File Name | SHA-256 Hash" >> SHA256SUMS.txt - echo "--------- | ------------" >> SHA256SUMS.txt - jq -c '.[]' assets.json | while read -r asset; do - url=$(echo $asset | jq -r '.url') - name=$(echo $asset | jq -r '.name') - curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" -o "downloads/$name" "$url" - echo "Calculating SHA-256 for $name" - hash=$(sha256sum "downloads/$name" | awk '{print $1}') - echo "$name | $hash" >> SHA256SUMS.txt - done - - name: Update Release Description with SHA-256 Hashes - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # ratchet:actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const fs = require('fs'); - const sha256sums = fs.readFileSync('SHA256SUMS.txt', 'utf8'); - const { owner, repo } = context.repo; - const release = context.payload.release; - const newBody = release.body + '\n\n### SHA-256 Hashes\n' + sha256sums; - await github.rest.repos.updateRelease({ - owner, - repo, - release_id: release.id, - body: newBody - }); diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml new file mode 100644 index 00000000..bec6c152 --- /dev/null +++ b/.github/workflows/rust-lint.yml @@ -0,0 +1,34 @@ +name: rust-lint +on: + pull_request: + paths: + - 'rust/**' + merge_group: + push: + branches: + - main +jobs: + rust-lint: + name: Rust Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # ratchet:actions/checkout@v3 + with: + submodules: 'true' + - name: Install stable toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: wasm32-unknown-unknown + override: true + components: rustfmt, clippy + - name: Run cargo fmt + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + - name: Run clippy + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 + with: + command: clippy diff --git a/.gitignore b/.gitignore index 6909be02..d3c25329 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# Generated proto +# IntelliJ -proto/gen +.idea # Terrraform @@ -62,6 +62,8 @@ jspm_packages/ .idea/dictionaries .idea/vcs.xml .idea/jsLibraryMappings.xml +.idea/* +.gitignore # Sensitive or high-churn files: .idea/dataSources.ids @@ -107,3 +109,5 @@ fabric.properties machine_learning/wikisql .vercel +models/* +quary.yaml \ No newline at end of file diff --git a/.hacking/docker/Dockerfile b/.hacking/docker/Dockerfile new file mode 100644 index 00000000..bd5a8fcd --- /dev/null +++ b/.hacking/docker/Dockerfile @@ -0,0 +1,27 @@ +FROM --platform=$BUILDPLATFORM golang:alpine AS build +ARG TARGETPLATFORM +ARG BUILDPLATFORM + +# Set the working directory +WORKDIR /app + +RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log + +# Download binary +RUN wget https://github.com/quarylabs/quary/releases/download/0.0.102/quary-0.0.102-quary-linux-aarch64-gnu.zip + +# Install unzip +RUN apk add --no-cache unzip +# Unzip binary +RUN unzip /app/quary-0.0.102-quary-linux-aarch64-gnu.zip + +RUN ls -la + +FROM --platform=$BUILDPLATFORM alpine + +WORKDIR /app + +COPY --from=build /app/quary /app/quary + +# Set the binary as the entrypoint +ENTRYPOINT ["quary"] diff --git a/.hacking/project_scripts/materialize_all_to_tables.py b/.hacking/project_scripts/materialize_all_to_tables.py new file mode 100644 index 00000000..71792fa9 --- /dev/null +++ b/.hacking/project_scripts/materialize_all_to_tables.py @@ -0,0 +1,66 @@ + +# This script materializes all models in a Quary project to TABLE +# Usage: python .hacking/project_scripts/materialize_all_to_tables.py <target_directory i.e. ../models> + +import os +import yaml +def find_closest_schema_file(dir_path, base_path): + """Search for the closest schema file in the parent directories.""" + current_path = dir_path + while current_path != base_path: + for file in os.listdir(current_path): + if file.endswith("_models.yaml") or file == "schema.yaml": + return os.path.join(current_path, file) + parent_path = os.path.dirname(current_path) + if parent_path == current_path: # Reached the root directory + break + current_path = parent_path + return None + +def create_or_update_schema_file(base_path, dir_path, model_name): + schema_file = find_closest_schema_file(dir_path, base_path) + if not schema_file: + schema_file = os.path.join(dir_path, "schema.yaml") + with open(schema_file, 'w') as f: + yaml.dump({'models': []}, f) + + with open(schema_file, 'r') as f: + data = yaml.safe_load(f) or {'models': []} + + model_found = False + for model in data['models']: + if model['name'] == model_name: + model['materialization'] = 'table' + model_found = True + break + if not model_found: + data['models'].append({'name': model_name, 'materialization': 'table'}) + + with open(schema_file, 'w') as f: + yaml.safe_dump(data, f, sort_keys=False) + +def process_directory(base_path, dir_path): + if "sources" in dir_path: + return + + sql_files = [f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f)) and f.endswith('.sql')] + for sql_file in sql_files: + model_name = os.path.splitext(sql_file)[0] + create_or_update_schema_file(base_path, dir_path, model_name) + + for item in os.listdir(dir_path): + full_path = os.path.join(dir_path, item) + if os.path.isdir(full_path) and not item == "sources": + process_directory(base_path, full_path) + +def main(target_dir): + base_path = os.path.abspath(target_dir) + process_directory(base_path, base_path) + +if __name__ == "__main__": + import sys + if len(sys.argv) != 2: + print("Usage: python script.py <target_directory>") + sys.exit(1) + + main(sys.argv[1]) \ No newline at end of file diff --git a/.hacking/scripts/bash_lint.sh b/.hacking/scripts/bash_lint.sh new file mode 100755 index 00000000..ac048133 --- /dev/null +++ b/.hacking/scripts/bash_lint.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euxo pipefail + +for f in ./.hacking/scripts/*.sh +do + shellcheck "$f" +done diff --git a/.hacking/scripts/check_readmes_match.sh b/.hacking/scripts/check_readmes_match.sh new file mode 100755 index 00000000..3f7bad4e --- /dev/null +++ b/.hacking/scripts/check_readmes_match.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +file1="js/packages/quary-extension/README.md" +file2="README.md" + +if diff -q --suppress-common-lines "$file1" "$file2" > /dev/null; then + echo "File $file1 is a subsection of $file2" + exit 0 +else + echo "Error: File $file1 is not a subsection of $file2" >&2 + exit 1 +fi \ No newline at end of file diff --git a/.hacking/scripts/check_versions_match.sh b/.hacking/scripts/check_versions_match.sh new file mode 100755 index 00000000..e91347e8 --- /dev/null +++ b/.hacking/scripts/check_versions_match.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Extract version from Cargo.toml +cargo_version_cli=$(grep "^version" rust/cli/Cargo.toml | awk -F '"' '{print $2}') +cargo_version_core=$(grep "^version" rust/core/Cargo.toml | awk -F '"' '{print $2}') +cargo_version_databases=$(grep "^version" rust/quary-databases/Cargo.toml | awk -F '"' '{print $2}') +cargo_version_dbt=$(grep "^version" rust/dbt-converter/Cargo.toml | awk -F '"' '{print $2}') +cargo_version_sqlinference=$(grep "^version" rust/sqlinference/Cargo.toml | awk -F '"' '{print $2}') +cargo_version_wasm=$(grep "^version" rust/wasm-binding/Cargo.toml | awk -F '"' '{print $2}') + +# Extract version from package.json +ts_version=$(jq -r '.version' js/packages/quary-extension/package.json) + +# Optional GitHub release version passed as an argument +github_release_version=$1 + +# Function to compare two versions +compare_versions() { + if [ "$1" != "$2" ]; then + echo "Versions do not match: $1 vs $2" + exit 1 + fi +} + +compare_versions "$cargo_version_cli" "$ts_version" +compare_versions "$cargo_version_core" "$ts_version" +compare_versions "$cargo_version_databases" "$ts_version" +compare_versions "$cargo_version_dbt" "$ts_version" +compare_versions "$cargo_version_sqlinference" "$ts_version" +compare_versions "$cargo_version_wasm" "$ts_version" + +# If GitHub release version is provided, compare it as well +if [ -n "$github_release_version" ]; then + compare_versions "$ts_version" "$github_release_version" +fi + +echo "Versions match." diff --git a/.hacking/scripts/fmt_sql_models_in_init.sh b/.hacking/scripts/fmt_sql_models_in_init.sh new file mode 100755 index 00000000..416c0d88 --- /dev/null +++ b/.hacking/scripts/fmt_sql_models_in_init.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euxo pipefail + +for f in ./go/lib/init/models/**/*.sql +do + pnpx sql-formatter --fix "$f" +done diff --git a/.hacking/scripts/update_homebrew_pr.sh b/.hacking/scripts/update_homebrew_pr.sh new file mode 100755 index 00000000..d089fcab --- /dev/null +++ b/.hacking/scripts/update_homebrew_pr.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -e + +#VERSION="v0.4.1" +#HOMEBREW_ACCESS_TOKEN="${ACCESS_TOKEN}" +HOMEBREW_ACCESS_TOKEN=$1 + +# Extract version from Cargo.toml +VERSION="v$(grep "^version" rust/cli/Cargo.toml | awk -F '"' '{print $2}')" +echo "VERSION: $VERSION" + +REPOSITORY="quarylabs/quary" +HOMEBREW_URL="quarylabs/homebrew-quary" +API_URL="https://api.github.com/repos/$REPOSITORY/releases/tags/$VERSION" +STRIPPED_VERSION=${VERSION#v} + +git clone \ + --depth=1 \ + --branch=main \ + https://quarylabs:"${HOMEBREW_ACCESS_TOKEN}"@github.com/$HOMEBREW_URL \ + +cd homebrew-quary +git config --global user.name "GitHub Actions" +git config --global user.email "actions@github.com" + +git checkout -b update-quary-to-"${STRIPPED_VERSION}" + +# Get the urls and shas for the assets in the release + +response=$(curl -s -H "Authorization: Bearer $HOMEBREW_ACCESS_TOKEN" -H "Accept: application/vnd.github.v3+json" "$API_URL") +echo "$response" + +assets=$(echo "$response" | jq -c '.assets[] | {name: .name, url: .url, sha256: .browser_download_url}') +echo "$assets" + +while read -r asset; do + echo "Asset: $asset" + name=$(echo "$asset" | jq -r '.name') + url=$(echo "$asset" | jq -r '.sha256') + + if [[ "$name" == *"macos-aarch64"* ]]; then + DARWIN_AARCH64_URL=$url + DARWIN_AARCH64_SHA256=$(curl -sL "$url" | shasum -a 256 | cut -d ' ' -f 1) + elif [[ "$name" == *"macos-x86_64"* ]]; then + DARWIN_X86_64_URL=$url + DARWIN_X86_64_SHA256=$(curl -sL "$url" | shasum -a 256 | cut -d ' ' -f 1) + elif [[ "$name" == *"linux-x86_64"* ]]; then + LINUX_X86_64_URL=$url + LINUX_X86_64_SHA256=$(curl -sL "$url" | shasum -a 256 | cut -d ' ' -f 1) + fi +done <<< "$assets" + +# Print the assigned variables +echo "DARWIN_AARCH64_URL: $DARWIN_AARCH64_URL" +echo "DARWIN_AARCH64_SHA256: $DARWIN_AARCH64_SHA256" +echo "DARWIN_X86_64_URL: $DARWIN_X86_64_URL" +echo "DARWIN_X86_64_SHA256: $DARWIN_X86_64_SHA256" +echo "LINUX_X86_64_URL: $LINUX_X86_64_URL" +echo "LINUX_X86_64_SHA256: $LINUX_X86_64_SHA256" + + +sed -i.bak "/if OS.mac? && Hardware::CPU.intel?/,/elsif/ s|url \".*\"|url \"${DARWIN_X86_64_URL}\"|" quary.rb +sed -i.bak "/if OS.mac? && Hardware::CPU.intel?/,/elsif/ s/sha256 \".*\"/sha256 \"${DARWIN_X86_64_SHA256}\"/" quary.rb + +sed -i.bak "/elsif OS.mac? && Hardware::CPU.arm?/,/elsif/ s|url \".*\"|url \"${DARWIN_AARCH64_URL}\"|" quary.rb +sed -i.bak "/elsif OS.mac? && Hardware::CPU.arm?/,/elsif/ s/sha256 \".*\"/sha256 \"${DARWIN_AARCH64_SHA256}\"/" quary.rb + +sed -i.bak "/elsif OS.linux? && Hardware::CPU.intel?/,/end/ s|url \".*\"|url \"${LINUX_X86_64_URL}\"|" quary.rb +sed -i.bak "/elsif OS.linux? && Hardware::CPU.intel?/,/end/ s/sha256 \".*\"/sha256 \"${LINUX_X86_64_SHA256}\"/" quary.rb + +rm quary.rb.bak + +git add quary.rb +git commit -m "Update Quary to version ${STRIPPED_VERSION}" +git push origin update-quary-to-"${STRIPPED_VERSION}" + +# TODO - Create a PR using the GitHub CLI +# Store the PAT in a file that can be accessed by the +# GitHub CLI. +#echo "${{ secrets.HOMEBREW_ACCESS_TOKEN }}" > token.txt +#gh auth login --with-token < token.txt +#gh pr create --title "Update Sqruff to version ${STRIPPED_VERSION}" --body "Automated PR to update Sqruff to version ${STRIPPED_VERSION}" --base main diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 00000000..c8e3429b --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,2 @@ +MD013: false +MD025: false diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..9bcccb94 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.13.1 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..910f26c3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,17 @@ +js/packages/*/build +js/packages/*/coverage +js/packages/*/.next +js/packages/*/dist +js/packages/*/storybook-static +js/packages/quary-extension/.vscode-test-web +js/packages/quary-extension/**/**/wasm_exec.js +js/packages/quary-extension/src/rust_wasm/ +js/packages/quary-extension/src/web/wasm_exec.js +js/packages/quary-extension/src/ui/ +js/packages/proto/src +proto/gen +docs +sample_project +pnpm-lock.yaml +.pnpm-store +target \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 41c7847a..404f4a9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,7 +207,7 @@ dependencies = [ "arrow-schema", "arrow-select", "atoi", - "base64 0.22.0", + "base64 0.22.1", "chrono", "comfy-table", "half", @@ -456,9 +456,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -519,7 +519,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aed08d3adb6ebe0eff737115056652670ae290f177759aac19c30456135f94c" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "bollard-stubs", "bytes", "futures-core", @@ -634,9 +634,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cast" @@ -751,6 +751,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -915,13 +925,13 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "dbt-converter" -version = "0.0.116" +version = "0.2.0" dependencies = [ "quary_proto", "regex", @@ -1032,6 +1042,12 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + [[package]] name = "duckdb" version = "0.10.2" @@ -1201,6 +1217,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + [[package]] name = "funty" version = "2.0.0" @@ -1415,9 +1437,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -1965,9 +1987,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libduckdb-sys" @@ -2073,15 +2095,42 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", "windows-sys 0.48.0", ] +[[package]] +name = "mockall" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 2.0.50", +] + [[package]] name = "multimap" version = "0.8.3" @@ -2388,8 +2437,6 @@ dependencies = [ [[package]] name = "pbjson-types" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" dependencies = [ "bytes", "chrono", @@ -2398,6 +2445,7 @@ dependencies = [ "prost", "prost-build", "serde", + "serde_json", ] [[package]] @@ -2415,7 +2463,7 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "serde", ] @@ -2436,9 +2484,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap 2.2.3", @@ -2601,9 +2649,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", "prost-derive", @@ -2611,13 +2659,13 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -2628,14 +2676,13 @@ dependencies = [ "regex", "syn 2.0.50", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", "itertools 0.12.1", @@ -2646,9 +2693,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ "prost", ] @@ -2675,11 +2722,11 @@ dependencies = [ [[package]] name = "quary" -version = "0.0.116" +version = "0.2.0" dependencies = [ "assert_cmd", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "chrono", "clap", "dbt-converter", @@ -2692,12 +2739,14 @@ dependencies = [ "quary_proto", "serde_yaml", "tempfile", + "testcontainers", + "testcontainers-modules", "tokio", ] [[package]] name = "quary-core" -version = "0.0.116" +version = "0.2.0" dependencies = [ "async-trait", "chrono", @@ -2705,6 +2754,7 @@ dependencies = [ "data-encoding", "futures", "js-sys", + "mockall", "once_cell", "pbjson-types", "petgraph", @@ -2721,7 +2771,7 @@ dependencies = [ [[package]] name = "quary-databases" -version = "0.0.116" +version = "0.2.0" dependencies = [ "assert_cmd", "async-trait", @@ -2742,6 +2792,26 @@ dependencies = [ "yup-oauth2", ] +[[package]] +name = "quary-wasm-bindgen" +version = "0.2.0" +dependencies = [ + "async-trait", + "chrono", + "console_error_panic_hook", + "futures", + "js-sys", + "prost", + "quary-core", + "quary_proto", + "send_wrapper", + "sqlinference", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test", +] + [[package]] name = "quary_proto" version = "0.1.0" @@ -2925,7 +2995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "async-compression", - "base64 0.22.0", + "base64 0.22.1", "bytes", "futures-core", "futures-util", @@ -3090,9 +3160,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" +checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -3101,9 +3171,9 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" +checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" dependencies = [ "proc-macro2", "quote", @@ -3114,9 +3184,9 @@ dependencies = [ [[package]] name = "rust-embed-utils" -version = "8.3.0" +version = "8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" +checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" dependencies = [ "sha2", "walkdir", @@ -3232,7 +3302,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] @@ -3293,6 +3363,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -3344,20 +3420,26 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -3366,9 +3448,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -3404,7 +3486,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", @@ -3545,7 +3627,7 @@ checksum = "1434bfb85dc18773aa4ff2f9824117f55304c4e2d1406aaea06cbcf29beb2047" dependencies = [ "arrow", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bytes", "futures", "glob", @@ -3627,7 +3709,7 @@ dependencies = [ [[package]] name = "sqlinference" -version = "0.0.116" +version = "0.2.0" dependencies = [ "sqlparser", ] @@ -4047,9 +4129,9 @@ dependencies = [ [[package]] name = "testcontainers-modules" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8da66a6ebd55684c8e3c58c7374dc2b2d0d1884ac688987e7ffb2d02103a3ee" +checksum = "0faa6265d33090f7238c48d41ec195fab63a66c7997bf58bdce5ce8ab94ea682" dependencies = [ "testcontainers", ] @@ -4133,9 +4215,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -4152,9 +4234,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", @@ -4379,9 +4461,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] @@ -4432,6 +4514,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -4459,9 +4547,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -4498,6 +4586,31 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-bindgen-test" +version = "0.3.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + [[package]] name = "wasm-streams" version = "0.4.0" @@ -4528,9 +4641,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -4552,23 +4665,15 @@ dependencies = [ ] [[package]] -name = "which" -version = "4.4.2" +name = "whoami" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "redox_syscall 0.4.1", + "wasite", ] -[[package]] -name = "whoami" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 00a3eac1..5cbb3b6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,13 @@ [workspace] -members = ["rust/core", "rust/cli", "proto/gen/rust", "rust/sqlinference", "rust/dbt-converter"] +members = [ + "proto/gen/rust", + "rust/cli", + "rust/core", + "rust/dbt-converter", + "rust/pbjson-types", + "rust/sqlinference", + "rust/wasm-binding" +] resolver = "2" [workspace.dependencies] diff --git a/Makefile b/Makefile index 67a95155..80f3c3e7 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +.PHONY: bump_version_patch +bump_version_patch: ## Bumps the extension version as a patch + npm version patch --prefix js/packages/quary-extension + .PHONY: proto proto: proto_fmt ## Generate the proto code rm -rf proto/gen @@ -7,6 +11,10 @@ proto: proto_fmt ## Generate the proto code ln proto/.hacking/Cargo.toml proto/gen/rust/Cargo.toml mv proto/gen/rust/src/quary.service.v1.rs proto/gen/rust/src/lib.rs cargo fmt + rm -rf js/packages/proto/src/generated/ + mkdir -p js/packages/proto/src/generated/ + cp -a ./proto/gen/ts/. js/packages/proto/src/generated/ + pnpm run fmt .PHONY: proto_breaking proto_breaking: ## Check for breaking changes in the proto code @@ -28,7 +36,12 @@ sql_lint_template: ## Lint the sql code .PHONY: rust_build rust_build: ## Builds the rust code - cargo build + cargo build --locked + +.PHONY: rust_build_wasm +rust_build_wasm: ## Builds the rust wasm code + cargo build --locked --target=wasm32-unknown-unknown --release --package="quary-wasm-bindgen" + wasm-bindgen --out-dir=js/packages/quary-extension/src/rust_wasm --target=web --omit-default-module-path "target/wasm32-unknown-unknown/release/quary_wasm_bindgen.wasm" .PHONY: rust_fmt rust_fmt: ## Formats the rust code @@ -43,10 +56,24 @@ rust_test: ## Runs the rust tests cargo nextest run .PHONY: rust_ci -rust_ci: rust_test rust_fmt rust_lint rust_build ## Runs the rust ci commands +rust_ci: rust_test rust_fmt rust_lint rust_build check_versions_match ## Runs the rust ci commands + +.PHONY: markdown_lint +markdown_lint: ## Lints markdown + docker run -v $(shell pwd):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "docs/**/*.md" + +.PHONY: markdown_lint_fix +markdown_lint_fix: ## Fixes markdown lint errors + docker run -v $(shell pwd):/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "docs/**/*.md" --fix .PHONY: ci ci: ratchet_check proto rust_ci proto_breaking sql_lint_template ## Runs everything + pnpm install + pnpm run ci + +.PHONY: act +act: ## Runs act which runs the ci locally + act -P ubuntu-latest=catthehacker/ubuntu:act-latest .PHONY: ratchet_pin ratchet_pin: ## Pins all the Github workflow versions @@ -64,15 +91,17 @@ ratchet_check: ## Checks all the Github workflow versions bash_lint: ## Lints all the bash scripts ./.hacking/scripts/bash_lint.sh +.PHONY: check_versions_match +check_versions_match: ## Checks the version of the extension matches the CLI + ./.hacking/scripts/check_versions_match.sh $(GITHUB_RELEASE_VERSION) + .PHONY: prettier_fmt prettier_fmt: ## Formats all the yaml files - npx prettier --write **/*.yaml - npx prettier --write **/*.yml + pnpm prettier --write **/*.{yaml,yml} .PHONY: prettier_lint prettier_lint: ## Lints all the yaml files - npx prettier --check **/*.yaml - npx prettier --check **/*.yml + pnpm prettier --check **/*.{yaml,yml} .PHONY: help help: ## Display this help screen diff --git a/README.md b/README.md index ae24ec8b..b90124d5 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,80 @@ <p align="center"> <a href="https://quary.dev"> - <picture> - <img src="https://storage.googleapis.com/public_hosted_materials/quary.svg" height="128"> - </picture> - <h1 align="center">quary</h1> + <img align="center" src="https://storage.googleapis.com/public_hosted_materials/quary.svg" height="128"> + <h1 align="center">Quary</h1> + <h3 align="center">Business Intelligence for Engineers ๐Ÿ…€</h3> </a> </p> + +<div class="title-block" style="text-align: center;" align="center"> + +[![Made by Quary](https://img.shields.io/badge/MADE%20BY%20Quary-000000.svg?style=for-the-badge&logo=Quary&labelColor=000)](https://www.quary.dev/) +[![Slack Community](https://img.shields.io/badge/slack-@quarycommunity-000000.svg?style=for-the-badge&logo=slack&labelColor=000)](https://join.slack.com/t/quarylabs/shared_invite/zt-2dlbfnztw-dMLXJVL38NcbhqRuM5gUcw) +[![YC](https://img.shields.io/badge/Y%20Combinator-W24-orange?style=for-the-badge&logo=Quary&labelColor=000)](https://www.ycombinator.com/companies/quary) +[![GitHub Repo stars](https://img.shields.io/github/stars/quarylabs/quary?style=for-the-badge&logo=Quary&labelColor=000)](https://github.com/quarylabs/quary) + +</div> + +<h2>With Quary, engineers can:</h2> + +- ๐Ÿ”Œ Connect to their Database +- ๐Ÿ“– Write SQL queries to transform, organize, and document tables in a database +- ๐Ÿ“Š Create charts, dashboards and reports (in development) +- ๐Ÿงช Test, collaborate & refactor iteratively through version control +- ๐Ÿš€ Deploy the organised, documented model back up to the database + +View the [documentation](https://www.quary.dev/docs). + +## ๐Ÿ—ƒ๏ธ Supported Databases + <p align="center"> - <a aria-label="Quary logo" href="https://www.quary.dev/"> - <img src="https://img.shields.io/badge/MADE%20BY%20Quary-000000.svg?style=for-the-badge&logo=Quary&labelColor=000"> - </a> - <a aria-label="Slack community" target="_blank" href="https://join.slack.com/t/quarylabs/shared_invite/zt-2dlbfnztw-dMLXJVL38NcbhqRuM5gUcw"> - <img src="https://img.shields.io/badge/slack-@quarycommunity-000000.svg?style=for-the-badge&logo=slack&labelColor=000" alt="Quary Community"> - </a> - <a aria-label="License" href="https://github.com/quarylabs/quary/blob/main/LICENSE"> - <img alt="" src="https://img.shields.io/npm/l/next.svg?style=for-the-badge&labelColor=000000"> - </a> + <img src="https://img.shields.io/badge/Amazon%20Redshift-527FFF?style=for-the-badge&logo=Amazon%20Redshift&logoColor=white" alt="Amazon Redshift"> + <img src="https://img.shields.io/badge/Google%20BigQuery-4285F4?style=for-the-badge&logo=Google%20Cloud&logoColor=white" alt="Google BigQuery"> + <img src="https://img.shields.io/badge/PostgreSQL-336791?style=for-the-badge&logo=postgresql&logoColor=white" alt="PostgreSQL"> + <img src="https://img.shields.io/badge/Snowflake-29B5E8?style=for-the-badge&logo=snowflake&logoColor=white" alt="Snowflake"> + <img src="https://img.shields.io/badge/Supabase-3ECF8E?style=for-the-badge&logo=supabase&logoColor=white" alt="Supabase"> + <img src="https://img.shields.io/badge/DuckDB-FFF?style=for-the-badge&logo=duckdb&logoColor=black" alt="DuckDB"> + <img src="https://img.shields.io/badge/SQLite-003B57?style=for-the-badge&logo=sqlite&logoColor=white" alt="SQLite"> </p> -![quary_core_image](./assets/diagram.jpg) +![quary_core_image](./assets/readme_demo.gif) -## What is Quary? +## ๐Ÿ—๏ธ Asset Types in Quary -Quary enables teams to design, document, test and deploy data transformations to your SQL data stores. Quary is a SQL -engine and CLI tool that lets you manage your data transformation projects with ease. +Define and manage the following asset types as code: -Teams use Quary to transform their raw data tables into actionable and trustworthy insights. Teams do so by layering -well documented and tested transformations into useful insights ready for consumption. A Quary project is formed of a -collection of these SQL `SELECT` statements, that build on top of each other. +- **Sources:** Define the external data sources that feed into Quary, such as database tables, flat files, or APIs (with DuckDB). +- **Models:** Transform raw data from sources into analysis-ready datasets using SQL, this lets engineers split complex queries into atomic components. +- **Charts:** Create visual representations of your data using SQL. +- **๐Ÿšง Dashboards (WIP):** Combine multiple charts into a single view, allowing engineers to monitor and analyze data in one place. +- **๐Ÿšง Reports (WIP):** Create detailed reports to share insights and findings with your team or stakeholders. -- Visit [our website](https://www.quary.dev) to learn more -- Visit [our documentation](https://www.quary.dev/docs) to learn how to use Quary - -## Getting Started +## ๐Ÿš€ Getting Started ### Installation -The following Quary repository contains the core Quary library as well as the Quary CLI tool. The Quary CLI tool can be -installed as following +Quary is a VSCode Extension (Interface) & Rust-based CLI (Core) + +#### Extension + +The VSCode extension can be installed [here](https://marketplace.visualstudio.com/items?itemName=Quary.quary-extension). Note that it depends on the CLI being installed. -#### Homebrew installation for macOS +#### CLI -Quary can be installed using Homebrew on macOS using the following command: +#### Homebrew installation ``` brew install quarylabs/quary/quary ``` +#### Linux/Mac through curl + +Quary can be installed using curl on Linux/Mac using the following command: + +```shell +curl -fsSL https://raw.githubusercontent.com/quarylabs/quary/main/install.sh | bash +``` + #### Other installations Other builds are available in the [releases page](https://github.com/quarylabs/quary/releases/latest) to download. @@ -58,18 +86,22 @@ Once installed, a sample project can be created and run as follows: ```shell mkdir example # create an empty project folder cd example -quary init # initialize demo project with sample seeds & models inside current directory +quary init # initialize DuckDB demo project with sample data quary compile # validate the project structure and model references without database -quary test -s # run defined tests against target database quary build # build and execute the model views/seeds against target database +quary test -s # run defined tests against target database ``` -Note that you will most likely want to use -our [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=Quary.quary-extension) to -visualise the project. +<h2>๐Ÿ…€ Community</h2> + +[Join our Slack channel](https://join.slack.com/t/quarylabs/shared_invite/zt-2dlbfnztw-dMLXJVL38NcbhqRuM5gUcw), for help, ideas, and discussions. ## Support If you run into any problems using Quary, please let us know. We want Quary to be easy-to-use, so if you are getting confused, it is our fault, not yours. [Create an issue](https://github.com/quarylabs/quary/issues) and we'll be happy to help you out. + +### Check out our other projects + +[SQRUFF](https://github.com/quarylabs/sqruff), a compact, high-speed SQL linter, engineered with Rust efficiency. diff --git a/assets/diagram.jpg b/assets/diagram.jpg deleted file mode 100644 index dd9c30c3..00000000 Binary files a/assets/diagram.jpg and /dev/null differ diff --git a/assets/diagram.png b/assets/diagram.png new file mode 100644 index 00000000..2d3ae299 Binary files /dev/null and b/assets/diagram.png differ diff --git a/assets/readme_demo.gif b/assets/readme_demo.gif new file mode 100644 index 00000000..d78d930c Binary files /dev/null and b/assets/readme_demo.gif differ diff --git a/buf.gen.yaml b/buf.gen.yaml index 6102a483..c5406fed 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,5 +1,10 @@ version: v1 plugins: + - plugin: buf.build/community/stephenh-ts-proto + out: proto/gen/ts + opt: + - oneof=unions + - globalThisPolyfill=true - out: proto/gen/rust/src plugin: buf.build/community/neoeinstein-prost opt: @@ -11,3 +16,13 @@ plugins: out: proto/gen/rust/src - out: proto/gen/json_schema plugin: buf.build/community/chrusty-jsonschema + opt: + - disallow_additional_properties + - plugin: buf.build/bufbuild/connect-es + out: proto/gen/es + opt: + - target=ts + - plugin: buf.build/bufbuild/es + out: proto/gen/es + opt: + - target=ts diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..4fedde6d --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] } diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..53e86bfa --- /dev/null +++ b/install.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +set -e -o pipefail + +readonly GREEN="$(tput setaf 2 2>/dev/null || echo '')" +readonly CYAN="$(tput setaf 6 2>/dev/null || echo '')" +readonly NO_COLOR="$(tput sgr0 2>/dev/null || echo '')" + +if ! command -v unzip >/dev/null 2>&1; then + echo "Error: unzip is required to install quary." + exit 1 +fi + +# Define the release information +RELEASE_URL="https://api.github.com/repos/quarylabs/quary/releases/latest" + +# Determine the operating system +OS=$(uname -s) +if [ "$OS" = "Darwin" ]; then + # Determine the CPU architecture + ARCH=$(uname -m) + if [ "$ARCH" = "arm64" ]; then + ASSET_NAME="-macos-aarch64-gnu.zip" + else + ASSET_NAME="-macos-x86_64-gnu.zip" + fi +elif [ "$OS" = "Linux" ]; then + # Determine the CPU architecture + ARCH=$(uname -m) + if [ "$ARCH" = "aarch64" ]; then + ASSET_NAME="-linux-aarch64-gnu.zip" + elif [ "$ARCH" = "x86_64" ]; then + ASSET_NAME="-linux-x86_64-gnu.zip" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi +else + echo "Unsupported operating system: $OS" + exit 1 +fi + +# Retrieve the download URL for the desired asset +DOWNLOAD_URL=$(curl -sSL $RELEASE_URL | grep -o "browser_download_url.*$ASSET_NAME" | cut -d ' ' -f 2) + +ASSET_NAME=$(basename "$DOWNLOAD_URL") +echo "Downloading $ASSET_NAME..." + +# Define the installation directory +INSTALL_DIR="/usr/local/bin" + +DOWNLOAD_URL=$(echo "$DOWNLOAD_URL" | tr -d '\"') + +# Download the asset +curl -SL "$DOWNLOAD_URL" -o /tmp/"$ASSET_NAME" + +# Extract the asset +unzip /tmp/"$ASSET_NAME" -d /tmp + +# Set the correct permissions for the binary +chmod +x /tmp/quary + +# Move the extracted binary to the installation directory +# use sudo if available +if command -v sudo >/dev/null 2>&1; then + sudo mv /tmp/quary $INSTALL_DIR +else + mv /tmp/quary $INSTALL_DIR +fi + +# Clean up temporary files +rm /tmp/"$ASSET_NAME" + +cat << EOF +${CYAN} + + __ _ _ __ ___ _ _ + / \( )( )( ) ( ,) ( \/ ) +( () ))()( /__\ ) \ \ / + \___\\__/(_)(_)(_)\_)(__/ + +${NO_COLOR} +BI for engineers! + +${GREEN}https://github.com/quarylabs/quary${NO_COLOR} + +Please file an issue if you encounter any problems! + +=============================================================================== + +Installation completed! ๐ŸŽ‰ +EOF diff --git a/js/packages/eslint-config-shared/index.js b/js/packages/eslint-config-shared/index.js new file mode 100644 index 00000000..20051974 --- /dev/null +++ b/js/packages/eslint-config-shared/index.js @@ -0,0 +1,100 @@ +module.exports = { + plugins: ['@typescript-eslint', 'import', 'react'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react/recommended', + 'plugin:storybook/recommended', + 'plugin:storybook/csf-strict', + 'plugin:jsx-a11y/recommended', + 'plugin:import/typescript', + ], + rules: { + 'arrow-body-style': ['error', 'as-needed'], + semi: ['error', 'never'], + 'no-new-wrappers': 'error', + camelcase: 'off', + 'new-cap': 'off', + 'no-restricted-globals': 'error', + 'prefer-const': 'error', + 'no-var': 'error', + 'object-shorthand': 'error', + 'quote-props': ['error', 'as-needed'], + 'no-else-return': 'error', + 'no-duplicate-imports': 'error', + 'jsx-quotes': ['warn', 'prefer-double'], + 'no-console': 'error', + 'no-use-before-define': 'off', + 'no-throw-literal': 'error', + curly: 'error', + eqeqeq: 'error', + + 'import/no-self-import': 'error', + 'import/no-mutable-exports': 'error', + 'import/no-relative-packages': 'error', + 'import/no-cycle': 'error', + 'import/no-unresolved': 'off', + 'import/order': [ + 'warn', + { + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + ], + }, + ], + 'import/extensions': 'off', + 'import/prefer-default-export': 'off', + 'import/no-extraneous-dependencies': [ + 'warn', + { + // Due to importing '@testing-library/jest-dom/extend-expect' and stuff in tests + devDependencies: [ + '.storybook/***', + '**/*.stories.{tsx,ts}', + '**/*.test.{tsx,ts}, uicomponents', + ], + }, + ], + + '@typescript-eslint/member-delimiter-style': [ + 'warn', + { + multiline: { + delimiter: 'none', + requireLast: false, + }, + singleline: { + delimiter: 'semi', + requireLast: false, + }, + }, + ], + '@typescript-eslint/no-unused-vars': 'warn', + + 'react/function-component-definition': ['off'], + 'react/no-unstable-nested-components': ['off'], + 'react/no-unused-prop-types': ['error'], + 'react/no-danger': ['warn'], + 'react/prop-types': 'off', + 'react/react-in-jsx-scope': 'off', + 'react/require-default-props': 'off', + 'react/jsx-curly-brace-presence': [ + 'error', + { + props: 'never', + children: 'never', + }, + ], + 'react/jsx-filename-extension': [ + 'warn', + { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + }, + ], + }, +} diff --git a/js/packages/eslint-config-shared/package.json b/js/packages/eslint-config-shared/package.json new file mode 100644 index 00000000..961dcfeb --- /dev/null +++ b/js/packages/eslint-config-shared/package.json @@ -0,0 +1,22 @@ +{ + "name": "@quary/eslint-config-shared", + "version": "1.0.0", + "private": true, + "main": "index.js", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^7.12.0", + "@typescript-eslint/parser": "^7.12.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-react": "^7.34.2", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-storybook": "^0.8.0" + }, + "peerDependencies": { + "eslint": ">= 7.0.0", + "typescript": "^4.9.5" + }, + "dependencies": { + "eslint": "^8.57.0", + "typescript": "^5.4.5" + } +} diff --git a/js/packages/proto/.gitignore b/js/packages/proto/.gitignore new file mode 100644 index 00000000..53c37a16 --- /dev/null +++ b/js/packages/proto/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/js/packages/proto/package.json b/js/packages/proto/package.json new file mode 100644 index 00000000..09e64abd --- /dev/null +++ b/js/packages/proto/package.json @@ -0,0 +1,16 @@ +{ + "name": "@quary/proto", + "version": "0.1.0", + "private": true, + "main": "dist/index.js", + "scripts": { + "build": "rm -rf dist && tsc" + }, + "dependencies": { + "@types/node": "^20.14.0", + "protobufjs": "^7.3.0" + }, + "devDependencies": { + "typescript": "^5.4.5" + } +} diff --git a/js/packages/proto/src/generated/google/protobuf/empty.ts b/js/packages/proto/src/generated/google/protobuf/empty.ts new file mode 100644 index 00000000..f65b3db0 --- /dev/null +++ b/js/packages/proto/src/generated/google/protobuf/empty.ts @@ -0,0 +1,78 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: google/protobuf/empty.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + */ +export interface Empty { +} + +function createBaseEmpty(): Empty { + return {}; +} + +export const Empty = { + encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Empty { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): Empty { + return {}; + }, + + toJSON(_: Empty): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<Empty>, I>>(base?: I): Empty { + return Empty.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Empty>, I>>(_: I): Empty { + const message = createBaseEmpty(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; diff --git a/js/packages/proto/src/generated/google/protobuf/struct.ts b/js/packages/proto/src/generated/google/protobuf/struct.ts new file mode 100644 index 00000000..386b0a26 --- /dev/null +++ b/js/packages/proto/src/generated/google/protobuf/struct.ts @@ -0,0 +1,587 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: google/protobuf/struct.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `NullValue` is a singleton enumeration to represent the null value for the + * `Value` type union. + * + * The JSON representation for `NullValue` is JSON `null`. + */ +export enum NullValue { + /** NULL_VALUE - Null value. */ + NULL_VALUE = 0, + UNRECOGNIZED = -1, +} + +export function nullValueFromJSON(object: any): NullValue { + switch (object) { + case 0: + case "NULL_VALUE": + return NullValue.NULL_VALUE; + case -1: + case "UNRECOGNIZED": + default: + return NullValue.UNRECOGNIZED; + } +} + +export function nullValueToJSON(object: NullValue): string { + switch (object) { + case NullValue.NULL_VALUE: + return "NULL_VALUE"; + case NullValue.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * `Struct` represents a structured data value, consisting of fields + * which map to dynamically typed values. In some languages, `Struct` + * might be supported by a native representation. For example, in + * scripting languages like JS a struct is represented as an + * object. The details of that representation are described together + * with the proto support for the language. + * + * The JSON representation for `Struct` is JSON object. + */ +export interface Struct { + /** Unordered map of dynamically typed values. */ + fields: { [key: string]: any | undefined }; +} + +export interface Struct_FieldsEntry { + key: string; + value: any | undefined; +} + +/** + * `Value` represents a dynamically typed value which can be either + * null, a number, a string, a boolean, a recursive struct value, or a + * list of values. A producer of value is expected to set one of these + * variants. Absence of any variant indicates an error. + * + * The JSON representation for `Value` is JSON value. + */ +export interface Value { + kind?: + | { $case: "nullValue"; nullValue: NullValue } + | { $case: "numberValue"; numberValue: number } + | { $case: "stringValue"; stringValue: string } + | { $case: "boolValue"; boolValue: boolean } + | { $case: "structValue"; structValue: { [key: string]: any } | undefined } + | { $case: "listValue"; listValue: Array<any> | undefined } + | undefined; +} + +/** + * `ListValue` is a wrapper around a repeated field of values. + * + * The JSON representation for `ListValue` is JSON array. + */ +export interface ListValue { + /** Repeated field of dynamically typed values. */ + values: any[]; +} + +function createBaseStruct(): Struct { + return { fields: {} }; +} + +export const Struct = { + encode(message: Struct, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.fields).forEach(([key, value]) => { + if (value !== undefined) { + Struct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Struct { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStruct(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.fields[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Struct { + return { + fields: isObject(object.fields) + ? Object.entries(object.fields).reduce<{ [key: string]: any | undefined }>((acc, [key, value]) => { + acc[key] = value as any | undefined; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Struct): unknown { + const obj: any = {}; + if (message.fields) { + const entries = Object.entries(message.fields); + if (entries.length > 0) { + obj.fields = {}; + entries.forEach(([k, v]) => { + obj.fields[k] = v; + }); + } + } + return obj; + }, + + create<I extends Exact<DeepPartial<Struct>, I>>(base?: I): Struct { + return Struct.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Struct>, I>>(object: I): Struct { + const message = createBaseStruct(); + message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, + {}, + ); + return message; + }, + + wrap(object: { [key: string]: any } | undefined): Struct { + const struct = createBaseStruct(); + + if (object !== undefined) { + for (const key of Object.keys(object)) { + struct.fields[key] = object[key]; + } + } + return struct; + }, + + unwrap(message: Struct): { [key: string]: any } { + const object: { [key: string]: any } = {}; + if (message.fields) { + for (const key of Object.keys(message.fields)) { + object[key] = message.fields[key]; + } + } + return object; + }, +}; + +function createBaseStruct_FieldsEntry(): Struct_FieldsEntry { + return { key: "", value: undefined }; +} + +export const Struct_FieldsEntry = { + encode(message: Struct_FieldsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStruct_FieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Struct_FieldsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object?.value) ? object.value : undefined, + }; + }, + + toJSON(message: Struct_FieldsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Struct_FieldsEntry>, I>>(base?: I): Struct_FieldsEntry { + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Struct_FieldsEntry>, I>>(object: I): Struct_FieldsEntry { + const message = createBaseStruct_FieldsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseValue(): Value { + return { kind: undefined }; +} + +export const Value = { + encode(message: Value, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.kind?.$case) { + case "nullValue": + writer.uint32(8).int32(message.kind.nullValue); + break; + case "numberValue": + writer.uint32(17).double(message.kind.numberValue); + break; + case "stringValue": + writer.uint32(26).string(message.kind.stringValue); + break; + case "boolValue": + writer.uint32(32).bool(message.kind.boolValue); + break; + case "structValue": + Struct.encode(Struct.wrap(message.kind.structValue), writer.uint32(42).fork()).ldelim(); + break; + case "listValue": + ListValue.encode(ListValue.wrap(message.kind.listValue), writer.uint32(50).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Value { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.kind = { $case: "nullValue", nullValue: reader.int32() as any }; + continue; + case 2: + if (tag !== 17) { + break; + } + + message.kind = { $case: "numberValue", numberValue: reader.double() }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.kind = { $case: "stringValue", stringValue: reader.string() }; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.kind = { $case: "boolValue", boolValue: reader.bool() }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.kind = { $case: "structValue", structValue: Struct.unwrap(Struct.decode(reader, reader.uint32())) }; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.kind = { $case: "listValue", listValue: ListValue.unwrap(ListValue.decode(reader, reader.uint32())) }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Value { + return { + kind: isSet(object.nullValue) + ? { $case: "nullValue", nullValue: nullValueFromJSON(object.nullValue) } + : isSet(object.numberValue) + ? { $case: "numberValue", numberValue: gt.Number(object.numberValue) } + : isSet(object.stringValue) + ? { $case: "stringValue", stringValue: gt.String(object.stringValue) } + : isSet(object.boolValue) + ? { $case: "boolValue", boolValue: gt.Boolean(object.boolValue) } + : isSet(object.structValue) + ? { $case: "structValue", structValue: object.structValue } + : isSet(object.listValue) + ? { $case: "listValue", listValue: [...object.listValue] } + : undefined, + }; + }, + + toJSON(message: Value): unknown { + const obj: any = {}; + if (message.kind?.$case === "nullValue") { + obj.nullValue = nullValueToJSON(message.kind.nullValue); + } + if (message.kind?.$case === "numberValue") { + obj.numberValue = message.kind.numberValue; + } + if (message.kind?.$case === "stringValue") { + obj.stringValue = message.kind.stringValue; + } + if (message.kind?.$case === "boolValue") { + obj.boolValue = message.kind.boolValue; + } + if (message.kind?.$case === "structValue") { + obj.structValue = message.kind.structValue; + } + if (message.kind?.$case === "listValue") { + obj.listValue = message.kind.listValue; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Value>, I>>(base?: I): Value { + return Value.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Value>, I>>(object: I): Value { + const message = createBaseValue(); + if (object.kind?.$case === "nullValue" && object.kind?.nullValue !== undefined && object.kind?.nullValue !== null) { + message.kind = { $case: "nullValue", nullValue: object.kind.nullValue }; + } + if ( + object.kind?.$case === "numberValue" && + object.kind?.numberValue !== undefined && + object.kind?.numberValue !== null + ) { + message.kind = { $case: "numberValue", numberValue: object.kind.numberValue }; + } + if ( + object.kind?.$case === "stringValue" && + object.kind?.stringValue !== undefined && + object.kind?.stringValue !== null + ) { + message.kind = { $case: "stringValue", stringValue: object.kind.stringValue }; + } + if (object.kind?.$case === "boolValue" && object.kind?.boolValue !== undefined && object.kind?.boolValue !== null) { + message.kind = { $case: "boolValue", boolValue: object.kind.boolValue }; + } + if ( + object.kind?.$case === "structValue" && + object.kind?.structValue !== undefined && + object.kind?.structValue !== null + ) { + message.kind = { $case: "structValue", structValue: object.kind.structValue }; + } + if (object.kind?.$case === "listValue" && object.kind?.listValue !== undefined && object.kind?.listValue !== null) { + message.kind = { $case: "listValue", listValue: object.kind.listValue }; + } + return message; + }, + + wrap(value: any): Value { + const result = createBaseValue(); + if (value === null) { + result.kind = { $case: "nullValue", nullValue: NullValue.NULL_VALUE }; + } else if (typeof value === "boolean") { + result.kind = { $case: "boolValue", boolValue: value }; + } else if (typeof value === "number") { + result.kind = { $case: "numberValue", numberValue: value }; + } else if (typeof value === "string") { + result.kind = { $case: "stringValue", stringValue: value }; + } else if (gt.Array.isArray(value)) { + result.kind = { $case: "listValue", listValue: value }; + } else if (typeof value === "object") { + result.kind = { $case: "structValue", structValue: value }; + } else if (typeof value !== "undefined") { + throw new gt.Error("Unsupported any value type: " + typeof value); + } + return result; + }, + + unwrap(message: Value): string | number | boolean | Object | null | Array<any> | undefined { + if (message.kind?.$case === "nullValue") { + return null; + } else if (message.kind?.$case === "numberValue") { + return message.kind?.numberValue; + } else if (message.kind?.$case === "stringValue") { + return message.kind?.stringValue; + } else if (message.kind?.$case === "boolValue") { + return message.kind?.boolValue; + } else if (message.kind?.$case === "structValue") { + return message.kind?.structValue; + } else if (message.kind?.$case === "listValue") { + return message.kind?.listValue; + } else { + return undefined; + } + }, +}; + +function createBaseListValue(): ListValue { + return { values: [] }; +} + +export const ListValue = { + encode(message: ListValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.values) { + Value.encode(Value.wrap(v!), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListValue { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(Value.unwrap(Value.decode(reader, reader.uint32()))); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListValue { + return { values: gt.Array.isArray(object?.values) ? [...object.values] : [] }; + }, + + toJSON(message: ListValue): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListValue>, I>>(base?: I): ListValue { + return ListValue.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListValue>, I>>(object: I): ListValue { + const message = createBaseListValue(); + message.values = object.values?.map((e) => e) || []; + return message; + }, + + wrap(array: Array<any> | undefined): ListValue { + const result = createBaseListValue(); + result.values = array ?? []; + return result; + }, + + unwrap(message: ListValue): Array<any> { + if (message?.hasOwnProperty("values") && gt.Array.isArray(message.values)) { + return message.values; + } else { + return message as any; + } + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/chart.ts b/js/packages/proto/src/generated/quary/service/v1/chart.ts new file mode 100644 index 00000000..2c7a7ff6 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/chart.ts @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/chart.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Struct } from "../../../google/protobuf/struct"; + +export const protobufPackage = "quary.service.v1"; + +/** Parsed chart that is in a project */ +export interface Chart { + /** Name of the chart */ + name: string; + /** Description of the cart */ + description?: + | string + | undefined; + /** + * Tags are used to group different parts of the project together. For example, you could tag all models that are + * related to a specific department with the same tag. + */ + tags: string[]; + /** Path of the file */ + path: string; + source?: + | { $case: "rawSql"; rawSql: string } + | { $case: "preTemplatedSql"; preTemplatedSql: string } + | { $case: "reference"; reference: Chart_AssetReference } + | undefined; + /** Configuration for the chart that is passed to perspective */ + config: + | { [key: string]: any } + | undefined; + /** References that this chart has, these can be models/sources/seeds/snapshots */ + references: string[]; +} + +export interface Chart_AssetReference { + name: string; +} + +function createBaseChart(): Chart { + return { name: "", description: undefined, tags: [], path: "", source: undefined, config: undefined, references: [] }; +} + +export const Chart = { + encode(message: Chart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tags) { + writer.uint32(26).string(v!); + } + if (message.path !== "") { + writer.uint32(74).string(message.path); + } + switch (message.source?.$case) { + case "rawSql": + writer.uint32(34).string(message.source.rawSql); + break; + case "preTemplatedSql": + writer.uint32(42).string(message.source.preTemplatedSql); + break; + case "reference": + Chart_AssetReference.encode(message.source.reference, writer.uint32(50).fork()).ldelim(); + break; + } + if (message.config !== undefined) { + Struct.encode(Struct.wrap(message.config), writer.uint32(58).fork()).ldelim(); + } + for (const v of message.references) { + writer.uint32(66).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Chart { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tags.push(reader.string()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.source = { $case: "rawSql", rawSql: reader.string() }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.source = { $case: "preTemplatedSql", preTemplatedSql: reader.string() }; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.source = { $case: "reference", reference: Chart_AssetReference.decode(reader, reader.uint32()) }; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.config = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.references.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Chart { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + path: isSet(object.path) ? gt.String(object.path) : "", + source: isSet(object.rawSql) + ? { $case: "rawSql", rawSql: gt.String(object.rawSql) } + : isSet(object.preTemplatedSql) + ? { $case: "preTemplatedSql", preTemplatedSql: gt.String(object.preTemplatedSql) } + : isSet(object.reference) + ? { $case: "reference", reference: Chart_AssetReference.fromJSON(object.reference) } + : undefined, + config: isObject(object.config) ? object.config : undefined, + references: gt.Array.isArray(object?.references) ? object.references.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: Chart): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.source?.$case === "rawSql") { + obj.rawSql = message.source.rawSql; + } + if (message.source?.$case === "preTemplatedSql") { + obj.preTemplatedSql = message.source.preTemplatedSql; + } + if (message.source?.$case === "reference") { + obj.reference = Chart_AssetReference.toJSON(message.source.reference); + } + if (message.config !== undefined) { + obj.config = message.config; + } + if (message.references?.length) { + obj.references = message.references; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Chart>, I>>(base?: I): Chart { + return Chart.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Chart>, I>>(object: I): Chart { + const message = createBaseChart(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tags = object.tags?.map((e) => e) || []; + message.path = object.path ?? ""; + if (object.source?.$case === "rawSql" && object.source?.rawSql !== undefined && object.source?.rawSql !== null) { + message.source = { $case: "rawSql", rawSql: object.source.rawSql }; + } + if ( + object.source?.$case === "preTemplatedSql" && + object.source?.preTemplatedSql !== undefined && + object.source?.preTemplatedSql !== null + ) { + message.source = { $case: "preTemplatedSql", preTemplatedSql: object.source.preTemplatedSql }; + } + if ( + object.source?.$case === "reference" && + object.source?.reference !== undefined && + object.source?.reference !== null + ) { + message.source = { $case: "reference", reference: Chart_AssetReference.fromPartial(object.source.reference) }; + } + message.config = object.config ?? undefined; + message.references = object.references?.map((e) => e) || []; + return message; + }, +}; + +function createBaseChart_AssetReference(): Chart_AssetReference { + return { name: "" }; +} + +export const Chart_AssetReference = { + encode(message: Chart_AssetReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Chart_AssetReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChart_AssetReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Chart_AssetReference { + return { name: isSet(object.name) ? gt.String(object.name) : "" }; + }, + + toJSON(message: Chart_AssetReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Chart_AssetReference>, I>>(base?: I): Chart_AssetReference { + return Chart_AssetReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Chart_AssetReference>, I>>(object: I): Chart_AssetReference { + const message = createBaseChart_AssetReference(); + message.name = object.name ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/chart_file.ts b/js/packages/proto/src/generated/quary/service/v1/chart_file.ts new file mode 100644 index 00000000..cb10f0a9 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/chart_file.ts @@ -0,0 +1,286 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/chart_file.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Struct } from "../../../google/protobuf/struct"; + +export const protobufPackage = "quary.service.v1"; + +/** CharFile is a representation of a chart that can be used to generate a visualization. */ +export interface ChartFile { + /** description of the cart */ + description?: + | string + | undefined; + /** + * Tags are used to group different parts of the project together. For example, you could tag all models that are + * related to a specific department with the same tag. + */ + tags: string[]; + source?: + | { $case: "rawSql"; rawSql: string } + | { $case: "preTemplatedSql"; preTemplatedSql: string } + | { $case: "reference"; reference: ChartFile_AssetReference } + | undefined; + /** Configuration for the chart that is passed to perspective */ + config: { [key: string]: any } | undefined; +} + +export interface ChartFile_AssetReference { + name: string; +} + +function createBaseChartFile(): ChartFile { + return { description: undefined, tags: [], source: undefined, config: undefined }; +} + +export const ChartFile = { + encode(message: ChartFile, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tags) { + writer.uint32(26).string(v!); + } + switch (message.source?.$case) { + case "rawSql": + writer.uint32(34).string(message.source.rawSql); + break; + case "preTemplatedSql": + writer.uint32(42).string(message.source.preTemplatedSql); + break; + case "reference": + ChartFile_AssetReference.encode(message.source.reference, writer.uint32(50).fork()).ldelim(); + break; + } + if (message.config !== undefined) { + Struct.encode(Struct.wrap(message.config), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ChartFile { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChartFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tags.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.source = { $case: "rawSql", rawSql: reader.string() }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.source = { $case: "preTemplatedSql", preTemplatedSql: reader.string() }; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.source = { $case: "reference", reference: ChartFile_AssetReference.decode(reader, reader.uint32()) }; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.config = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChartFile { + return { + description: isSet(object.description) ? gt.String(object.description) : undefined, + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + source: isSet(object.rawSql) + ? { $case: "rawSql", rawSql: gt.String(object.rawSql) } + : isSet(object.preTemplatedSql) + ? { $case: "preTemplatedSql", preTemplatedSql: gt.String(object.preTemplatedSql) } + : isSet(object.reference) + ? { $case: "reference", reference: ChartFile_AssetReference.fromJSON(object.reference) } + : undefined, + config: isObject(object.config) ? object.config : undefined, + }; + }, + + toJSON(message: ChartFile): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.source?.$case === "rawSql") { + obj.rawSql = message.source.rawSql; + } + if (message.source?.$case === "preTemplatedSql") { + obj.preTemplatedSql = message.source.preTemplatedSql; + } + if (message.source?.$case === "reference") { + obj.reference = ChartFile_AssetReference.toJSON(message.source.reference); + } + if (message.config !== undefined) { + obj.config = message.config; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ChartFile>, I>>(base?: I): ChartFile { + return ChartFile.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ChartFile>, I>>(object: I): ChartFile { + const message = createBaseChartFile(); + message.description = object.description ?? undefined; + message.tags = object.tags?.map((e) => e) || []; + if (object.source?.$case === "rawSql" && object.source?.rawSql !== undefined && object.source?.rawSql !== null) { + message.source = { $case: "rawSql", rawSql: object.source.rawSql }; + } + if ( + object.source?.$case === "preTemplatedSql" && + object.source?.preTemplatedSql !== undefined && + object.source?.preTemplatedSql !== null + ) { + message.source = { $case: "preTemplatedSql", preTemplatedSql: object.source.preTemplatedSql }; + } + if ( + object.source?.$case === "reference" && + object.source?.reference !== undefined && + object.source?.reference !== null + ) { + message.source = { $case: "reference", reference: ChartFile_AssetReference.fromPartial(object.source.reference) }; + } + message.config = object.config ?? undefined; + return message; + }, +}; + +function createBaseChartFile_AssetReference(): ChartFile_AssetReference { + return { name: "" }; +} + +export const ChartFile_AssetReference = { + encode(message: ChartFile_AssetReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ChartFile_AssetReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChartFile_AssetReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChartFile_AssetReference { + return { name: isSet(object.name) ? gt.String(object.name) : "" }; + }, + + toJSON(message: ChartFile_AssetReference): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ChartFile_AssetReference>, I>>(base?: I): ChartFile_AssetReference { + return ChartFile_AssetReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ChartFile_AssetReference>, I>>(object: I): ChartFile_AssetReference { + const message = createBaseChartFile_AssetReference(); + message.name = object.name ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/cli_rpc_calls.ts b/js/packages/proto/src/generated/quary/service/v1/cli_rpc_calls.ts new file mode 100644 index 00000000..2e7097ba --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/cli_rpc_calls.ts @@ -0,0 +1,789 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/cli_rpc_calls.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { ProjectFileSource } from "./project_file"; +import { QueryResult } from "./query_result"; +import { TableAddress } from "./table_address"; + +export const protobufPackage = "quary.service.v1"; + +export interface ListTablesRequest { +} + +export interface ListTablesResponse { + tables: TableAddress[]; +} + +export interface ListViewsRequest { +} + +export interface ListViewsResponse { + views: TableAddress[]; +} + +export interface ExecRequest { + query: string; +} + +export interface ExecResponse { +} + +export interface QueryRequest { + query: string; +} + +export interface QueryResponse { + result: QueryResult | undefined; +} + +export interface ListColumnsRequest { + tableName: string; +} + +export interface ListColumnsResponse { + columns: string[]; +} + +export interface ListSourcesRequest { +} + +export interface ListSourcesResponse { + sources: ProjectFileSource[]; +} + +function createBaseListTablesRequest(): ListTablesRequest { + return {}; +} + +export const ListTablesRequest = { + encode(_: ListTablesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListTablesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListTablesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListTablesRequest { + return {}; + }, + + toJSON(_: ListTablesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<ListTablesRequest>, I>>(base?: I): ListTablesRequest { + return ListTablesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListTablesRequest>, I>>(_: I): ListTablesRequest { + const message = createBaseListTablesRequest(); + return message; + }, +}; + +function createBaseListTablesResponse(): ListTablesResponse { + return { tables: [] }; +} + +export const ListTablesResponse = { + encode(message: ListTablesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.tables) { + TableAddress.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListTablesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListTablesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tables.push(TableAddress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListTablesResponse { + return { tables: gt.Array.isArray(object?.tables) ? object.tables.map((e: any) => TableAddress.fromJSON(e)) : [] }; + }, + + toJSON(message: ListTablesResponse): unknown { + const obj: any = {}; + if (message.tables?.length) { + obj.tables = message.tables.map((e) => TableAddress.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListTablesResponse>, I>>(base?: I): ListTablesResponse { + return ListTablesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListTablesResponse>, I>>(object: I): ListTablesResponse { + const message = createBaseListTablesResponse(); + message.tables = object.tables?.map((e) => TableAddress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListViewsRequest(): ListViewsRequest { + return {}; +} + +export const ListViewsRequest = { + encode(_: ListViewsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListViewsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListViewsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListViewsRequest { + return {}; + }, + + toJSON(_: ListViewsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<ListViewsRequest>, I>>(base?: I): ListViewsRequest { + return ListViewsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListViewsRequest>, I>>(_: I): ListViewsRequest { + const message = createBaseListViewsRequest(); + return message; + }, +}; + +function createBaseListViewsResponse(): ListViewsResponse { + return { views: [] }; +} + +export const ListViewsResponse = { + encode(message: ListViewsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.views) { + TableAddress.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListViewsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListViewsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.views.push(TableAddress.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListViewsResponse { + return { views: gt.Array.isArray(object?.views) ? object.views.map((e: any) => TableAddress.fromJSON(e)) : [] }; + }, + + toJSON(message: ListViewsResponse): unknown { + const obj: any = {}; + if (message.views?.length) { + obj.views = message.views.map((e) => TableAddress.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListViewsResponse>, I>>(base?: I): ListViewsResponse { + return ListViewsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListViewsResponse>, I>>(object: I): ListViewsResponse { + const message = createBaseListViewsResponse(); + message.views = object.views?.map((e) => TableAddress.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseExecRequest(): ExecRequest { + return { query: "" }; +} + +export const ExecRequest = { + encode(message: ExecRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.query !== "") { + writer.uint32(10).string(message.query); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExecRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecRequest { + return { query: isSet(object.query) ? gt.String(object.query) : "" }; + }, + + toJSON(message: ExecRequest): unknown { + const obj: any = {}; + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ExecRequest>, I>>(base?: I): ExecRequest { + return ExecRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ExecRequest>, I>>(object: I): ExecRequest { + const message = createBaseExecRequest(); + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseExecResponse(): ExecResponse { + return {}; +} + +export const ExecResponse = { + encode(_: ExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExecResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ExecResponse { + return {}; + }, + + toJSON(_: ExecResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<ExecResponse>, I>>(base?: I): ExecResponse { + return ExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ExecResponse>, I>>(_: I): ExecResponse { + const message = createBaseExecResponse(); + return message; + }, +}; + +function createBaseQueryRequest(): QueryRequest { + return { query: "" }; +} + +export const QueryRequest = { + encode(message: QueryRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.query !== "") { + writer.uint32(10).string(message.query); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.query = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRequest { + return { query: isSet(object.query) ? gt.String(object.query) : "" }; + }, + + toJSON(message: QueryRequest): unknown { + const obj: any = {}; + if (message.query !== "") { + obj.query = message.query; + } + return obj; + }, + + create<I extends Exact<DeepPartial<QueryRequest>, I>>(base?: I): QueryRequest { + return QueryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<QueryRequest>, I>>(object: I): QueryRequest { + const message = createBaseQueryRequest(); + message.query = object.query ?? ""; + return message; + }, +}; + +function createBaseQueryResponse(): QueryResponse { + return { result: undefined }; +} + +export const QueryResponse = { + encode(message: QueryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.result !== undefined) { + QueryResult.encode(message.result, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.result = QueryResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryResponse { + return { result: isSet(object.result) ? QueryResult.fromJSON(object.result) : undefined }; + }, + + toJSON(message: QueryResponse): unknown { + const obj: any = {}; + if (message.result !== undefined) { + obj.result = QueryResult.toJSON(message.result); + } + return obj; + }, + + create<I extends Exact<DeepPartial<QueryResponse>, I>>(base?: I): QueryResponse { + return QueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<QueryResponse>, I>>(object: I): QueryResponse { + const message = createBaseQueryResponse(); + message.result = (object.result !== undefined && object.result !== null) + ? QueryResult.fromPartial(object.result) + : undefined; + return message; + }, +}; + +function createBaseListColumnsRequest(): ListColumnsRequest { + return { tableName: "" }; +} + +export const ListColumnsRequest = { + encode(message: ListColumnsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tableName !== "") { + writer.uint32(10).string(message.tableName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListColumnsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListColumnsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tableName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListColumnsRequest { + return { tableName: isSet(object.tableName) ? gt.String(object.tableName) : "" }; + }, + + toJSON(message: ListColumnsRequest): unknown { + const obj: any = {}; + if (message.tableName !== "") { + obj.tableName = message.tableName; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListColumnsRequest>, I>>(base?: I): ListColumnsRequest { + return ListColumnsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListColumnsRequest>, I>>(object: I): ListColumnsRequest { + const message = createBaseListColumnsRequest(); + message.tableName = object.tableName ?? ""; + return message; + }, +}; + +function createBaseListColumnsResponse(): ListColumnsResponse { + return { columns: [] }; +} + +export const ListColumnsResponse = { + encode(message: ListColumnsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.columns) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListColumnsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListColumnsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.columns.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListColumnsResponse { + return { columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => gt.String(e)) : [] }; + }, + + toJSON(message: ListColumnsResponse): unknown { + const obj: any = {}; + if (message.columns?.length) { + obj.columns = message.columns; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListColumnsResponse>, I>>(base?: I): ListColumnsResponse { + return ListColumnsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListColumnsResponse>, I>>(object: I): ListColumnsResponse { + const message = createBaseListColumnsResponse(); + message.columns = object.columns?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListSourcesRequest(): ListSourcesRequest { + return {}; +} + +export const ListSourcesRequest = { + encode(_: ListSourcesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListSourcesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListSourcesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListSourcesRequest { + return {}; + }, + + toJSON(_: ListSourcesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<ListSourcesRequest>, I>>(base?: I): ListSourcesRequest { + return ListSourcesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListSourcesRequest>, I>>(_: I): ListSourcesRequest { + const message = createBaseListSourcesRequest(); + return message; + }, +}; + +function createBaseListSourcesResponse(): ListSourcesResponse { + return { sources: [] }; +} + +export const ListSourcesResponse = { + encode(message: ListSourcesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sources) { + ProjectFileSource.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListSourcesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListSourcesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sources.push(ProjectFileSource.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListSourcesResponse { + return { + sources: gt.Array.isArray(object?.sources) ? object.sources.map((e: any) => ProjectFileSource.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListSourcesResponse): unknown { + const obj: any = {}; + if (message.sources?.length) { + obj.sources = message.sources.map((e) => ProjectFileSource.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListSourcesResponse>, I>>(base?: I): ListSourcesResponse { + return ListSourcesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListSourcesResponse>, I>>(object: I): ListSourcesResponse { + const message = createBaseListSourcesResponse(); + message.sources = object.sources?.map((e) => ProjectFileSource.fromPartial(e)) || []; + return message; + }, +}; + +export interface CLIRPCService { + ListTables(request: ListTablesRequest): Promise<ListTablesResponse>; + ListViews(request: ListViewsRequest): Promise<ListViewsResponse>; + Exec(request: ExecRequest): Promise<ExecResponse>; + Query(request: QueryRequest): Promise<QueryResponse>; + ListColumns(request: ListColumnsRequest): Promise<ListColumnsResponse>; + ListSources(request: ListSourcesRequest): Promise<ListSourcesResponse>; +} + +export const CLIRPCServiceServiceName = "quary.service.v1.CLIRPCService"; +export class CLIRPCServiceClientImpl implements CLIRPCService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || CLIRPCServiceServiceName; + this.rpc = rpc; + this.ListTables = this.ListTables.bind(this); + this.ListViews = this.ListViews.bind(this); + this.Exec = this.Exec.bind(this); + this.Query = this.Query.bind(this); + this.ListColumns = this.ListColumns.bind(this); + this.ListSources = this.ListSources.bind(this); + } + ListTables(request: ListTablesRequest): Promise<ListTablesResponse> { + const data = ListTablesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListTables", data); + return promise.then((data) => ListTablesResponse.decode(_m0.Reader.create(data))); + } + + ListViews(request: ListViewsRequest): Promise<ListViewsResponse> { + const data = ListViewsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListViews", data); + return promise.then((data) => ListViewsResponse.decode(_m0.Reader.create(data))); + } + + Exec(request: ExecRequest): Promise<ExecResponse> { + const data = ExecRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Exec", data); + return promise.then((data) => ExecResponse.decode(_m0.Reader.create(data))); + } + + Query(request: QueryRequest): Promise<QueryResponse> { + const data = QueryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Query", data); + return promise.then((data) => QueryResponse.decode(_m0.Reader.create(data))); + } + + ListColumns(request: ListColumnsRequest): Promise<ListColumnsResponse> { + const data = ListColumnsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListColumns", data); + return promise.then((data) => ListColumnsResponse.decode(_m0.Reader.create(data))); + } + + ListSources(request: ListSourcesRequest): Promise<ListSourcesResponse> { + const data = ListSourcesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListSources", data); + return promise.then((data) => ListSourcesResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/column_description.ts b/js/packages/proto/src/generated/quary/service/v1/column_description.ts new file mode 100644 index 00000000..70828f09 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/column_description.ts @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/column_description.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface ColumnDescription { + name: string; + description?: string | undefined; + tests: string[]; +} + +function createBaseColumnDescription(): ColumnDescription { + return { name: "", description: undefined, tests: [] }; +} + +export const ColumnDescription = { + encode(message: ColumnDescription, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tests) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ColumnDescription { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseColumnDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tests.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ColumnDescription { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tests: gt.Array.isArray(object?.tests) ? object.tests.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: ColumnDescription): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tests?.length) { + obj.tests = message.tests; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ColumnDescription>, I>>(base?: I): ColumnDescription { + return ColumnDescription.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ColumnDescription>, I>>(object: I): ColumnDescription { + const message = createBaseColumnDescription(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tests = object.tests?.map((e) => e) || []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/connection_config.ts b/js/packages/proto/src/generated/quary/service/v1/connection_config.ts new file mode 100644 index 00000000..b8c79b0a --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/connection_config.ts @@ -0,0 +1,1063 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/connection_config.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface Var { + name: string; + value: string; +} + +/** Configuration describes the configuration of the project. */ +export interface ConnectionConfig { + config?: + | { $case: "duckdb"; duckdb: ConnectionConfig_ConnectionConfigDuckDB } + | { $case: "duckdbInMemory"; duckdbInMemory: ConnectionConfig_ConnectionConfigDuckDBInMemory } + | { $case: "sqlite"; sqlite: ConnectionConfig_ConnectionConfigSqLite } + | { $case: "sqliteInMemory"; sqliteInMemory: ConnectionConfig_ConnectionConfigSqLiteInMemory } + | { $case: "bigQuery"; bigQuery: ConnectionConfig_ConnectionConfigBigQuery } + | { $case: "snowflake"; snowflake: ConnectionConfig_ConnectionConfigSnowflake } + | { $case: "postgres"; postgres: ConnectionConfig_ConnectionConfigPostgres } + | { $case: "redshift"; redshift: ConnectionConfig_ConnectionConfigRedshift } + | undefined; + vars: Var[]; +} + +export interface ConnectionConfig_ConnectionConfigSqLite { + path: string; +} + +export interface ConnectionConfig_ConnectionConfigSqLiteInMemory { +} + +export interface ConnectionConfig_ConnectionConfigDuckDB { + path: string; + schema?: string | undefined; +} + +export interface ConnectionConfig_ConnectionConfigDuckDBInMemory { + schema?: string | undefined; +} + +export interface ConnectionConfig_ConnectionConfigPostgres { + schema: string; +} + +export interface ConnectionConfig_ConnectionConfigRedshift { + schema: string; +} + +export interface ConnectionConfig_ConnectionConfigBigQuery { + projectId: string; + datasetId: string; +} + +export interface ConnectionConfig_ConnectionConfigSnowflake { + accountUrl: string; + clientId: string; + clientSecret: string; + /** TODO: think about making optional */ + role: string; + database: string; + schema: string; + warehouse: string; +} + +function createBaseVar(): Var { + return { name: "", value: "" }; +} + +export const Var = { + encode(message: Var, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Var { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVar(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Var { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: Var): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Var>, I>>(base?: I): Var { + return Var.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Var>, I>>(object: I): Var { + const message = createBaseVar(); + message.name = object.name ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseConnectionConfig(): ConnectionConfig { + return { config: undefined, vars: [] }; +} + +export const ConnectionConfig = { + encode(message: ConnectionConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.config?.$case) { + case "duckdb": + ConnectionConfig_ConnectionConfigDuckDB.encode(message.config.duckdb, writer.uint32(10).fork()).ldelim(); + break; + case "duckdbInMemory": + ConnectionConfig_ConnectionConfigDuckDBInMemory.encode(message.config.duckdbInMemory, writer.uint32(18).fork()) + .ldelim(); + break; + case "sqlite": + ConnectionConfig_ConnectionConfigSqLite.encode(message.config.sqlite, writer.uint32(26).fork()).ldelim(); + break; + case "sqliteInMemory": + ConnectionConfig_ConnectionConfigSqLiteInMemory.encode(message.config.sqliteInMemory, writer.uint32(34).fork()) + .ldelim(); + break; + case "bigQuery": + ConnectionConfig_ConnectionConfigBigQuery.encode(message.config.bigQuery, writer.uint32(42).fork()).ldelim(); + break; + case "snowflake": + ConnectionConfig_ConnectionConfigSnowflake.encode(message.config.snowflake, writer.uint32(50).fork()).ldelim(); + break; + case "postgres": + ConnectionConfig_ConnectionConfigPostgres.encode(message.config.postgres, writer.uint32(58).fork()).ldelim(); + break; + case "redshift": + ConnectionConfig_ConnectionConfigRedshift.encode(message.config.redshift, writer.uint32(74).fork()).ldelim(); + break; + } + for (const v of message.vars) { + Var.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.config = { + $case: "duckdb", + duckdb: ConnectionConfig_ConnectionConfigDuckDB.decode(reader, reader.uint32()), + }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.config = { + $case: "duckdbInMemory", + duckdbInMemory: ConnectionConfig_ConnectionConfigDuckDBInMemory.decode(reader, reader.uint32()), + }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.config = { + $case: "sqlite", + sqlite: ConnectionConfig_ConnectionConfigSqLite.decode(reader, reader.uint32()), + }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.config = { + $case: "sqliteInMemory", + sqliteInMemory: ConnectionConfig_ConnectionConfigSqLiteInMemory.decode(reader, reader.uint32()), + }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.config = { + $case: "bigQuery", + bigQuery: ConnectionConfig_ConnectionConfigBigQuery.decode(reader, reader.uint32()), + }; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.config = { + $case: "snowflake", + snowflake: ConnectionConfig_ConnectionConfigSnowflake.decode(reader, reader.uint32()), + }; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.config = { + $case: "postgres", + postgres: ConnectionConfig_ConnectionConfigPostgres.decode(reader, reader.uint32()), + }; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.config = { + $case: "redshift", + redshift: ConnectionConfig_ConnectionConfigRedshift.decode(reader, reader.uint32()), + }; + continue; + case 8: + if (tag !== 66) { + break; + } + + message.vars.push(Var.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig { + return { + config: isSet(object.duckdb) + ? { $case: "duckdb", duckdb: ConnectionConfig_ConnectionConfigDuckDB.fromJSON(object.duckdb) } + : isSet(object.duckdbInMemory) + ? { + $case: "duckdbInMemory", + duckdbInMemory: ConnectionConfig_ConnectionConfigDuckDBInMemory.fromJSON(object.duckdbInMemory), + } + : isSet(object.sqlite) + ? { $case: "sqlite", sqlite: ConnectionConfig_ConnectionConfigSqLite.fromJSON(object.sqlite) } + : isSet(object.sqliteInMemory) + ? { + $case: "sqliteInMemory", + sqliteInMemory: ConnectionConfig_ConnectionConfigSqLiteInMemory.fromJSON(object.sqliteInMemory), + } + : isSet(object.bigQuery) + ? { $case: "bigQuery", bigQuery: ConnectionConfig_ConnectionConfigBigQuery.fromJSON(object.bigQuery) } + : isSet(object.snowflake) + ? { $case: "snowflake", snowflake: ConnectionConfig_ConnectionConfigSnowflake.fromJSON(object.snowflake) } + : isSet(object.postgres) + ? { $case: "postgres", postgres: ConnectionConfig_ConnectionConfigPostgres.fromJSON(object.postgres) } + : isSet(object.redshift) + ? { $case: "redshift", redshift: ConnectionConfig_ConnectionConfigRedshift.fromJSON(object.redshift) } + : undefined, + vars: gt.Array.isArray(object?.vars) ? object.vars.map((e: any) => Var.fromJSON(e)) : [], + }; + }, + + toJSON(message: ConnectionConfig): unknown { + const obj: any = {}; + if (message.config?.$case === "duckdb") { + obj.duckdb = ConnectionConfig_ConnectionConfigDuckDB.toJSON(message.config.duckdb); + } + if (message.config?.$case === "duckdbInMemory") { + obj.duckdbInMemory = ConnectionConfig_ConnectionConfigDuckDBInMemory.toJSON(message.config.duckdbInMemory); + } + if (message.config?.$case === "sqlite") { + obj.sqlite = ConnectionConfig_ConnectionConfigSqLite.toJSON(message.config.sqlite); + } + if (message.config?.$case === "sqliteInMemory") { + obj.sqliteInMemory = ConnectionConfig_ConnectionConfigSqLiteInMemory.toJSON(message.config.sqliteInMemory); + } + if (message.config?.$case === "bigQuery") { + obj.bigQuery = ConnectionConfig_ConnectionConfigBigQuery.toJSON(message.config.bigQuery); + } + if (message.config?.$case === "snowflake") { + obj.snowflake = ConnectionConfig_ConnectionConfigSnowflake.toJSON(message.config.snowflake); + } + if (message.config?.$case === "postgres") { + obj.postgres = ConnectionConfig_ConnectionConfigPostgres.toJSON(message.config.postgres); + } + if (message.config?.$case === "redshift") { + obj.redshift = ConnectionConfig_ConnectionConfigRedshift.toJSON(message.config.redshift); + } + if (message.vars?.length) { + obj.vars = message.vars.map((e) => Var.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig>, I>>(base?: I): ConnectionConfig { + return ConnectionConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig>, I>>(object: I): ConnectionConfig { + const message = createBaseConnectionConfig(); + if (object.config?.$case === "duckdb" && object.config?.duckdb !== undefined && object.config?.duckdb !== null) { + message.config = { + $case: "duckdb", + duckdb: ConnectionConfig_ConnectionConfigDuckDB.fromPartial(object.config.duckdb), + }; + } + if ( + object.config?.$case === "duckdbInMemory" && + object.config?.duckdbInMemory !== undefined && + object.config?.duckdbInMemory !== null + ) { + message.config = { + $case: "duckdbInMemory", + duckdbInMemory: ConnectionConfig_ConnectionConfigDuckDBInMemory.fromPartial(object.config.duckdbInMemory), + }; + } + if (object.config?.$case === "sqlite" && object.config?.sqlite !== undefined && object.config?.sqlite !== null) { + message.config = { + $case: "sqlite", + sqlite: ConnectionConfig_ConnectionConfigSqLite.fromPartial(object.config.sqlite), + }; + } + if ( + object.config?.$case === "sqliteInMemory" && + object.config?.sqliteInMemory !== undefined && + object.config?.sqliteInMemory !== null + ) { + message.config = { + $case: "sqliteInMemory", + sqliteInMemory: ConnectionConfig_ConnectionConfigSqLiteInMemory.fromPartial(object.config.sqliteInMemory), + }; + } + if ( + object.config?.$case === "bigQuery" && object.config?.bigQuery !== undefined && object.config?.bigQuery !== null + ) { + message.config = { + $case: "bigQuery", + bigQuery: ConnectionConfig_ConnectionConfigBigQuery.fromPartial(object.config.bigQuery), + }; + } + if ( + object.config?.$case === "snowflake" && + object.config?.snowflake !== undefined && + object.config?.snowflake !== null + ) { + message.config = { + $case: "snowflake", + snowflake: ConnectionConfig_ConnectionConfigSnowflake.fromPartial(object.config.snowflake), + }; + } + if ( + object.config?.$case === "postgres" && object.config?.postgres !== undefined && object.config?.postgres !== null + ) { + message.config = { + $case: "postgres", + postgres: ConnectionConfig_ConnectionConfigPostgres.fromPartial(object.config.postgres), + }; + } + if ( + object.config?.$case === "redshift" && object.config?.redshift !== undefined && object.config?.redshift !== null + ) { + message.config = { + $case: "redshift", + redshift: ConnectionConfig_ConnectionConfigRedshift.fromPartial(object.config.redshift), + }; + } + message.vars = object.vars?.map((e) => Var.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigSqLite(): ConnectionConfig_ConnectionConfigSqLite { + return { path: "" }; +} + +export const ConnectionConfig_ConnectionConfigSqLite = { + encode(message: ConnectionConfig_ConnectionConfigSqLite, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigSqLite { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigSqLite(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigSqLite { + return { path: isSet(object.path) ? gt.String(object.path) : "" }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigSqLite): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSqLite>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigSqLite { + return ConnectionConfig_ConnectionConfigSqLite.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSqLite>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigSqLite { + const message = createBaseConnectionConfig_ConnectionConfigSqLite(); + message.path = object.path ?? ""; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigSqLiteInMemory(): ConnectionConfig_ConnectionConfigSqLiteInMemory { + return {}; +} + +export const ConnectionConfig_ConnectionConfigSqLiteInMemory = { + encode(_: ConnectionConfig_ConnectionConfigSqLiteInMemory, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigSqLiteInMemory { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigSqLiteInMemory(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ConnectionConfig_ConnectionConfigSqLiteInMemory { + return {}; + }, + + toJSON(_: ConnectionConfig_ConnectionConfigSqLiteInMemory): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSqLiteInMemory>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigSqLiteInMemory { + return ConnectionConfig_ConnectionConfigSqLiteInMemory.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSqLiteInMemory>, I>>( + _: I, + ): ConnectionConfig_ConnectionConfigSqLiteInMemory { + const message = createBaseConnectionConfig_ConnectionConfigSqLiteInMemory(); + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigDuckDB(): ConnectionConfig_ConnectionConfigDuckDB { + return { path: "", schema: undefined }; +} + +export const ConnectionConfig_ConnectionConfigDuckDB = { + encode(message: ConnectionConfig_ConnectionConfigDuckDB, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.schema !== undefined) { + writer.uint32(18).string(message.schema); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigDuckDB { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigDuckDB(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.schema = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigDuckDB { + return { + path: isSet(object.path) ? gt.String(object.path) : "", + schema: isSet(object.schema) ? gt.String(object.schema) : undefined, + }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigDuckDB): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.schema !== undefined) { + obj.schema = message.schema; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigDuckDB>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigDuckDB { + return ConnectionConfig_ConnectionConfigDuckDB.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigDuckDB>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigDuckDB { + const message = createBaseConnectionConfig_ConnectionConfigDuckDB(); + message.path = object.path ?? ""; + message.schema = object.schema ?? undefined; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigDuckDBInMemory(): ConnectionConfig_ConnectionConfigDuckDBInMemory { + return { schema: undefined }; +} + +export const ConnectionConfig_ConnectionConfigDuckDBInMemory = { + encode( + message: ConnectionConfig_ConnectionConfigDuckDBInMemory, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.schema !== undefined) { + writer.uint32(10).string(message.schema); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigDuckDBInMemory { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigDuckDBInMemory(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.schema = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigDuckDBInMemory { + return { schema: isSet(object.schema) ? gt.String(object.schema) : undefined }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigDuckDBInMemory): unknown { + const obj: any = {}; + if (message.schema !== undefined) { + obj.schema = message.schema; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigDuckDBInMemory>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigDuckDBInMemory { + return ConnectionConfig_ConnectionConfigDuckDBInMemory.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigDuckDBInMemory>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigDuckDBInMemory { + const message = createBaseConnectionConfig_ConnectionConfigDuckDBInMemory(); + message.schema = object.schema ?? undefined; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigPostgres(): ConnectionConfig_ConnectionConfigPostgres { + return { schema: "" }; +} + +export const ConnectionConfig_ConnectionConfigPostgres = { + encode(message: ConnectionConfig_ConnectionConfigPostgres, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.schema !== "") { + writer.uint32(10).string(message.schema); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigPostgres { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigPostgres(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.schema = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigPostgres { + return { schema: isSet(object.schema) ? gt.String(object.schema) : "" }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigPostgres): unknown { + const obj: any = {}; + if (message.schema !== "") { + obj.schema = message.schema; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigPostgres>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigPostgres { + return ConnectionConfig_ConnectionConfigPostgres.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigPostgres>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigPostgres { + const message = createBaseConnectionConfig_ConnectionConfigPostgres(); + message.schema = object.schema ?? ""; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigRedshift(): ConnectionConfig_ConnectionConfigRedshift { + return { schema: "" }; +} + +export const ConnectionConfig_ConnectionConfigRedshift = { + encode(message: ConnectionConfig_ConnectionConfigRedshift, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.schema !== "") { + writer.uint32(10).string(message.schema); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigRedshift { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigRedshift(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.schema = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigRedshift { + return { schema: isSet(object.schema) ? gt.String(object.schema) : "" }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigRedshift): unknown { + const obj: any = {}; + if (message.schema !== "") { + obj.schema = message.schema; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigRedshift>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigRedshift { + return ConnectionConfig_ConnectionConfigRedshift.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigRedshift>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigRedshift { + const message = createBaseConnectionConfig_ConnectionConfigRedshift(); + message.schema = object.schema ?? ""; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigBigQuery(): ConnectionConfig_ConnectionConfigBigQuery { + return { projectId: "", datasetId: "" }; +} + +export const ConnectionConfig_ConnectionConfigBigQuery = { + encode(message: ConnectionConfig_ConnectionConfigBigQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectId !== "") { + writer.uint32(10).string(message.projectId); + } + if (message.datasetId !== "") { + writer.uint32(18).string(message.datasetId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigBigQuery { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigBigQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.datasetId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigBigQuery { + return { + projectId: isSet(object.projectId) ? gt.String(object.projectId) : "", + datasetId: isSet(object.datasetId) ? gt.String(object.datasetId) : "", + }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigBigQuery): unknown { + const obj: any = {}; + if (message.projectId !== "") { + obj.projectId = message.projectId; + } + if (message.datasetId !== "") { + obj.datasetId = message.datasetId; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigBigQuery>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigBigQuery { + return ConnectionConfig_ConnectionConfigBigQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigBigQuery>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigBigQuery { + const message = createBaseConnectionConfig_ConnectionConfigBigQuery(); + message.projectId = object.projectId ?? ""; + message.datasetId = object.datasetId ?? ""; + return message; + }, +}; + +function createBaseConnectionConfig_ConnectionConfigSnowflake(): ConnectionConfig_ConnectionConfigSnowflake { + return { accountUrl: "", clientId: "", clientSecret: "", role: "", database: "", schema: "", warehouse: "" }; +} + +export const ConnectionConfig_ConnectionConfigSnowflake = { + encode(message: ConnectionConfig_ConnectionConfigSnowflake, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accountUrl !== "") { + writer.uint32(10).string(message.accountUrl); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.clientSecret !== "") { + writer.uint32(26).string(message.clientSecret); + } + if (message.role !== "") { + writer.uint32(34).string(message.role); + } + if (message.database !== "") { + writer.uint32(42).string(message.database); + } + if (message.schema !== "") { + writer.uint32(50).string(message.schema); + } + if (message.warehouse !== "") { + writer.uint32(58).string(message.warehouse); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionConfig_ConnectionConfigSnowflake { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionConfig_ConnectionConfigSnowflake(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.clientId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.clientSecret = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.role = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.database = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.schema = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.warehouse = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConnectionConfig_ConnectionConfigSnowflake { + return { + accountUrl: isSet(object.accountUrl) ? gt.String(object.accountUrl) : "", + clientId: isSet(object.clientId) ? gt.String(object.clientId) : "", + clientSecret: isSet(object.clientSecret) ? gt.String(object.clientSecret) : "", + role: isSet(object.role) ? gt.String(object.role) : "", + database: isSet(object.database) ? gt.String(object.database) : "", + schema: isSet(object.schema) ? gt.String(object.schema) : "", + warehouse: isSet(object.warehouse) ? gt.String(object.warehouse) : "", + }; + }, + + toJSON(message: ConnectionConfig_ConnectionConfigSnowflake): unknown { + const obj: any = {}; + if (message.accountUrl !== "") { + obj.accountUrl = message.accountUrl; + } + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.clientSecret !== "") { + obj.clientSecret = message.clientSecret; + } + if (message.role !== "") { + obj.role = message.role; + } + if (message.database !== "") { + obj.database = message.database; + } + if (message.schema !== "") { + obj.schema = message.schema; + } + if (message.warehouse !== "") { + obj.warehouse = message.warehouse; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSnowflake>, I>>( + base?: I, + ): ConnectionConfig_ConnectionConfigSnowflake { + return ConnectionConfig_ConnectionConfigSnowflake.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ConnectionConfig_ConnectionConfigSnowflake>, I>>( + object: I, + ): ConnectionConfig_ConnectionConfigSnowflake { + const message = createBaseConnectionConfig_ConnectionConfigSnowflake(); + message.accountUrl = object.accountUrl ?? ""; + message.clientId = object.clientId ?? ""; + message.clientSecret = object.clientSecret ?? ""; + message.role = object.role ?? ""; + message.database = object.database ?? ""; + message.schema = object.schema ?? ""; + message.warehouse = object.warehouse ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/connection_response.ts b/js/packages/proto/src/generated/quary/service/v1/connection_response.ts new file mode 100644 index 00000000..4f8ad2ae --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/connection_response.ts @@ -0,0 +1,2376 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/connection_response.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface BigQueryProjectReference { + projectId: string; +} + +/** Project API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/list */ +export interface BigQueryProject { + /** The resource type. */ + kind: string; + /** An opaque ID of this project. */ + id: string; + /** The numeric ID of this project. */ + numericId: string; + /** A unique reference to a project. */ + projectReference: + | BigQueryProjectReference + | undefined; + /** A descriptive name for this project. */ + friendlyName: string; +} + +/** Dataset Reference API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#DatasetReference */ +export interface BigQueryDatasetReference { + projectId: string; + datasetId: string; +} + +/** Dataset API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list */ +export interface BigQueryDataset { + /** The resource type. This property always returns the value "bigquery#dataset" */ + kind: string; + /** The fully-qualified, unique, opaque ID of the dataset. */ + id: string; + /** The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID. */ + datasetReference: + | BigQueryDatasetReference + | undefined; + /** An alternate name for the dataset. The friendly name is purely decorative in nature. */ + friendlyName: string; + /** The labels associated with this dataset. You can use these to organize and group your datasets. */ + labels: { [key: string]: string }; + /** The geographic location where the dataset resides. */ + location: string; +} + +export interface BigQueryDataset_LabelsEntry { + key: string; + value: string; +} + +/** Table Reference API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#TableReference */ +export interface BigQueryTableReference { + projectId: string; + datasetId: string; + tableId: string; +} + +/** Table API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/list */ +export interface BigQueryTable { + /** The resource type. */ + kind: string; + /** An opaque ID uniquely identifying the table. */ + id: string; + /** A reference uniquely identifying the table. */ + tableReference: + | BigQueryTableReference + | undefined; + /** The type of table. Possible values are: TABLE, VIEW. */ + type: string; + /** The time when this table was created, in milliseconds since the epoch. */ + creationTime: string; +} + +/** Table Field API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#TableFieldSchema */ +export interface BigQueryTableField { + /** The field name. */ + name: string; + /** The field data type. Possible values are: STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP. */ + type: string; + /** The field mode. Possible values are: NULLABLE, REQUIRED, REPEATED. */ + mode: string; + /** Describes the nested schema fields if the type property is set to RECORD. */ + fields: BigQueryTableField[]; + /** The field description. */ + description: string; +} + +/** Table Schema API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#TableSchema */ +export interface BigQueryTableSchema { + name: string; + type: string; + /** Describes the fields in a table. */ + fields: BigQueryTableField[]; + /** The field description. */ + description: string; +} + +/** JobReference API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/JobReference */ +export interface BigQueryJobReference { + /** The ID of the project containing this job. */ + projectId: string; + /** The ID of the job. */ + jobId: string; + /** The geographic location of the job. */ + location: string; +} + +/** BigQueryError API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/ErrorProto */ +export interface BigQueryError { + /** A short error code that summarizes the error. */ + reason: string; + /** The location of the error, if applicable. */ + location: string; + /** A human-readable description of the error. */ + debugInfo: string; + /** A human-readable description of the error. */ + message: string; +} + +/** JobStatus API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/JobStatus */ +export interface BigQueryJobStatus { + /** The state of the job. Possible values include: "PENDING", "RUNNING", "DONE". */ + state: string; + /** Final error result of the job. If present, indicates that the job has completed and was unsuccessful. */ + errorResult: string; + /** The final error result of the job as a human-readable string. */ + errorMessage: string; +} + +/** Job API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job */ +export interface BigQueryJob { + /** The resource type. */ + kind: string; + /** An opaque ID uniquely identifying the job. */ + id: string; + /** A URL that can be used to access this resource again. */ + selfLink: string; + /** The email address of the user who ran the job. */ + userEmail: string; + /** A reference uniquely identifying the job. */ + jobReference: + | BigQueryJobReference + | undefined; + /** Information about the job, including starting time and ending time of the job. */ + status: BigQueryJobStatus | undefined; +} + +export interface BigQueryFieldValue { + /** Represents the 'f' in a JSON object */ + f: string; + /** Represents the 'v' in a JSON object */ + v: string; +} + +export interface BigQueryTableRow { + /** Represents a single row as a series of field-value pairs */ + f: BigQueryFieldValue[]; +} + +/** BigQueryJobResults API Documentation: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults */ +export interface BigQueryJobResults { + /** The resource type. */ + kind: string; + /** The schema of the results. Present only when the query completes successfully. */ + schema: + | BigQueryTableSchema + | undefined; + /** A reference uniquely identifying the job. */ + jobReference: + | BigQueryJobReference + | undefined; + /** The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. */ + totalRows: string; + /** A token used for paging results. */ + pageToken: string; + /** An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. */ + rows: BigQueryTableRow[]; + /** Whether the query result was fetched from the query cache. */ + jobComplete: string; + /** The first errors encountered during the running of the job. The final message includes the number of errors encountered. */ + errors: BigQueryError[]; + /** Whether the query result was fetched from the query cache. */ + cacheHit: string; + /** The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. */ + numDmlAffectedRows: string; +} + +/** Google Oauth 2.0 token API Documentation: https://developers.google.com/identity/protocols/oauth2/web-server#httprest */ +export interface BigQueryOauthToken { + /** short-lived token */ + accessToken: string; + refreshToken: string; + /** absolute time the token expires */ + expiryTime: string; +} + +export interface BigQueryOauthTokenRefresh { + /** short-lived token */ + accessToken: string; + /** absolute time the token expires */ + expiryTime: string; +} + +/** Snowflake SSO */ +export interface SnowflakeOauthProxyRequest { + accountUrl: string; + clientId: string; + clientSecret: string; + role: string; +} + +export interface SnowflakeOauthToken { + accessToken: string; + refreshToken: string; + expiryTime: string; +} + +export interface SnowflakeOauthRefreshToken { + accessToken: string; + expiryTime: string; +} + +function createBaseBigQueryProjectReference(): BigQueryProjectReference { + return { projectId: "" }; +} + +export const BigQueryProjectReference = { + encode(message: BigQueryProjectReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectId !== "") { + writer.uint32(10).string(message.projectId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryProjectReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryProjectReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryProjectReference { + return { projectId: isSet(object.projectId) ? gt.String(object.projectId) : "" }; + }, + + toJSON(message: BigQueryProjectReference): unknown { + const obj: any = {}; + if (message.projectId !== "") { + obj.projectId = message.projectId; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryProjectReference>, I>>(base?: I): BigQueryProjectReference { + return BigQueryProjectReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryProjectReference>, I>>(object: I): BigQueryProjectReference { + const message = createBaseBigQueryProjectReference(); + message.projectId = object.projectId ?? ""; + return message; + }, +}; + +function createBaseBigQueryProject(): BigQueryProject { + return { kind: "", id: "", numericId: "", projectReference: undefined, friendlyName: "" }; +} + +export const BigQueryProject = { + encode(message: BigQueryProject, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.numericId !== "") { + writer.uint32(26).string(message.numericId); + } + if (message.projectReference !== undefined) { + BigQueryProjectReference.encode(message.projectReference, writer.uint32(34).fork()).ldelim(); + } + if (message.friendlyName !== "") { + writer.uint32(42).string(message.friendlyName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryProject { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryProject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.numericId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.projectReference = BigQueryProjectReference.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.friendlyName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryProject { + return { + kind: isSet(object.kind) ? gt.String(object.kind) : "", + id: isSet(object.id) ? gt.String(object.id) : "", + numericId: isSet(object.numericId) ? gt.String(object.numericId) : "", + projectReference: isSet(object.projectReference) + ? BigQueryProjectReference.fromJSON(object.projectReference) + : undefined, + friendlyName: isSet(object.friendlyName) ? gt.String(object.friendlyName) : "", + }; + }, + + toJSON(message: BigQueryProject): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.numericId !== "") { + obj.numericId = message.numericId; + } + if (message.projectReference !== undefined) { + obj.projectReference = BigQueryProjectReference.toJSON(message.projectReference); + } + if (message.friendlyName !== "") { + obj.friendlyName = message.friendlyName; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryProject>, I>>(base?: I): BigQueryProject { + return BigQueryProject.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryProject>, I>>(object: I): BigQueryProject { + const message = createBaseBigQueryProject(); + message.kind = object.kind ?? ""; + message.id = object.id ?? ""; + message.numericId = object.numericId ?? ""; + message.projectReference = (object.projectReference !== undefined && object.projectReference !== null) + ? BigQueryProjectReference.fromPartial(object.projectReference) + : undefined; + message.friendlyName = object.friendlyName ?? ""; + return message; + }, +}; + +function createBaseBigQueryDatasetReference(): BigQueryDatasetReference { + return { projectId: "", datasetId: "" }; +} + +export const BigQueryDatasetReference = { + encode(message: BigQueryDatasetReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectId !== "") { + writer.uint32(10).string(message.projectId); + } + if (message.datasetId !== "") { + writer.uint32(18).string(message.datasetId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryDatasetReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryDatasetReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.datasetId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryDatasetReference { + return { + projectId: isSet(object.projectId) ? gt.String(object.projectId) : "", + datasetId: isSet(object.datasetId) ? gt.String(object.datasetId) : "", + }; + }, + + toJSON(message: BigQueryDatasetReference): unknown { + const obj: any = {}; + if (message.projectId !== "") { + obj.projectId = message.projectId; + } + if (message.datasetId !== "") { + obj.datasetId = message.datasetId; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryDatasetReference>, I>>(base?: I): BigQueryDatasetReference { + return BigQueryDatasetReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryDatasetReference>, I>>(object: I): BigQueryDatasetReference { + const message = createBaseBigQueryDatasetReference(); + message.projectId = object.projectId ?? ""; + message.datasetId = object.datasetId ?? ""; + return message; + }, +}; + +function createBaseBigQueryDataset(): BigQueryDataset { + return { kind: "", id: "", datasetReference: undefined, friendlyName: "", labels: {}, location: "" }; +} + +export const BigQueryDataset = { + encode(message: BigQueryDataset, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.datasetReference !== undefined) { + BigQueryDatasetReference.encode(message.datasetReference, writer.uint32(26).fork()).ldelim(); + } + if (message.friendlyName !== "") { + writer.uint32(34).string(message.friendlyName); + } + Object.entries(message.labels).forEach(([key, value]) => { + BigQueryDataset_LabelsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).ldelim(); + }); + if (message.location !== "") { + writer.uint32(50).string(message.location); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryDataset { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryDataset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.datasetReference = BigQueryDatasetReference.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.friendlyName = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + const entry5 = BigQueryDataset_LabelsEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.labels[entry5.key] = entry5.value; + } + continue; + case 6: + if (tag !== 50) { + break; + } + + message.location = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryDataset { + return { + kind: isSet(object.kind) ? gt.String(object.kind) : "", + id: isSet(object.id) ? gt.String(object.id) : "", + datasetReference: isSet(object.datasetReference) + ? BigQueryDatasetReference.fromJSON(object.datasetReference) + : undefined, + friendlyName: isSet(object.friendlyName) ? gt.String(object.friendlyName) : "", + labels: isObject(object.labels) + ? Object.entries(object.labels).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + location: isSet(object.location) ? gt.String(object.location) : "", + }; + }, + + toJSON(message: BigQueryDataset): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.datasetReference !== undefined) { + obj.datasetReference = BigQueryDatasetReference.toJSON(message.datasetReference); + } + if (message.friendlyName !== "") { + obj.friendlyName = message.friendlyName; + } + if (message.labels) { + const entries = Object.entries(message.labels); + if (entries.length > 0) { + obj.labels = {}; + entries.forEach(([k, v]) => { + obj.labels[k] = v; + }); + } + } + if (message.location !== "") { + obj.location = message.location; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryDataset>, I>>(base?: I): BigQueryDataset { + return BigQueryDataset.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryDataset>, I>>(object: I): BigQueryDataset { + const message = createBaseBigQueryDataset(); + message.kind = object.kind ?? ""; + message.id = object.id ?? ""; + message.datasetReference = (object.datasetReference !== undefined && object.datasetReference !== null) + ? BigQueryDatasetReference.fromPartial(object.datasetReference) + : undefined; + message.friendlyName = object.friendlyName ?? ""; + message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = gt.String(value); + } + return acc; + }, {}); + message.location = object.location ?? ""; + return message; + }, +}; + +function createBaseBigQueryDataset_LabelsEntry(): BigQueryDataset_LabelsEntry { + return { key: "", value: "" }; +} + +export const BigQueryDataset_LabelsEntry = { + encode(message: BigQueryDataset_LabelsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryDataset_LabelsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryDataset_LabelsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryDataset_LabelsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: BigQueryDataset_LabelsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryDataset_LabelsEntry>, I>>(base?: I): BigQueryDataset_LabelsEntry { + return BigQueryDataset_LabelsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryDataset_LabelsEntry>, I>>(object: I): BigQueryDataset_LabelsEntry { + const message = createBaseBigQueryDataset_LabelsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseBigQueryTableReference(): BigQueryTableReference { + return { projectId: "", datasetId: "", tableId: "" }; +} + +export const BigQueryTableReference = { + encode(message: BigQueryTableReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectId !== "") { + writer.uint32(10).string(message.projectId); + } + if (message.datasetId !== "") { + writer.uint32(18).string(message.datasetId); + } + if (message.tableId !== "") { + writer.uint32(26).string(message.tableId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryTableReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryTableReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.datasetId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tableId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryTableReference { + return { + projectId: isSet(object.projectId) ? gt.String(object.projectId) : "", + datasetId: isSet(object.datasetId) ? gt.String(object.datasetId) : "", + tableId: isSet(object.tableId) ? gt.String(object.tableId) : "", + }; + }, + + toJSON(message: BigQueryTableReference): unknown { + const obj: any = {}; + if (message.projectId !== "") { + obj.projectId = message.projectId; + } + if (message.datasetId !== "") { + obj.datasetId = message.datasetId; + } + if (message.tableId !== "") { + obj.tableId = message.tableId; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryTableReference>, I>>(base?: I): BigQueryTableReference { + return BigQueryTableReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryTableReference>, I>>(object: I): BigQueryTableReference { + const message = createBaseBigQueryTableReference(); + message.projectId = object.projectId ?? ""; + message.datasetId = object.datasetId ?? ""; + message.tableId = object.tableId ?? ""; + return message; + }, +}; + +function createBaseBigQueryTable(): BigQueryTable { + return { kind: "", id: "", tableReference: undefined, type: "", creationTime: "" }; +} + +export const BigQueryTable = { + encode(message: BigQueryTable, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.tableReference !== undefined) { + BigQueryTableReference.encode(message.tableReference, writer.uint32(26).fork()).ldelim(); + } + if (message.type !== "") { + writer.uint32(34).string(message.type); + } + if (message.creationTime !== "") { + writer.uint32(42).string(message.creationTime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryTable { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryTable(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tableReference = BigQueryTableReference.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.creationTime = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryTable { + return { + kind: isSet(object.kind) ? gt.String(object.kind) : "", + id: isSet(object.id) ? gt.String(object.id) : "", + tableReference: isSet(object.tableReference) ? BigQueryTableReference.fromJSON(object.tableReference) : undefined, + type: isSet(object.type) ? gt.String(object.type) : "", + creationTime: isSet(object.creationTime) ? gt.String(object.creationTime) : "", + }; + }, + + toJSON(message: BigQueryTable): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.tableReference !== undefined) { + obj.tableReference = BigQueryTableReference.toJSON(message.tableReference); + } + if (message.type !== "") { + obj.type = message.type; + } + if (message.creationTime !== "") { + obj.creationTime = message.creationTime; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryTable>, I>>(base?: I): BigQueryTable { + return BigQueryTable.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryTable>, I>>(object: I): BigQueryTable { + const message = createBaseBigQueryTable(); + message.kind = object.kind ?? ""; + message.id = object.id ?? ""; + message.tableReference = (object.tableReference !== undefined && object.tableReference !== null) + ? BigQueryTableReference.fromPartial(object.tableReference) + : undefined; + message.type = object.type ?? ""; + message.creationTime = object.creationTime ?? ""; + return message; + }, +}; + +function createBaseBigQueryTableField(): BigQueryTableField { + return { name: "", type: "", mode: "", fields: [], description: "" }; +} + +export const BigQueryTableField = { + encode(message: BigQueryTableField, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + if (message.mode !== "") { + writer.uint32(26).string(message.mode); + } + for (const v of message.fields) { + BigQueryTableField.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.description !== "") { + writer.uint32(42).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryTableField { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryTableField(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.type = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.mode = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.fields.push(BigQueryTableField.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryTableField { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + type: isSet(object.type) ? gt.String(object.type) : "", + mode: isSet(object.mode) ? gt.String(object.mode) : "", + fields: gt.Array.isArray(object?.fields) ? object.fields.map((e: any) => BigQueryTableField.fromJSON(e)) : [], + description: isSet(object.description) ? gt.String(object.description) : "", + }; + }, + + toJSON(message: BigQueryTableField): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== "") { + obj.type = message.type; + } + if (message.mode !== "") { + obj.mode = message.mode; + } + if (message.fields?.length) { + obj.fields = message.fields.map((e) => BigQueryTableField.toJSON(e)); + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryTableField>, I>>(base?: I): BigQueryTableField { + return BigQueryTableField.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryTableField>, I>>(object: I): BigQueryTableField { + const message = createBaseBigQueryTableField(); + message.name = object.name ?? ""; + message.type = object.type ?? ""; + message.mode = object.mode ?? ""; + message.fields = object.fields?.map((e) => BigQueryTableField.fromPartial(e)) || []; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseBigQueryTableSchema(): BigQueryTableSchema { + return { name: "", type: "", fields: [], description: "" }; +} + +export const BigQueryTableSchema = { + encode(message: BigQueryTableSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + for (const v of message.fields) { + BigQueryTableField.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryTableSchema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryTableSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.type = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.fields.push(BigQueryTableField.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryTableSchema { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + type: isSet(object.type) ? gt.String(object.type) : "", + fields: gt.Array.isArray(object?.fields) ? object.fields.map((e: any) => BigQueryTableField.fromJSON(e)) : [], + description: isSet(object.description) ? gt.String(object.description) : "", + }; + }, + + toJSON(message: BigQueryTableSchema): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== "") { + obj.type = message.type; + } + if (message.fields?.length) { + obj.fields = message.fields.map((e) => BigQueryTableField.toJSON(e)); + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryTableSchema>, I>>(base?: I): BigQueryTableSchema { + return BigQueryTableSchema.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryTableSchema>, I>>(object: I): BigQueryTableSchema { + const message = createBaseBigQueryTableSchema(); + message.name = object.name ?? ""; + message.type = object.type ?? ""; + message.fields = object.fields?.map((e) => BigQueryTableField.fromPartial(e)) || []; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseBigQueryJobReference(): BigQueryJobReference { + return { projectId: "", jobId: "", location: "" }; +} + +export const BigQueryJobReference = { + encode(message: BigQueryJobReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectId !== "") { + writer.uint32(10).string(message.projectId); + } + if (message.jobId !== "") { + writer.uint32(18).string(message.jobId); + } + if (message.location !== "") { + writer.uint32(26).string(message.location); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryJobReference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryJobReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.jobId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.location = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryJobReference { + return { + projectId: isSet(object.projectId) ? gt.String(object.projectId) : "", + jobId: isSet(object.jobId) ? gt.String(object.jobId) : "", + location: isSet(object.location) ? gt.String(object.location) : "", + }; + }, + + toJSON(message: BigQueryJobReference): unknown { + const obj: any = {}; + if (message.projectId !== "") { + obj.projectId = message.projectId; + } + if (message.jobId !== "") { + obj.jobId = message.jobId; + } + if (message.location !== "") { + obj.location = message.location; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryJobReference>, I>>(base?: I): BigQueryJobReference { + return BigQueryJobReference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryJobReference>, I>>(object: I): BigQueryJobReference { + const message = createBaseBigQueryJobReference(); + message.projectId = object.projectId ?? ""; + message.jobId = object.jobId ?? ""; + message.location = object.location ?? ""; + return message; + }, +}; + +function createBaseBigQueryError(): BigQueryError { + return { reason: "", location: "", debugInfo: "", message: "" }; +} + +export const BigQueryError = { + encode(message: BigQueryError, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.reason !== "") { + writer.uint32(10).string(message.reason); + } + if (message.location !== "") { + writer.uint32(18).string(message.location); + } + if (message.debugInfo !== "") { + writer.uint32(26).string(message.debugInfo); + } + if (message.message !== "") { + writer.uint32(34).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryError { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryError(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reason = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.location = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.debugInfo = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryError { + return { + reason: isSet(object.reason) ? gt.String(object.reason) : "", + location: isSet(object.location) ? gt.String(object.location) : "", + debugInfo: isSet(object.debugInfo) ? gt.String(object.debugInfo) : "", + message: isSet(object.message) ? gt.String(object.message) : "", + }; + }, + + toJSON(message: BigQueryError): unknown { + const obj: any = {}; + if (message.reason !== "") { + obj.reason = message.reason; + } + if (message.location !== "") { + obj.location = message.location; + } + if (message.debugInfo !== "") { + obj.debugInfo = message.debugInfo; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryError>, I>>(base?: I): BigQueryError { + return BigQueryError.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryError>, I>>(object: I): BigQueryError { + const message = createBaseBigQueryError(); + message.reason = object.reason ?? ""; + message.location = object.location ?? ""; + message.debugInfo = object.debugInfo ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseBigQueryJobStatus(): BigQueryJobStatus { + return { state: "", errorResult: "", errorMessage: "" }; +} + +export const BigQueryJobStatus = { + encode(message: BigQueryJobStatus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.state !== "") { + writer.uint32(10).string(message.state); + } + if (message.errorResult !== "") { + writer.uint32(18).string(message.errorResult); + } + if (message.errorMessage !== "") { + writer.uint32(26).string(message.errorMessage); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryJobStatus { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryJobStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.state = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.errorResult = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.errorMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryJobStatus { + return { + state: isSet(object.state) ? gt.String(object.state) : "", + errorResult: isSet(object.errorResult) ? gt.String(object.errorResult) : "", + errorMessage: isSet(object.errorMessage) ? gt.String(object.errorMessage) : "", + }; + }, + + toJSON(message: BigQueryJobStatus): unknown { + const obj: any = {}; + if (message.state !== "") { + obj.state = message.state; + } + if (message.errorResult !== "") { + obj.errorResult = message.errorResult; + } + if (message.errorMessage !== "") { + obj.errorMessage = message.errorMessage; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryJobStatus>, I>>(base?: I): BigQueryJobStatus { + return BigQueryJobStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryJobStatus>, I>>(object: I): BigQueryJobStatus { + const message = createBaseBigQueryJobStatus(); + message.state = object.state ?? ""; + message.errorResult = object.errorResult ?? ""; + message.errorMessage = object.errorMessage ?? ""; + return message; + }, +}; + +function createBaseBigQueryJob(): BigQueryJob { + return { kind: "", id: "", selfLink: "", userEmail: "", jobReference: undefined, status: undefined }; +} + +export const BigQueryJob = { + encode(message: BigQueryJob, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.selfLink !== "") { + writer.uint32(26).string(message.selfLink); + } + if (message.userEmail !== "") { + writer.uint32(34).string(message.userEmail); + } + if (message.jobReference !== undefined) { + BigQueryJobReference.encode(message.jobReference, writer.uint32(42).fork()).ldelim(); + } + if (message.status !== undefined) { + BigQueryJobStatus.encode(message.status, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryJob { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryJob(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.selfLink = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.userEmail = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.jobReference = BigQueryJobReference.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.status = BigQueryJobStatus.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryJob { + return { + kind: isSet(object.kind) ? gt.String(object.kind) : "", + id: isSet(object.id) ? gt.String(object.id) : "", + selfLink: isSet(object.selfLink) ? gt.String(object.selfLink) : "", + userEmail: isSet(object.userEmail) ? gt.String(object.userEmail) : "", + jobReference: isSet(object.jobReference) ? BigQueryJobReference.fromJSON(object.jobReference) : undefined, + status: isSet(object.status) ? BigQueryJobStatus.fromJSON(object.status) : undefined, + }; + }, + + toJSON(message: BigQueryJob): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.selfLink !== "") { + obj.selfLink = message.selfLink; + } + if (message.userEmail !== "") { + obj.userEmail = message.userEmail; + } + if (message.jobReference !== undefined) { + obj.jobReference = BigQueryJobReference.toJSON(message.jobReference); + } + if (message.status !== undefined) { + obj.status = BigQueryJobStatus.toJSON(message.status); + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryJob>, I>>(base?: I): BigQueryJob { + return BigQueryJob.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryJob>, I>>(object: I): BigQueryJob { + const message = createBaseBigQueryJob(); + message.kind = object.kind ?? ""; + message.id = object.id ?? ""; + message.selfLink = object.selfLink ?? ""; + message.userEmail = object.userEmail ?? ""; + message.jobReference = (object.jobReference !== undefined && object.jobReference !== null) + ? BigQueryJobReference.fromPartial(object.jobReference) + : undefined; + message.status = (object.status !== undefined && object.status !== null) + ? BigQueryJobStatus.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseBigQueryFieldValue(): BigQueryFieldValue { + return { f: "", v: "" }; +} + +export const BigQueryFieldValue = { + encode(message: BigQueryFieldValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.f !== "") { + writer.uint32(10).string(message.f); + } + if (message.v !== "") { + writer.uint32(18).string(message.v); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryFieldValue { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryFieldValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.f = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.v = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryFieldValue { + return { f: isSet(object.f) ? gt.String(object.f) : "", v: isSet(object.v) ? gt.String(object.v) : "" }; + }, + + toJSON(message: BigQueryFieldValue): unknown { + const obj: any = {}; + if (message.f !== "") { + obj.f = message.f; + } + if (message.v !== "") { + obj.v = message.v; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryFieldValue>, I>>(base?: I): BigQueryFieldValue { + return BigQueryFieldValue.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryFieldValue>, I>>(object: I): BigQueryFieldValue { + const message = createBaseBigQueryFieldValue(); + message.f = object.f ?? ""; + message.v = object.v ?? ""; + return message; + }, +}; + +function createBaseBigQueryTableRow(): BigQueryTableRow { + return { f: [] }; +} + +export const BigQueryTableRow = { + encode(message: BigQueryTableRow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.f) { + BigQueryFieldValue.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryTableRow { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryTableRow(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.f.push(BigQueryFieldValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryTableRow { + return { f: gt.Array.isArray(object?.f) ? object.f.map((e: any) => BigQueryFieldValue.fromJSON(e)) : [] }; + }, + + toJSON(message: BigQueryTableRow): unknown { + const obj: any = {}; + if (message.f?.length) { + obj.f = message.f.map((e) => BigQueryFieldValue.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryTableRow>, I>>(base?: I): BigQueryTableRow { + return BigQueryTableRow.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryTableRow>, I>>(object: I): BigQueryTableRow { + const message = createBaseBigQueryTableRow(); + message.f = object.f?.map((e) => BigQueryFieldValue.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBigQueryJobResults(): BigQueryJobResults { + return { + kind: "", + schema: undefined, + jobReference: undefined, + totalRows: "", + pageToken: "", + rows: [], + jobComplete: "", + errors: [], + cacheHit: "", + numDmlAffectedRows: "", + }; +} + +export const BigQueryJobResults = { + encode(message: BigQueryJobResults, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.schema !== undefined) { + BigQueryTableSchema.encode(message.schema, writer.uint32(18).fork()).ldelim(); + } + if (message.jobReference !== undefined) { + BigQueryJobReference.encode(message.jobReference, writer.uint32(26).fork()).ldelim(); + } + if (message.totalRows !== "") { + writer.uint32(34).string(message.totalRows); + } + if (message.pageToken !== "") { + writer.uint32(42).string(message.pageToken); + } + for (const v of message.rows) { + BigQueryTableRow.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.jobComplete !== "") { + writer.uint32(58).string(message.jobComplete); + } + for (const v of message.errors) { + BigQueryError.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.cacheHit !== "") { + writer.uint32(74).string(message.cacheHit); + } + if (message.numDmlAffectedRows !== "") { + writer.uint32(82).string(message.numDmlAffectedRows); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryJobResults { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryJobResults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.schema = BigQueryTableSchema.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.jobReference = BigQueryJobReference.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.totalRows = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.pageToken = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rows.push(BigQueryTableRow.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.jobComplete = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.errors.push(BigQueryError.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.cacheHit = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.numDmlAffectedRows = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryJobResults { + return { + kind: isSet(object.kind) ? gt.String(object.kind) : "", + schema: isSet(object.schema) ? BigQueryTableSchema.fromJSON(object.schema) : undefined, + jobReference: isSet(object.jobReference) ? BigQueryJobReference.fromJSON(object.jobReference) : undefined, + totalRows: isSet(object.totalRows) ? gt.String(object.totalRows) : "", + pageToken: isSet(object.pageToken) ? gt.String(object.pageToken) : "", + rows: gt.Array.isArray(object?.rows) ? object.rows.map((e: any) => BigQueryTableRow.fromJSON(e)) : [], + jobComplete: isSet(object.jobComplete) ? gt.String(object.jobComplete) : "", + errors: gt.Array.isArray(object?.errors) ? object.errors.map((e: any) => BigQueryError.fromJSON(e)) : [], + cacheHit: isSet(object.cacheHit) ? gt.String(object.cacheHit) : "", + numDmlAffectedRows: isSet(object.numDmlAffectedRows) ? gt.String(object.numDmlAffectedRows) : "", + }; + }, + + toJSON(message: BigQueryJobResults): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.schema !== undefined) { + obj.schema = BigQueryTableSchema.toJSON(message.schema); + } + if (message.jobReference !== undefined) { + obj.jobReference = BigQueryJobReference.toJSON(message.jobReference); + } + if (message.totalRows !== "") { + obj.totalRows = message.totalRows; + } + if (message.pageToken !== "") { + obj.pageToken = message.pageToken; + } + if (message.rows?.length) { + obj.rows = message.rows.map((e) => BigQueryTableRow.toJSON(e)); + } + if (message.jobComplete !== "") { + obj.jobComplete = message.jobComplete; + } + if (message.errors?.length) { + obj.errors = message.errors.map((e) => BigQueryError.toJSON(e)); + } + if (message.cacheHit !== "") { + obj.cacheHit = message.cacheHit; + } + if (message.numDmlAffectedRows !== "") { + obj.numDmlAffectedRows = message.numDmlAffectedRows; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryJobResults>, I>>(base?: I): BigQueryJobResults { + return BigQueryJobResults.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryJobResults>, I>>(object: I): BigQueryJobResults { + const message = createBaseBigQueryJobResults(); + message.kind = object.kind ?? ""; + message.schema = (object.schema !== undefined && object.schema !== null) + ? BigQueryTableSchema.fromPartial(object.schema) + : undefined; + message.jobReference = (object.jobReference !== undefined && object.jobReference !== null) + ? BigQueryJobReference.fromPartial(object.jobReference) + : undefined; + message.totalRows = object.totalRows ?? ""; + message.pageToken = object.pageToken ?? ""; + message.rows = object.rows?.map((e) => BigQueryTableRow.fromPartial(e)) || []; + message.jobComplete = object.jobComplete ?? ""; + message.errors = object.errors?.map((e) => BigQueryError.fromPartial(e)) || []; + message.cacheHit = object.cacheHit ?? ""; + message.numDmlAffectedRows = object.numDmlAffectedRows ?? ""; + return message; + }, +}; + +function createBaseBigQueryOauthToken(): BigQueryOauthToken { + return { accessToken: "", refreshToken: "", expiryTime: "" }; +} + +export const BigQueryOauthToken = { + encode(message: BigQueryOauthToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.refreshToken !== "") { + writer.uint32(18).string(message.refreshToken); + } + if (message.expiryTime !== "") { + writer.uint32(26).string(message.expiryTime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryOauthToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryOauthToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessToken = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.refreshToken = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.expiryTime = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryOauthToken { + return { + accessToken: isSet(object.accessToken) ? gt.String(object.accessToken) : "", + refreshToken: isSet(object.refreshToken) ? gt.String(object.refreshToken) : "", + expiryTime: isSet(object.expiryTime) ? gt.String(object.expiryTime) : "", + }; + }, + + toJSON(message: BigQueryOauthToken): unknown { + const obj: any = {}; + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.refreshToken !== "") { + obj.refreshToken = message.refreshToken; + } + if (message.expiryTime !== "") { + obj.expiryTime = message.expiryTime; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryOauthToken>, I>>(base?: I): BigQueryOauthToken { + return BigQueryOauthToken.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryOauthToken>, I>>(object: I): BigQueryOauthToken { + const message = createBaseBigQueryOauthToken(); + message.accessToken = object.accessToken ?? ""; + message.refreshToken = object.refreshToken ?? ""; + message.expiryTime = object.expiryTime ?? ""; + return message; + }, +}; + +function createBaseBigQueryOauthTokenRefresh(): BigQueryOauthTokenRefresh { + return { accessToken: "", expiryTime: "" }; +} + +export const BigQueryOauthTokenRefresh = { + encode(message: BigQueryOauthTokenRefresh, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.expiryTime !== "") { + writer.uint32(18).string(message.expiryTime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BigQueryOauthTokenRefresh { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBigQueryOauthTokenRefresh(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessToken = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiryTime = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): BigQueryOauthTokenRefresh { + return { + accessToken: isSet(object.accessToken) ? gt.String(object.accessToken) : "", + expiryTime: isSet(object.expiryTime) ? gt.String(object.expiryTime) : "", + }; + }, + + toJSON(message: BigQueryOauthTokenRefresh): unknown { + const obj: any = {}; + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.expiryTime !== "") { + obj.expiryTime = message.expiryTime; + } + return obj; + }, + + create<I extends Exact<DeepPartial<BigQueryOauthTokenRefresh>, I>>(base?: I): BigQueryOauthTokenRefresh { + return BigQueryOauthTokenRefresh.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<BigQueryOauthTokenRefresh>, I>>(object: I): BigQueryOauthTokenRefresh { + const message = createBaseBigQueryOauthTokenRefresh(); + message.accessToken = object.accessToken ?? ""; + message.expiryTime = object.expiryTime ?? ""; + return message; + }, +}; + +function createBaseSnowflakeOauthProxyRequest(): SnowflakeOauthProxyRequest { + return { accountUrl: "", clientId: "", clientSecret: "", role: "" }; +} + +export const SnowflakeOauthProxyRequest = { + encode(message: SnowflakeOauthProxyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accountUrl !== "") { + writer.uint32(10).string(message.accountUrl); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.clientSecret !== "") { + writer.uint32(26).string(message.clientSecret); + } + if (message.role !== "") { + writer.uint32(34).string(message.role); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnowflakeOauthProxyRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnowflakeOauthProxyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accountUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.clientId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.clientSecret = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.role = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnowflakeOauthProxyRequest { + return { + accountUrl: isSet(object.accountUrl) ? gt.String(object.accountUrl) : "", + clientId: isSet(object.clientId) ? gt.String(object.clientId) : "", + clientSecret: isSet(object.clientSecret) ? gt.String(object.clientSecret) : "", + role: isSet(object.role) ? gt.String(object.role) : "", + }; + }, + + toJSON(message: SnowflakeOauthProxyRequest): unknown { + const obj: any = {}; + if (message.accountUrl !== "") { + obj.accountUrl = message.accountUrl; + } + if (message.clientId !== "") { + obj.clientId = message.clientId; + } + if (message.clientSecret !== "") { + obj.clientSecret = message.clientSecret; + } + if (message.role !== "") { + obj.role = message.role; + } + return obj; + }, + + create<I extends Exact<DeepPartial<SnowflakeOauthProxyRequest>, I>>(base?: I): SnowflakeOauthProxyRequest { + return SnowflakeOauthProxyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<SnowflakeOauthProxyRequest>, I>>(object: I): SnowflakeOauthProxyRequest { + const message = createBaseSnowflakeOauthProxyRequest(); + message.accountUrl = object.accountUrl ?? ""; + message.clientId = object.clientId ?? ""; + message.clientSecret = object.clientSecret ?? ""; + message.role = object.role ?? ""; + return message; + }, +}; + +function createBaseSnowflakeOauthToken(): SnowflakeOauthToken { + return { accessToken: "", refreshToken: "", expiryTime: "" }; +} + +export const SnowflakeOauthToken = { + encode(message: SnowflakeOauthToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.refreshToken !== "") { + writer.uint32(18).string(message.refreshToken); + } + if (message.expiryTime !== "") { + writer.uint32(26).string(message.expiryTime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnowflakeOauthToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnowflakeOauthToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessToken = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.refreshToken = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.expiryTime = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnowflakeOauthToken { + return { + accessToken: isSet(object.accessToken) ? gt.String(object.accessToken) : "", + refreshToken: isSet(object.refreshToken) ? gt.String(object.refreshToken) : "", + expiryTime: isSet(object.expiryTime) ? gt.String(object.expiryTime) : "", + }; + }, + + toJSON(message: SnowflakeOauthToken): unknown { + const obj: any = {}; + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.refreshToken !== "") { + obj.refreshToken = message.refreshToken; + } + if (message.expiryTime !== "") { + obj.expiryTime = message.expiryTime; + } + return obj; + }, + + create<I extends Exact<DeepPartial<SnowflakeOauthToken>, I>>(base?: I): SnowflakeOauthToken { + return SnowflakeOauthToken.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<SnowflakeOauthToken>, I>>(object: I): SnowflakeOauthToken { + const message = createBaseSnowflakeOauthToken(); + message.accessToken = object.accessToken ?? ""; + message.refreshToken = object.refreshToken ?? ""; + message.expiryTime = object.expiryTime ?? ""; + return message; + }, +}; + +function createBaseSnowflakeOauthRefreshToken(): SnowflakeOauthRefreshToken { + return { accessToken: "", expiryTime: "" }; +} + +export const SnowflakeOauthRefreshToken = { + encode(message: SnowflakeOauthRefreshToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.expiryTime !== "") { + writer.uint32(26).string(message.expiryTime); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SnowflakeOauthRefreshToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnowflakeOauthRefreshToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessToken = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.expiryTime = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnowflakeOauthRefreshToken { + return { + accessToken: isSet(object.accessToken) ? gt.String(object.accessToken) : "", + expiryTime: isSet(object.expiryTime) ? gt.String(object.expiryTime) : "", + }; + }, + + toJSON(message: SnowflakeOauthRefreshToken): unknown { + const obj: any = {}; + if (message.accessToken !== "") { + obj.accessToken = message.accessToken; + } + if (message.expiryTime !== "") { + obj.expiryTime = message.expiryTime; + } + return obj; + }, + + create<I extends Exact<DeepPartial<SnowflakeOauthRefreshToken>, I>>(base?: I): SnowflakeOauthRefreshToken { + return SnowflakeOauthRefreshToken.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<SnowflakeOauthRefreshToken>, I>>(object: I): SnowflakeOauthRefreshToken { + const message = createBaseSnowflakeOauthRefreshToken(); + message.accessToken = object.accessToken ?? ""; + message.expiryTime = object.expiryTime ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/file.ts b/js/packages/proto/src/generated/quary/service/v1/file.ts new file mode 100644 index 00000000..3a32a01d --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/file.ts @@ -0,0 +1,316 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/file.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface File { + /** The name of the file. Names are relative to the root of the file system. */ + name: string; + contents: Uint8Array; +} + +export interface FileSystem { + files: { [key: string]: File }; +} + +export interface FileSystem_FilesEntry { + key: string; + value: File | undefined; +} + +function createBaseFile(): File { + return { name: "", contents: new Uint8Array(0) }; +} + +export const File = { + encode(message: File, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.contents.length !== 0) { + writer.uint32(18).bytes(message.contents); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): File { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contents = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): File { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + contents: isSet(object.contents) ? bytesFromBase64(object.contents) : new Uint8Array(0), + }; + }, + + toJSON(message: File): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.contents.length !== 0) { + obj.contents = base64FromBytes(message.contents); + } + return obj; + }, + + create<I extends Exact<DeepPartial<File>, I>>(base?: I): File { + return File.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<File>, I>>(object: I): File { + const message = createBaseFile(); + message.name = object.name ?? ""; + message.contents = object.contents ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseFileSystem(): FileSystem { + return { files: {} }; +} + +export const FileSystem = { + encode(message: FileSystem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.files).forEach(([key, value]) => { + FileSystem_FilesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileSystem { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileSystem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = FileSystem_FilesEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.files[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileSystem { + return { + files: isObject(object.files) + ? Object.entries(object.files).reduce<{ [key: string]: File }>((acc, [key, value]) => { + acc[key] = File.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: FileSystem): unknown { + const obj: any = {}; + if (message.files) { + const entries = Object.entries(message.files); + if (entries.length > 0) { + obj.files = {}; + entries.forEach(([k, v]) => { + obj.files[k] = File.toJSON(v); + }); + } + } + return obj; + }, + + create<I extends Exact<DeepPartial<FileSystem>, I>>(base?: I): FileSystem { + return FileSystem.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<FileSystem>, I>>(object: I): FileSystem { + const message = createBaseFileSystem(); + message.files = Object.entries(object.files ?? {}).reduce<{ [key: string]: File }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = File.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseFileSystem_FilesEntry(): FileSystem_FilesEntry { + return { key: "", value: undefined }; +} + +export const FileSystem_FilesEntry = { + encode(message: FileSystem_FilesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + File.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileSystem_FilesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileSystem_FilesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = File.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileSystem_FilesEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? File.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: FileSystem_FilesEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = File.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<FileSystem_FilesEntry>, I>>(base?: I): FileSystem_FilesEntry { + return FileSystem_FilesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<FileSystem_FilesEntry>, I>>(object: I): FileSystem_FilesEntry { + const message = createBaseFileSystem_FilesEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? File.fromPartial(object.value) : undefined; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if ((gt as any).Buffer) { + return Uint8Array.from(gt.Buffer.from(b64, "base64")); + } else { + const bin = gt.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((gt as any).Buffer) { + return gt.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(gt.String.fromCharCode(byte)); + }); + return gt.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/position.ts b/js/packages/proto/src/generated/quary/service/v1/position.ts new file mode 100644 index 00000000..66608f53 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/position.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/position.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +/** Position is a simple representation of a line and character position in a file. */ +export interface Position { + line: number; + character: number; +} + +function createBasePosition(): Position { + return { line: 0, character: 0 }; +} + +export const Position = { + encode(message: Position, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.line !== 0) { + writer.uint32(8).uint32(message.line); + } + if (message.character !== 0) { + writer.uint32(16).uint32(message.character); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Position { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePosition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.line = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.character = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Position { + return { + line: isSet(object.line) ? gt.Number(object.line) : 0, + character: isSet(object.character) ? gt.Number(object.character) : 0, + }; + }, + + toJSON(message: Position): unknown { + const obj: any = {}; + if (message.line !== 0) { + obj.line = Math.round(message.line); + } + if (message.character !== 0) { + obj.character = Math.round(message.character); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Position>, I>>(base?: I): Position { + return Position.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Position>, I>>(object: I): Position { + const message = createBasePosition(); + message.line = object.line ?? 0; + message.character = object.character ?? 0; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/project.ts b/js/packages/proto/src/generated/quary/service/v1/project.ts new file mode 100644 index 00000000..a23fa442 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/project.ts @@ -0,0 +1,938 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/project.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Chart } from "./chart"; +import { ConnectionConfig } from "./connection_config"; +import { ProjectFile } from "./project_file"; +import { Model, Seed, Snapshot, Source, Test } from "./types"; + +export const protobufPackage = "quary.service.v1"; + +export interface Project { + seeds: { [key: string]: Seed }; + models: { [key: string]: Model }; + tests: { [key: string]: Test }; + sources: { [key: string]: Source }; + snapshots: { [key: string]: Snapshot }; + charts: { [key: string]: Chart }; + projectFiles: { [key: string]: ProjectFile }; + connectionConfig: ConnectionConfig | undefined; +} + +export interface Project_SeedsEntry { + key: string; + value: Seed | undefined; +} + +export interface Project_ModelsEntry { + key: string; + value: Model | undefined; +} + +export interface Project_TestsEntry { + key: string; + value: Test | undefined; +} + +export interface Project_SourcesEntry { + key: string; + value: Source | undefined; +} + +export interface Project_SnapshotsEntry { + key: string; + value: Snapshot | undefined; +} + +export interface Project_ChartsEntry { + key: string; + value: Chart | undefined; +} + +export interface Project_ProjectFilesEntry { + key: string; + value: ProjectFile | undefined; +} + +function createBaseProject(): Project { + return { + seeds: {}, + models: {}, + tests: {}, + sources: {}, + snapshots: {}, + charts: {}, + projectFiles: {}, + connectionConfig: undefined, + }; +} + +export const Project = { + encode(message: Project, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.seeds).forEach(([key, value]) => { + Project_SeedsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim(); + }); + Object.entries(message.models).forEach(([key, value]) => { + Project_ModelsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).ldelim(); + }); + Object.entries(message.tests).forEach(([key, value]) => { + Project_TestsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).ldelim(); + }); + Object.entries(message.sources).forEach(([key, value]) => { + Project_SourcesEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).ldelim(); + }); + Object.entries(message.snapshots).forEach(([key, value]) => { + Project_SnapshotsEntry.encode({ key: key as any, value }, writer.uint32(74).fork()).ldelim(); + }); + Object.entries(message.charts).forEach(([key, value]) => { + Project_ChartsEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).ldelim(); + }); + Object.entries(message.projectFiles).forEach(([key, value]) => { + Project_ProjectFilesEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).ldelim(); + }); + if (message.connectionConfig !== undefined) { + ConnectionConfig.encode(message.connectionConfig, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + const entry3 = Project_SeedsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.seeds[entry3.key] = entry3.value; + } + continue; + case 4: + if (tag !== 34) { + break; + } + + const entry4 = Project_ModelsEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.models[entry4.key] = entry4.value; + } + continue; + case 5: + if (tag !== 42) { + break; + } + + const entry5 = Project_TestsEntry.decode(reader, reader.uint32()); + if (entry5.value !== undefined) { + message.tests[entry5.key] = entry5.value; + } + continue; + case 6: + if (tag !== 50) { + break; + } + + const entry6 = Project_SourcesEntry.decode(reader, reader.uint32()); + if (entry6.value !== undefined) { + message.sources[entry6.key] = entry6.value; + } + continue; + case 9: + if (tag !== 74) { + break; + } + + const entry9 = Project_SnapshotsEntry.decode(reader, reader.uint32()); + if (entry9.value !== undefined) { + message.snapshots[entry9.key] = entry9.value; + } + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = Project_ChartsEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.charts[entry10.key] = entry10.value; + } + continue; + case 7: + if (tag !== 58) { + break; + } + + const entry7 = Project_ProjectFilesEntry.decode(reader, reader.uint32()); + if (entry7.value !== undefined) { + message.projectFiles[entry7.key] = entry7.value; + } + continue; + case 8: + if (tag !== 66) { + break; + } + + message.connectionConfig = ConnectionConfig.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project { + return { + seeds: isObject(object.seeds) + ? Object.entries(object.seeds).reduce<{ [key: string]: Seed }>((acc, [key, value]) => { + acc[key] = Seed.fromJSON(value); + return acc; + }, {}) + : {}, + models: isObject(object.models) + ? Object.entries(object.models).reduce<{ [key: string]: Model }>((acc, [key, value]) => { + acc[key] = Model.fromJSON(value); + return acc; + }, {}) + : {}, + tests: isObject(object.tests) + ? Object.entries(object.tests).reduce<{ [key: string]: Test }>((acc, [key, value]) => { + acc[key] = Test.fromJSON(value); + return acc; + }, {}) + : {}, + sources: isObject(object.sources) + ? Object.entries(object.sources).reduce<{ [key: string]: Source }>((acc, [key, value]) => { + acc[key] = Source.fromJSON(value); + return acc; + }, {}) + : {}, + snapshots: isObject(object.snapshots) + ? Object.entries(object.snapshots).reduce<{ [key: string]: Snapshot }>((acc, [key, value]) => { + acc[key] = Snapshot.fromJSON(value); + return acc; + }, {}) + : {}, + charts: isObject(object.charts) + ? Object.entries(object.charts).reduce<{ [key: string]: Chart }>((acc, [key, value]) => { + acc[key] = Chart.fromJSON(value); + return acc; + }, {}) + : {}, + projectFiles: isObject(object.projectFiles) + ? Object.entries(object.projectFiles).reduce<{ [key: string]: ProjectFile }>((acc, [key, value]) => { + acc[key] = ProjectFile.fromJSON(value); + return acc; + }, {}) + : {}, + connectionConfig: isSet(object.connectionConfig) ? ConnectionConfig.fromJSON(object.connectionConfig) : undefined, + }; + }, + + toJSON(message: Project): unknown { + const obj: any = {}; + if (message.seeds) { + const entries = Object.entries(message.seeds); + if (entries.length > 0) { + obj.seeds = {}; + entries.forEach(([k, v]) => { + obj.seeds[k] = Seed.toJSON(v); + }); + } + } + if (message.models) { + const entries = Object.entries(message.models); + if (entries.length > 0) { + obj.models = {}; + entries.forEach(([k, v]) => { + obj.models[k] = Model.toJSON(v); + }); + } + } + if (message.tests) { + const entries = Object.entries(message.tests); + if (entries.length > 0) { + obj.tests = {}; + entries.forEach(([k, v]) => { + obj.tests[k] = Test.toJSON(v); + }); + } + } + if (message.sources) { + const entries = Object.entries(message.sources); + if (entries.length > 0) { + obj.sources = {}; + entries.forEach(([k, v]) => { + obj.sources[k] = Source.toJSON(v); + }); + } + } + if (message.snapshots) { + const entries = Object.entries(message.snapshots); + if (entries.length > 0) { + obj.snapshots = {}; + entries.forEach(([k, v]) => { + obj.snapshots[k] = Snapshot.toJSON(v); + }); + } + } + if (message.charts) { + const entries = Object.entries(message.charts); + if (entries.length > 0) { + obj.charts = {}; + entries.forEach(([k, v]) => { + obj.charts[k] = Chart.toJSON(v); + }); + } + } + if (message.projectFiles) { + const entries = Object.entries(message.projectFiles); + if (entries.length > 0) { + obj.projectFiles = {}; + entries.forEach(([k, v]) => { + obj.projectFiles[k] = ProjectFile.toJSON(v); + }); + } + } + if (message.connectionConfig !== undefined) { + obj.connectionConfig = ConnectionConfig.toJSON(message.connectionConfig); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project>, I>>(base?: I): Project { + return Project.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project>, I>>(object: I): Project { + const message = createBaseProject(); + message.seeds = Object.entries(object.seeds ?? {}).reduce<{ [key: string]: Seed }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Seed.fromPartial(value); + } + return acc; + }, {}); + message.models = Object.entries(object.models ?? {}).reduce<{ [key: string]: Model }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Model.fromPartial(value); + } + return acc; + }, {}); + message.tests = Object.entries(object.tests ?? {}).reduce<{ [key: string]: Test }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Test.fromPartial(value); + } + return acc; + }, {}); + message.sources = Object.entries(object.sources ?? {}).reduce<{ [key: string]: Source }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Source.fromPartial(value); + } + return acc; + }, {}); + message.snapshots = Object.entries(object.snapshots ?? {}).reduce<{ [key: string]: Snapshot }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Snapshot.fromPartial(value); + } + return acc; + }, + {}, + ); + message.charts = Object.entries(object.charts ?? {}).reduce<{ [key: string]: Chart }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Chart.fromPartial(value); + } + return acc; + }, {}); + message.projectFiles = Object.entries(object.projectFiles ?? {}).reduce<{ [key: string]: ProjectFile }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ProjectFile.fromPartial(value); + } + return acc; + }, + {}, + ); + message.connectionConfig = (object.connectionConfig !== undefined && object.connectionConfig !== null) + ? ConnectionConfig.fromPartial(object.connectionConfig) + : undefined; + return message; + }, +}; + +function createBaseProject_SeedsEntry(): Project_SeedsEntry { + return { key: "", value: undefined }; +} + +export const Project_SeedsEntry = { + encode(message: Project_SeedsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Seed.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_SeedsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_SeedsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Seed.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_SeedsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Seed.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_SeedsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Seed.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_SeedsEntry>, I>>(base?: I): Project_SeedsEntry { + return Project_SeedsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_SeedsEntry>, I>>(object: I): Project_SeedsEntry { + const message = createBaseProject_SeedsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Seed.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseProject_ModelsEntry(): Project_ModelsEntry { + return { key: "", value: undefined }; +} + +export const Project_ModelsEntry = { + encode(message: Project_ModelsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Model.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_ModelsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_ModelsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Model.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_ModelsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Model.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_ModelsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Model.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_ModelsEntry>, I>>(base?: I): Project_ModelsEntry { + return Project_ModelsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_ModelsEntry>, I>>(object: I): Project_ModelsEntry { + const message = createBaseProject_ModelsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Model.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseProject_TestsEntry(): Project_TestsEntry { + return { key: "", value: undefined }; +} + +export const Project_TestsEntry = { + encode(message: Project_TestsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Test.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_TestsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_TestsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Test.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_TestsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Test.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_TestsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Test.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_TestsEntry>, I>>(base?: I): Project_TestsEntry { + return Project_TestsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_TestsEntry>, I>>(object: I): Project_TestsEntry { + const message = createBaseProject_TestsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Test.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseProject_SourcesEntry(): Project_SourcesEntry { + return { key: "", value: undefined }; +} + +export const Project_SourcesEntry = { + encode(message: Project_SourcesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Source.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_SourcesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_SourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Source.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_SourcesEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Source.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_SourcesEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Source.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_SourcesEntry>, I>>(base?: I): Project_SourcesEntry { + return Project_SourcesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_SourcesEntry>, I>>(object: I): Project_SourcesEntry { + const message = createBaseProject_SourcesEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Source.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseProject_SnapshotsEntry(): Project_SnapshotsEntry { + return { key: "", value: undefined }; +} + +export const Project_SnapshotsEntry = { + encode(message: Project_SnapshotsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Snapshot.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_SnapshotsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_SnapshotsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Snapshot.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_SnapshotsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Snapshot.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_SnapshotsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Snapshot.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_SnapshotsEntry>, I>>(base?: I): Project_SnapshotsEntry { + return Project_SnapshotsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_SnapshotsEntry>, I>>(object: I): Project_SnapshotsEntry { + const message = createBaseProject_SnapshotsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Snapshot.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseProject_ChartsEntry(): Project_ChartsEntry { + return { key: "", value: undefined }; +} + +export const Project_ChartsEntry = { + encode(message: Project_ChartsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Chart.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_ChartsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_ChartsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Chart.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_ChartsEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? Chart.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_ChartsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Chart.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_ChartsEntry>, I>>(base?: I): Project_ChartsEntry { + return Project_ChartsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_ChartsEntry>, I>>(object: I): Project_ChartsEntry { + const message = createBaseProject_ChartsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Chart.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseProject_ProjectFilesEntry(): Project_ProjectFilesEntry { + return { key: "", value: undefined }; +} + +export const Project_ProjectFilesEntry = { + encode(message: Project_ProjectFilesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ProjectFile.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Project_ProjectFilesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProject_ProjectFilesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ProjectFile.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Project_ProjectFilesEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? ProjectFile.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Project_ProjectFilesEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = ProjectFile.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Project_ProjectFilesEntry>, I>>(base?: I): Project_ProjectFilesEntry { + return Project_ProjectFilesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Project_ProjectFilesEntry>, I>>(object: I): Project_ProjectFilesEntry { + const message = createBaseProject_ProjectFilesEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? ProjectFile.fromPartial(object.value) + : undefined; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/project_dag.ts b/js/packages/proto/src/generated/quary/service/v1/project_dag.ts new file mode 100644 index 00000000..b1a3362c --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/project_dag.ts @@ -0,0 +1,284 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/project_dag.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +/** + * DirectedAcyclicGraph represents a directed acyclic graph that is used to visualize the project dependencies in a + * project. + */ +export interface ProjectDag { + nodes: Node[]; + edges: Edge[]; +} + +export interface Node { + id: string; + isCached: boolean; +} + +export interface Edge { + to: string; + from: string; +} + +function createBaseProjectDag(): ProjectDag { + return { nodes: [], edges: [] }; +} + +export const ProjectDag = { + encode(message: ProjectDag, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.nodes) { + Node.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.edges) { + Edge.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectDag { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectDag(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.nodes.push(Node.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.edges.push(Edge.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectDag { + return { + nodes: gt.Array.isArray(object?.nodes) ? object.nodes.map((e: any) => Node.fromJSON(e)) : [], + edges: gt.Array.isArray(object?.edges) ? object.edges.map((e: any) => Edge.fromJSON(e)) : [], + }; + }, + + toJSON(message: ProjectDag): unknown { + const obj: any = {}; + if (message.nodes?.length) { + obj.nodes = message.nodes.map((e) => Node.toJSON(e)); + } + if (message.edges?.length) { + obj.edges = message.edges.map((e) => Edge.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectDag>, I>>(base?: I): ProjectDag { + return ProjectDag.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectDag>, I>>(object: I): ProjectDag { + const message = createBaseProjectDag(); + message.nodes = object.nodes?.map((e) => Node.fromPartial(e)) || []; + message.edges = object.edges?.map((e) => Edge.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseNode(): Node { + return { id: "", isCached: false }; +} + +export const Node = { + encode(message: Node, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.isCached !== false) { + writer.uint32(16).bool(message.isCached); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Node { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isCached = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Node { + return { + id: isSet(object.id) ? gt.String(object.id) : "", + isCached: isSet(object.isCached) ? gt.Boolean(object.isCached) : false, + }; + }, + + toJSON(message: Node): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.isCached !== false) { + obj.isCached = message.isCached; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Node>, I>>(base?: I): Node { + return Node.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Node>, I>>(object: I): Node { + const message = createBaseNode(); + message.id = object.id ?? ""; + message.isCached = object.isCached ?? false; + return message; + }, +}; + +function createBaseEdge(): Edge { + return { to: "", from: "" }; +} + +export const Edge = { + encode(message: Edge, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.to !== "") { + writer.uint32(10).string(message.to); + } + if (message.from !== "") { + writer.uint32(18).string(message.from); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Edge { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEdge(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.to = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.from = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Edge { + return { to: isSet(object.to) ? gt.String(object.to) : "", from: isSet(object.from) ? gt.String(object.from) : "" }; + }, + + toJSON(message: Edge): unknown { + const obj: any = {}; + if (message.to !== "") { + obj.to = message.to; + } + if (message.from !== "") { + obj.from = message.from; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Edge>, I>>(base?: I): Edge { + return Edge.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Edge>, I>>(object: I): Edge { + const message = createBaseEdge(); + message.to = object.to ?? ""; + message.from = object.from ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/project_file.ts b/js/packages/proto/src/generated/quary/service/v1/project_file.ts new file mode 100644 index 00000000..7437774a --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/project_file.ts @@ -0,0 +1,1181 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/project_file.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface ProjectFile { + sources: ProjectFileSource[]; + models: ProjectFile_Model[]; + snapshots: ProjectFile_Snapshot[]; +} + +export interface ProjectFile_Model { + name: string; + /** + * Tags are used to group different parts of the project together. For example, you could tag all models that are + * related to a specific department with the same tag. + */ + tags: string[]; + description?: + | string + | undefined; + /** The materialization of the model, available types are specified by each database. */ + materialization?: string | undefined; + tests: ModelTest[]; + columns: ProjectFileColumn[]; +} + +export interface ProjectFile_Snapshot { + name: string; + /** + * Tags are used to group different parts of the project together. For example, you could tag all models that are + * related to a specific department with the same tag. + */ + tags: string[]; + description?: string | undefined; + uniqueKey: string; + strategy: ProjectFile_SnapshotStrategy | undefined; +} + +export interface ProjectFile_SnapshotStrategy { + strategyType?: { $case: "timestamp"; timestamp: ProjectFile_TimestampStrategy } | undefined; +} + +export interface ProjectFile_TimestampStrategy { + updatedAt: string; +} + +export interface ProjectFileSource { + name: string; + /** + * Tags are used to group different parts of the project together. For example, you could tag all sources that are + * related to a specific department with the same tag. + */ + tags: string[]; + description?: + | string + | undefined; + /** + * The full path of the source table in the database. This is used to reference the table itself. For example: + * - 'public.users' for where the schema is 'public' and the table is 'users' + * - 'project_id_123.dataset_id_123.table_id_123' for a BigQuery table + */ + path: string; + tests: ModelTest[]; + columns: ProjectFileColumn[]; +} + +/** + * Standard types are: + * - not_null + * - unique + * - 'relationship' which takes into data (model and field) + */ +export interface ProjectFileColumn { + name: string; + description?: string | undefined; + tests: ColumnTest[]; +} + +export interface ColumnTest { + type: string; + info: { [key: string]: string }; +} + +export interface ColumnTest_InfoEntry { + key: string; + value: string; +} + +export interface ModelTest { + type: string; + info: { [key: string]: string }; +} + +export interface ModelTest_InfoEntry { + key: string; + value: string; +} + +function createBaseProjectFile(): ProjectFile { + return { sources: [], models: [], snapshots: [] }; +} + +export const ProjectFile = { + encode(message: ProjectFile, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sources) { + ProjectFileSource.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.models) { + ProjectFile_Model.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.snapshots) { + ProjectFile_Snapshot.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFile { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sources.push(ProjectFileSource.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.models.push(ProjectFile_Model.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.snapshots.push(ProjectFile_Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFile { + return { + sources: gt.Array.isArray(object?.sources) ? object.sources.map((e: any) => ProjectFileSource.fromJSON(e)) : [], + models: gt.Array.isArray(object?.models) ? object.models.map((e: any) => ProjectFile_Model.fromJSON(e)) : [], + snapshots: gt.Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => ProjectFile_Snapshot.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ProjectFile): unknown { + const obj: any = {}; + if (message.sources?.length) { + obj.sources = message.sources.map((e) => ProjectFileSource.toJSON(e)); + } + if (message.models?.length) { + obj.models = message.models.map((e) => ProjectFile_Model.toJSON(e)); + } + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => ProjectFile_Snapshot.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFile>, I>>(base?: I): ProjectFile { + return ProjectFile.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFile>, I>>(object: I): ProjectFile { + const message = createBaseProjectFile(); + message.sources = object.sources?.map((e) => ProjectFileSource.fromPartial(e)) || []; + message.models = object.models?.map((e) => ProjectFile_Model.fromPartial(e)) || []; + message.snapshots = object.snapshots?.map((e) => ProjectFile_Snapshot.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProjectFile_Model(): ProjectFile_Model { + return { name: "", tags: [], description: undefined, materialization: undefined, tests: [], columns: [] }; +} + +export const ProjectFile_Model = { + encode(message: ProjectFile_Model, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.tags) { + writer.uint32(50).string(v!); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + if (message.materialization !== undefined) { + writer.uint32(34).string(message.materialization); + } + for (const v of message.tests) { + ModelTest.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.columns) { + ProjectFileColumn.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFile_Model { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFile_Model(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tags.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.materialization = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tests.push(ModelTest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.columns.push(ProjectFileColumn.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFile_Model { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + description: isSet(object.description) ? gt.String(object.description) : undefined, + materialization: isSet(object.materialization) ? gt.String(object.materialization) : undefined, + tests: gt.Array.isArray(object?.tests) ? object.tests.map((e: any) => ModelTest.fromJSON(e)) : [], + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => ProjectFileColumn.fromJSON(e)) : [], + }; + }, + + toJSON(message: ProjectFile_Model): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.materialization !== undefined) { + obj.materialization = message.materialization; + } + if (message.tests?.length) { + obj.tests = message.tests.map((e) => ModelTest.toJSON(e)); + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => ProjectFileColumn.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFile_Model>, I>>(base?: I): ProjectFile_Model { + return ProjectFile_Model.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFile_Model>, I>>(object: I): ProjectFile_Model { + const message = createBaseProjectFile_Model(); + message.name = object.name ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.description = object.description ?? undefined; + message.materialization = object.materialization ?? undefined; + message.tests = object.tests?.map((e) => ModelTest.fromPartial(e)) || []; + message.columns = object.columns?.map((e) => ProjectFileColumn.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProjectFile_Snapshot(): ProjectFile_Snapshot { + return { name: "", tags: [], description: undefined, uniqueKey: "", strategy: undefined }; +} + +export const ProjectFile_Snapshot = { + encode(message: ProjectFile_Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.tags) { + writer.uint32(34).string(v!); + } + if (message.description !== undefined) { + writer.uint32(42).string(message.description); + } + if (message.uniqueKey !== "") { + writer.uint32(18).string(message.uniqueKey); + } + if (message.strategy !== undefined) { + ProjectFile_SnapshotStrategy.encode(message.strategy, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFile_Snapshot { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFile_Snapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.tags.push(reader.string()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.uniqueKey = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.strategy = ProjectFile_SnapshotStrategy.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFile_Snapshot { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + description: isSet(object.description) ? gt.String(object.description) : undefined, + uniqueKey: isSet(object.uniqueKey) ? gt.String(object.uniqueKey) : "", + strategy: isSet(object.strategy) ? ProjectFile_SnapshotStrategy.fromJSON(object.strategy) : undefined, + }; + }, + + toJSON(message: ProjectFile_Snapshot): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.uniqueKey !== "") { + obj.uniqueKey = message.uniqueKey; + } + if (message.strategy !== undefined) { + obj.strategy = ProjectFile_SnapshotStrategy.toJSON(message.strategy); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFile_Snapshot>, I>>(base?: I): ProjectFile_Snapshot { + return ProjectFile_Snapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFile_Snapshot>, I>>(object: I): ProjectFile_Snapshot { + const message = createBaseProjectFile_Snapshot(); + message.name = object.name ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.description = object.description ?? undefined; + message.uniqueKey = object.uniqueKey ?? ""; + message.strategy = (object.strategy !== undefined && object.strategy !== null) + ? ProjectFile_SnapshotStrategy.fromPartial(object.strategy) + : undefined; + return message; + }, +}; + +function createBaseProjectFile_SnapshotStrategy(): ProjectFile_SnapshotStrategy { + return { strategyType: undefined }; +} + +export const ProjectFile_SnapshotStrategy = { + encode(message: ProjectFile_SnapshotStrategy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.strategyType?.$case) { + case "timestamp": + ProjectFile_TimestampStrategy.encode(message.strategyType.timestamp, writer.uint32(10).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFile_SnapshotStrategy { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFile_SnapshotStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.strategyType = { + $case: "timestamp", + timestamp: ProjectFile_TimestampStrategy.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFile_SnapshotStrategy { + return { + strategyType: isSet(object.timestamp) + ? { $case: "timestamp", timestamp: ProjectFile_TimestampStrategy.fromJSON(object.timestamp) } + : undefined, + }; + }, + + toJSON(message: ProjectFile_SnapshotStrategy): unknown { + const obj: any = {}; + if (message.strategyType?.$case === "timestamp") { + obj.timestamp = ProjectFile_TimestampStrategy.toJSON(message.strategyType.timestamp); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFile_SnapshotStrategy>, I>>(base?: I): ProjectFile_SnapshotStrategy { + return ProjectFile_SnapshotStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFile_SnapshotStrategy>, I>>(object: I): ProjectFile_SnapshotStrategy { + const message = createBaseProjectFile_SnapshotStrategy(); + if ( + object.strategyType?.$case === "timestamp" && + object.strategyType?.timestamp !== undefined && + object.strategyType?.timestamp !== null + ) { + message.strategyType = { + $case: "timestamp", + timestamp: ProjectFile_TimestampStrategy.fromPartial(object.strategyType.timestamp), + }; + } + return message; + }, +}; + +function createBaseProjectFile_TimestampStrategy(): ProjectFile_TimestampStrategy { + return { updatedAt: "" }; +} + +export const ProjectFile_TimestampStrategy = { + encode(message: ProjectFile_TimestampStrategy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.updatedAt !== "") { + writer.uint32(10).string(message.updatedAt); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFile_TimestampStrategy { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFile_TimestampStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updatedAt = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFile_TimestampStrategy { + return { updatedAt: isSet(object.updatedAt) ? gt.String(object.updatedAt) : "" }; + }, + + toJSON(message: ProjectFile_TimestampStrategy): unknown { + const obj: any = {}; + if (message.updatedAt !== "") { + obj.updatedAt = message.updatedAt; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFile_TimestampStrategy>, I>>(base?: I): ProjectFile_TimestampStrategy { + return ProjectFile_TimestampStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFile_TimestampStrategy>, I>>( + object: I, + ): ProjectFile_TimestampStrategy { + const message = createBaseProjectFile_TimestampStrategy(); + message.updatedAt = object.updatedAt ?? ""; + return message; + }, +}; + +function createBaseProjectFileSource(): ProjectFileSource { + return { name: "", tags: [], description: undefined, path: "", tests: [], columns: [] }; +} + +export const ProjectFileSource = { + encode(message: ProjectFileSource, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.tags) { + writer.uint32(50).string(v!); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + for (const v of message.tests) { + ModelTest.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.columns) { + ProjectFileColumn.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFileSource { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFileSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tags.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tests.push(ModelTest.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columns.push(ProjectFileColumn.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFileSource { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + description: isSet(object.description) ? gt.String(object.description) : undefined, + path: isSet(object.path) ? gt.String(object.path) : "", + tests: gt.Array.isArray(object?.tests) ? object.tests.map((e: any) => ModelTest.fromJSON(e)) : [], + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => ProjectFileColumn.fromJSON(e)) : [], + }; + }, + + toJSON(message: ProjectFileSource): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.tests?.length) { + obj.tests = message.tests.map((e) => ModelTest.toJSON(e)); + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => ProjectFileColumn.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFileSource>, I>>(base?: I): ProjectFileSource { + return ProjectFileSource.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFileSource>, I>>(object: I): ProjectFileSource { + const message = createBaseProjectFileSource(); + message.name = object.name ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.description = object.description ?? undefined; + message.path = object.path ?? ""; + message.tests = object.tests?.map((e) => ModelTest.fromPartial(e)) || []; + message.columns = object.columns?.map((e) => ProjectFileColumn.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProjectFileColumn(): ProjectFileColumn { + return { name: "", description: undefined, tests: [] }; +} + +export const ProjectFileColumn = { + encode(message: ProjectFileColumn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tests) { + ColumnTest.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ProjectFileColumn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProjectFileColumn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tests.push(ColumnTest.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProjectFileColumn { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tests: gt.Array.isArray(object?.tests) ? object.tests.map((e: any) => ColumnTest.fromJSON(e)) : [], + }; + }, + + toJSON(message: ProjectFileColumn): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tests?.length) { + obj.tests = message.tests.map((e) => ColumnTest.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ProjectFileColumn>, I>>(base?: I): ProjectFileColumn { + return ProjectFileColumn.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ProjectFileColumn>, I>>(object: I): ProjectFileColumn { + const message = createBaseProjectFileColumn(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tests = object.tests?.map((e) => ColumnTest.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseColumnTest(): ColumnTest { + return { type: "", info: {} }; +} + +export const ColumnTest = { + encode(message: ColumnTest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + Object.entries(message.info).forEach(([key, value]) => { + ColumnTest_InfoEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ColumnTest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseColumnTest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + const entry2 = ColumnTest_InfoEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.info[entry2.key] = entry2.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ColumnTest { + return { + type: isSet(object.type) ? gt.String(object.type) : "", + info: isObject(object.info) + ? Object.entries(object.info).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: ColumnTest): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.info) { + const entries = Object.entries(message.info); + if (entries.length > 0) { + obj.info = {}; + entries.forEach(([k, v]) => { + obj.info[k] = v; + }); + } + } + return obj; + }, + + create<I extends Exact<DeepPartial<ColumnTest>, I>>(base?: I): ColumnTest { + return ColumnTest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ColumnTest>, I>>(object: I): ColumnTest { + const message = createBaseColumnTest(); + message.type = object.type ?? ""; + message.info = Object.entries(object.info ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = gt.String(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseColumnTest_InfoEntry(): ColumnTest_InfoEntry { + return { key: "", value: "" }; +} + +export const ColumnTest_InfoEntry = { + encode(message: ColumnTest_InfoEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ColumnTest_InfoEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseColumnTest_InfoEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ColumnTest_InfoEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: ColumnTest_InfoEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ColumnTest_InfoEntry>, I>>(base?: I): ColumnTest_InfoEntry { + return ColumnTest_InfoEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ColumnTest_InfoEntry>, I>>(object: I): ColumnTest_InfoEntry { + const message = createBaseColumnTest_InfoEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseModelTest(): ModelTest { + return { type: "", info: {} }; +} + +export const ModelTest = { + encode(message: ModelTest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + Object.entries(message.info).forEach(([key, value]) => { + ModelTest_InfoEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModelTest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModelTest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + const entry2 = ModelTest_InfoEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.info[entry2.key] = entry2.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModelTest { + return { + type: isSet(object.type) ? gt.String(object.type) : "", + info: isObject(object.info) + ? Object.entries(object.info).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: ModelTest): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.info) { + const entries = Object.entries(message.info); + if (entries.length > 0) { + obj.info = {}; + entries.forEach(([k, v]) => { + obj.info[k] = v; + }); + } + } + return obj; + }, + + create<I extends Exact<DeepPartial<ModelTest>, I>>(base?: I): ModelTest { + return ModelTest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ModelTest>, I>>(object: I): ModelTest { + const message = createBaseModelTest(); + message.type = object.type ?? ""; + message.info = Object.entries(object.info ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = gt.String(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseModelTest_InfoEntry(): ModelTest_InfoEntry { + return { key: "", value: "" }; +} + +export const ModelTest_InfoEntry = { + encode(message: ModelTest_InfoEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ModelTest_InfoEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModelTest_InfoEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModelTest_InfoEntry { + return { + key: isSet(object.key) ? gt.String(object.key) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: ModelTest_InfoEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ModelTest_InfoEntry>, I>>(base?: I): ModelTest_InfoEntry { + return ModelTest_InfoEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ModelTest_InfoEntry>, I>>(object: I): ModelTest_InfoEntry { + const message = createBaseModelTest_InfoEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/query_result.ts b/js/packages/proto/src/generated/quary/service/v1/query_result.ts new file mode 100644 index 00000000..15f11bab --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/query_result.ts @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/query_result.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +/** QueryResult is the result of a ran query. */ +export interface QueryResult { + columns: QueryResultColumn[]; +} + +export interface QueryResultColumn { + name: string; + type?: string | undefined; + values: string[]; +} + +function createBaseQueryResult(): QueryResult { + return { columns: [] }; +} + +export const QueryResult = { + encode(message: QueryResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.columns) { + QueryResultColumn.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryResult { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.columns.push(QueryResultColumn.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryResult { + return { + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => QueryResultColumn.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryResult): unknown { + const obj: any = {}; + if (message.columns?.length) { + obj.columns = message.columns.map((e) => QueryResultColumn.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<QueryResult>, I>>(base?: I): QueryResult { + return QueryResult.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<QueryResult>, I>>(object: I): QueryResult { + const message = createBaseQueryResult(); + message.columns = object.columns?.map((e) => QueryResultColumn.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryResultColumn(): QueryResultColumn { + return { name: "", type: undefined, values: [] }; +} + +export const QueryResultColumn = { + encode(message: QueryResultColumn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== undefined) { + writer.uint32(26).string(message.type); + } + for (const v of message.values) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryResultColumn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResultColumn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.values.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryResultColumn { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + type: isSet(object.type) ? gt.String(object.type) : undefined, + values: gt.Array.isArray(object?.values) ? object.values.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: QueryResultColumn): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.type !== undefined) { + obj.type = message.type; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create<I extends Exact<DeepPartial<QueryResultColumn>, I>>(base?: I): QueryResultColumn { + return QueryResultColumn.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<QueryResultColumn>, I>>(object: I): QueryResultColumn { + const message = createBaseQueryResultColumn(); + message.name = object.name ?? ""; + message.type = object.type ?? undefined; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/range.ts b/js/packages/proto/src/generated/quary/service/v1/range.ts new file mode 100644 index 00000000..4ae9a770 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/range.ts @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/range.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Position } from "./position"; + +export const protobufPackage = "quary.service.v1"; + +/** Range represents a range of positions in a file. */ +export interface Range { + start: Position | undefined; + end: Position | undefined; +} + +function createBaseRange(): Range { + return { start: undefined, end: undefined }; +} + +export const Range = { + encode(message: Range, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== undefined) { + Position.encode(message.start, writer.uint32(10).fork()).ldelim(); + } + if (message.end !== undefined) { + Position.encode(message.end, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Range { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start = Position.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end = Position.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Range { + return { + start: isSet(object.start) ? Position.fromJSON(object.start) : undefined, + end: isSet(object.end) ? Position.fromJSON(object.end) : undefined, + }; + }, + + toJSON(message: Range): unknown { + const obj: any = {}; + if (message.start !== undefined) { + obj.start = Position.toJSON(message.start); + } + if (message.end !== undefined) { + obj.end = Position.toJSON(message.end); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Range>, I>>(base?: I): Range { + return Range.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Range>, I>>(object: I): Range { + const message = createBaseRange(); + message.start = (object.start !== undefined && object.start !== null) + ? Position.fromPartial(object.start) + : undefined; + message.end = (object.end !== undefined && object.end !== null) ? Position.fromPartial(object.end) : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/table.ts b/js/packages/proto/src/generated/quary/service/v1/table.ts new file mode 100644 index 00000000..4b2998fc --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/table.ts @@ -0,0 +1,1048 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/table.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Empty } from "../../../google/protobuf/empty"; +import { ColumnTest } from "./project_file"; + +export const protobufPackage = "quary.service.v1"; + +/** Table is a table in the project that is used to visualise columns, descriptions, and column tests. */ +export interface Table { + tableType?: { $case: "present"; present: Table_PresentInSchema } | { + $case: "notPresent"; + notPresent: Table_NotPresentInSchema; + } | undefined; +} + +/** + * PresentInSchema is a table that is present in a SQL document and in the YAML definitions. + * Values are inferred and read from YAML. + */ +export interface Table_PresentInSchema { + rows: Table_PresentInSchema_PresentRow[]; +} + +export interface Table_PresentInSchema_PresentRow { + row?: + | { $case: "presentInSqlAndDefinitions"; presentInSqlAndDefinitions: Row } + | { $case: "missingInDefinitions"; missingInDefinitions: Row } + | { $case: "presentInDefinitionsButNotRecognisableInSql"; presentInDefinitionsButNotRecognisableInSql: Row } + | undefined; +} + +/** + * NotPresentInSchema is a table that is present as SQL but not in the YAML definitions. And so all the values + * are inferred. + */ +export interface Table_NotPresentInSchema { + rows: Row[]; +} + +/** Row is a row in the table. */ +export interface Row { + title: string; + tests: RowTest[]; + description: RowDescription | undefined; +} + +/** + * TableTest is a test that is run against a row in a table. It is a oneof because the test can be inferred from the + * YAML definitions, or it can be present in the SQL document. + */ +export interface RowTest { + test?: + | { $case: "presentAndNotInferred"; presentAndNotInferred: RowTestDetails } + | { $case: "presentAndInferred"; presentAndInferred: RowTestDetails } + | { $case: "notPresentButInferred"; notPresentButInferred: RowTestDetails } + | undefined; +} + +/** + * RowTestDetails encapsulates the details of tests associated with row and column data. + * The 'column_test' field within this structure is specifically used to manage test operations + * such as deletion and addition. These operations are typically invoked through callbacks. + */ +export interface RowTestDetails { + text: string; + columnTest: ColumnTest | undefined; +} + +/** + * RowDescription is a description of a row in a table. It is a oneof because the description can be inferred from the + * YAML definitions and/or it can be present in the SQL document. + */ +export interface RowDescription { + description?: + | { $case: "present"; present: string } + | { $case: "presentAndInferredIdentical"; presentAndInferredIdentical: string } + | { $case: "presentWithDifferentInference"; presentWithDifferentInference: RowDescription_PresentWithInference } + | { $case: "inferred"; inferred: string } + | { $case: "notPresent"; notPresent: Empty } + | undefined; +} + +export interface RowDescription_PresentWithInference { + present: string; + inferred: string; +} + +function createBaseTable(): Table { + return { tableType: undefined }; +} + +export const Table = { + encode(message: Table, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.tableType?.$case) { + case "present": + Table_PresentInSchema.encode(message.tableType.present, writer.uint32(10).fork()).ldelim(); + break; + case "notPresent": + Table_NotPresentInSchema.encode(message.tableType.notPresent, writer.uint32(18).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Table { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTable(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tableType = { $case: "present", present: Table_PresentInSchema.decode(reader, reader.uint32()) }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tableType = { + $case: "notPresent", + notPresent: Table_NotPresentInSchema.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Table { + return { + tableType: isSet(object.present) + ? { $case: "present", present: Table_PresentInSchema.fromJSON(object.present) } + : isSet(object.notPresent) + ? { $case: "notPresent", notPresent: Table_NotPresentInSchema.fromJSON(object.notPresent) } + : undefined, + }; + }, + + toJSON(message: Table): unknown { + const obj: any = {}; + if (message.tableType?.$case === "present") { + obj.present = Table_PresentInSchema.toJSON(message.tableType.present); + } + if (message.tableType?.$case === "notPresent") { + obj.notPresent = Table_NotPresentInSchema.toJSON(message.tableType.notPresent); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Table>, I>>(base?: I): Table { + return Table.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Table>, I>>(object: I): Table { + const message = createBaseTable(); + if ( + object.tableType?.$case === "present" && + object.tableType?.present !== undefined && + object.tableType?.present !== null + ) { + message.tableType = { $case: "present", present: Table_PresentInSchema.fromPartial(object.tableType.present) }; + } + if ( + object.tableType?.$case === "notPresent" && + object.tableType?.notPresent !== undefined && + object.tableType?.notPresent !== null + ) { + message.tableType = { + $case: "notPresent", + notPresent: Table_NotPresentInSchema.fromPartial(object.tableType.notPresent), + }; + } + return message; + }, +}; + +function createBaseTable_PresentInSchema(): Table_PresentInSchema { + return { rows: [] }; +} + +export const Table_PresentInSchema = { + encode(message: Table_PresentInSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rows) { + Table_PresentInSchema_PresentRow.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Table_PresentInSchema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTable_PresentInSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rows.push(Table_PresentInSchema_PresentRow.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Table_PresentInSchema { + return { + rows: gt.Array.isArray(object?.rows) + ? object.rows.map((e: any) => Table_PresentInSchema_PresentRow.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Table_PresentInSchema): unknown { + const obj: any = {}; + if (message.rows?.length) { + obj.rows = message.rows.map((e) => Table_PresentInSchema_PresentRow.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Table_PresentInSchema>, I>>(base?: I): Table_PresentInSchema { + return Table_PresentInSchema.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Table_PresentInSchema>, I>>(object: I): Table_PresentInSchema { + const message = createBaseTable_PresentInSchema(); + message.rows = object.rows?.map((e) => Table_PresentInSchema_PresentRow.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTable_PresentInSchema_PresentRow(): Table_PresentInSchema_PresentRow { + return { row: undefined }; +} + +export const Table_PresentInSchema_PresentRow = { + encode(message: Table_PresentInSchema_PresentRow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.row?.$case) { + case "presentInSqlAndDefinitions": + Row.encode(message.row.presentInSqlAndDefinitions, writer.uint32(10).fork()).ldelim(); + break; + case "missingInDefinitions": + Row.encode(message.row.missingInDefinitions, writer.uint32(18).fork()).ldelim(); + break; + case "presentInDefinitionsButNotRecognisableInSql": + Row.encode(message.row.presentInDefinitionsButNotRecognisableInSql, writer.uint32(26).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Table_PresentInSchema_PresentRow { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTable_PresentInSchema_PresentRow(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.row = { + $case: "presentInSqlAndDefinitions", + presentInSqlAndDefinitions: Row.decode(reader, reader.uint32()), + }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.row = { $case: "missingInDefinitions", missingInDefinitions: Row.decode(reader, reader.uint32()) }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.row = { + $case: "presentInDefinitionsButNotRecognisableInSql", + presentInDefinitionsButNotRecognisableInSql: Row.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Table_PresentInSchema_PresentRow { + return { + row: isSet(object.presentInSqlAndDefinitions) + ? { + $case: "presentInSqlAndDefinitions", + presentInSqlAndDefinitions: Row.fromJSON(object.presentInSqlAndDefinitions), + } + : isSet(object.missingInDefinitions) + ? { $case: "missingInDefinitions", missingInDefinitions: Row.fromJSON(object.missingInDefinitions) } + : isSet(object.presentInDefinitionsButNotRecognisableInSql) + ? { + $case: "presentInDefinitionsButNotRecognisableInSql", + presentInDefinitionsButNotRecognisableInSql: Row.fromJSON(object.presentInDefinitionsButNotRecognisableInSql), + } + : undefined, + }; + }, + + toJSON(message: Table_PresentInSchema_PresentRow): unknown { + const obj: any = {}; + if (message.row?.$case === "presentInSqlAndDefinitions") { + obj.presentInSqlAndDefinitions = Row.toJSON(message.row.presentInSqlAndDefinitions); + } + if (message.row?.$case === "missingInDefinitions") { + obj.missingInDefinitions = Row.toJSON(message.row.missingInDefinitions); + } + if (message.row?.$case === "presentInDefinitionsButNotRecognisableInSql") { + obj.presentInDefinitionsButNotRecognisableInSql = Row.toJSON( + message.row.presentInDefinitionsButNotRecognisableInSql, + ); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Table_PresentInSchema_PresentRow>, I>>( + base?: I, + ): Table_PresentInSchema_PresentRow { + return Table_PresentInSchema_PresentRow.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Table_PresentInSchema_PresentRow>, I>>( + object: I, + ): Table_PresentInSchema_PresentRow { + const message = createBaseTable_PresentInSchema_PresentRow(); + if ( + object.row?.$case === "presentInSqlAndDefinitions" && + object.row?.presentInSqlAndDefinitions !== undefined && + object.row?.presentInSqlAndDefinitions !== null + ) { + message.row = { + $case: "presentInSqlAndDefinitions", + presentInSqlAndDefinitions: Row.fromPartial(object.row.presentInSqlAndDefinitions), + }; + } + if ( + object.row?.$case === "missingInDefinitions" && + object.row?.missingInDefinitions !== undefined && + object.row?.missingInDefinitions !== null + ) { + message.row = { + $case: "missingInDefinitions", + missingInDefinitions: Row.fromPartial(object.row.missingInDefinitions), + }; + } + if ( + object.row?.$case === "presentInDefinitionsButNotRecognisableInSql" && + object.row?.presentInDefinitionsButNotRecognisableInSql !== undefined && + object.row?.presentInDefinitionsButNotRecognisableInSql !== null + ) { + message.row = { + $case: "presentInDefinitionsButNotRecognisableInSql", + presentInDefinitionsButNotRecognisableInSql: Row.fromPartial( + object.row.presentInDefinitionsButNotRecognisableInSql, + ), + }; + } + return message; + }, +}; + +function createBaseTable_NotPresentInSchema(): Table_NotPresentInSchema { + return { rows: [] }; +} + +export const Table_NotPresentInSchema = { + encode(message: Table_NotPresentInSchema, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rows) { + Row.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Table_NotPresentInSchema { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTable_NotPresentInSchema(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rows.push(Row.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Table_NotPresentInSchema { + return { rows: gt.Array.isArray(object?.rows) ? object.rows.map((e: any) => Row.fromJSON(e)) : [] }; + }, + + toJSON(message: Table_NotPresentInSchema): unknown { + const obj: any = {}; + if (message.rows?.length) { + obj.rows = message.rows.map((e) => Row.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Table_NotPresentInSchema>, I>>(base?: I): Table_NotPresentInSchema { + return Table_NotPresentInSchema.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Table_NotPresentInSchema>, I>>(object: I): Table_NotPresentInSchema { + const message = createBaseTable_NotPresentInSchema(); + message.rows = object.rows?.map((e) => Row.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRow(): Row { + return { title: "", tests: [], description: undefined }; +} + +export const Row = { + encode(message: Row, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + for (const v of message.tests) { + RowTest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.description !== undefined) { + RowDescription.encode(message.description, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Row { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRow(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tests.push(RowTest.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.description = RowDescription.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Row { + return { + title: isSet(object.title) ? gt.String(object.title) : "", + tests: gt.Array.isArray(object?.tests) ? object.tests.map((e: any) => RowTest.fromJSON(e)) : [], + description: isSet(object.description) ? RowDescription.fromJSON(object.description) : undefined, + }; + }, + + toJSON(message: Row): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.tests?.length) { + obj.tests = message.tests.map((e) => RowTest.toJSON(e)); + } + if (message.description !== undefined) { + obj.description = RowDescription.toJSON(message.description); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Row>, I>>(base?: I): Row { + return Row.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Row>, I>>(object: I): Row { + const message = createBaseRow(); + message.title = object.title ?? ""; + message.tests = object.tests?.map((e) => RowTest.fromPartial(e)) || []; + message.description = (object.description !== undefined && object.description !== null) + ? RowDescription.fromPartial(object.description) + : undefined; + return message; + }, +}; + +function createBaseRowTest(): RowTest { + return { test: undefined }; +} + +export const RowTest = { + encode(message: RowTest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.test?.$case) { + case "presentAndNotInferred": + RowTestDetails.encode(message.test.presentAndNotInferred, writer.uint32(10).fork()).ldelim(); + break; + case "presentAndInferred": + RowTestDetails.encode(message.test.presentAndInferred, writer.uint32(18).fork()).ldelim(); + break; + case "notPresentButInferred": + RowTestDetails.encode(message.test.notPresentButInferred, writer.uint32(26).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RowTest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRowTest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.test = { + $case: "presentAndNotInferred", + presentAndNotInferred: RowTestDetails.decode(reader, reader.uint32()), + }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.test = { + $case: "presentAndInferred", + presentAndInferred: RowTestDetails.decode(reader, reader.uint32()), + }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.test = { + $case: "notPresentButInferred", + notPresentButInferred: RowTestDetails.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RowTest { + return { + test: isSet(object.presentAndNotInferred) + ? { + $case: "presentAndNotInferred", + presentAndNotInferred: RowTestDetails.fromJSON(object.presentAndNotInferred), + } + : isSet(object.presentAndInferred) + ? { $case: "presentAndInferred", presentAndInferred: RowTestDetails.fromJSON(object.presentAndInferred) } + : isSet(object.notPresentButInferred) + ? { + $case: "notPresentButInferred", + notPresentButInferred: RowTestDetails.fromJSON(object.notPresentButInferred), + } + : undefined, + }; + }, + + toJSON(message: RowTest): unknown { + const obj: any = {}; + if (message.test?.$case === "presentAndNotInferred") { + obj.presentAndNotInferred = RowTestDetails.toJSON(message.test.presentAndNotInferred); + } + if (message.test?.$case === "presentAndInferred") { + obj.presentAndInferred = RowTestDetails.toJSON(message.test.presentAndInferred); + } + if (message.test?.$case === "notPresentButInferred") { + obj.notPresentButInferred = RowTestDetails.toJSON(message.test.notPresentButInferred); + } + return obj; + }, + + create<I extends Exact<DeepPartial<RowTest>, I>>(base?: I): RowTest { + return RowTest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RowTest>, I>>(object: I): RowTest { + const message = createBaseRowTest(); + if ( + object.test?.$case === "presentAndNotInferred" && + object.test?.presentAndNotInferred !== undefined && + object.test?.presentAndNotInferred !== null + ) { + message.test = { + $case: "presentAndNotInferred", + presentAndNotInferred: RowTestDetails.fromPartial(object.test.presentAndNotInferred), + }; + } + if ( + object.test?.$case === "presentAndInferred" && + object.test?.presentAndInferred !== undefined && + object.test?.presentAndInferred !== null + ) { + message.test = { + $case: "presentAndInferred", + presentAndInferred: RowTestDetails.fromPartial(object.test.presentAndInferred), + }; + } + if ( + object.test?.$case === "notPresentButInferred" && + object.test?.notPresentButInferred !== undefined && + object.test?.notPresentButInferred !== null + ) { + message.test = { + $case: "notPresentButInferred", + notPresentButInferred: RowTestDetails.fromPartial(object.test.notPresentButInferred), + }; + } + return message; + }, +}; + +function createBaseRowTestDetails(): RowTestDetails { + return { text: "", columnTest: undefined }; +} + +export const RowTestDetails = { + encode(message: RowTestDetails, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.columnTest !== undefined) { + ColumnTest.encode(message.columnTest, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RowTestDetails { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRowTestDetails(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.columnTest = ColumnTest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RowTestDetails { + return { + text: isSet(object.text) ? gt.String(object.text) : "", + columnTest: isSet(object.columnTest) ? ColumnTest.fromJSON(object.columnTest) : undefined, + }; + }, + + toJSON(message: RowTestDetails): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.columnTest !== undefined) { + obj.columnTest = ColumnTest.toJSON(message.columnTest); + } + return obj; + }, + + create<I extends Exact<DeepPartial<RowTestDetails>, I>>(base?: I): RowTestDetails { + return RowTestDetails.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RowTestDetails>, I>>(object: I): RowTestDetails { + const message = createBaseRowTestDetails(); + message.text = object.text ?? ""; + message.columnTest = (object.columnTest !== undefined && object.columnTest !== null) + ? ColumnTest.fromPartial(object.columnTest) + : undefined; + return message; + }, +}; + +function createBaseRowDescription(): RowDescription { + return { description: undefined }; +} + +export const RowDescription = { + encode(message: RowDescription, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.description?.$case) { + case "present": + writer.uint32(10).string(message.description.present); + break; + case "presentAndInferredIdentical": + writer.uint32(18).string(message.description.presentAndInferredIdentical); + break; + case "presentWithDifferentInference": + RowDescription_PresentWithInference.encode( + message.description.presentWithDifferentInference, + writer.uint32(26).fork(), + ).ldelim(); + break; + case "inferred": + writer.uint32(34).string(message.description.inferred); + break; + case "notPresent": + Empty.encode(message.description.notPresent, writer.uint32(42).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RowDescription { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRowDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = { $case: "present", present: reader.string() }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = { $case: "presentAndInferredIdentical", presentAndInferredIdentical: reader.string() }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.description = { + $case: "presentWithDifferentInference", + presentWithDifferentInference: RowDescription_PresentWithInference.decode(reader, reader.uint32()), + }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = { $case: "inferred", inferred: reader.string() }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.description = { $case: "notPresent", notPresent: Empty.decode(reader, reader.uint32()) }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RowDescription { + return { + description: isSet(object.present) + ? { $case: "present", present: gt.String(object.present) } + : isSet(object.presentAndInferredIdentical) + ? { + $case: "presentAndInferredIdentical", + presentAndInferredIdentical: gt.String(object.presentAndInferredIdentical), + } + : isSet(object.presentWithDifferentInference) + ? { + $case: "presentWithDifferentInference", + presentWithDifferentInference: RowDescription_PresentWithInference.fromJSON( + object.presentWithDifferentInference, + ), + } + : isSet(object.inferred) + ? { $case: "inferred", inferred: gt.String(object.inferred) } + : isSet(object.notPresent) + ? { $case: "notPresent", notPresent: Empty.fromJSON(object.notPresent) } + : undefined, + }; + }, + + toJSON(message: RowDescription): unknown { + const obj: any = {}; + if (message.description?.$case === "present") { + obj.present = message.description.present; + } + if (message.description?.$case === "presentAndInferredIdentical") { + obj.presentAndInferredIdentical = message.description.presentAndInferredIdentical; + } + if (message.description?.$case === "presentWithDifferentInference") { + obj.presentWithDifferentInference = RowDescription_PresentWithInference.toJSON( + message.description.presentWithDifferentInference, + ); + } + if (message.description?.$case === "inferred") { + obj.inferred = message.description.inferred; + } + if (message.description?.$case === "notPresent") { + obj.notPresent = Empty.toJSON(message.description.notPresent); + } + return obj; + }, + + create<I extends Exact<DeepPartial<RowDescription>, I>>(base?: I): RowDescription { + return RowDescription.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RowDescription>, I>>(object: I): RowDescription { + const message = createBaseRowDescription(); + if ( + object.description?.$case === "present" && + object.description?.present !== undefined && + object.description?.present !== null + ) { + message.description = { $case: "present", present: object.description.present }; + } + if ( + object.description?.$case === "presentAndInferredIdentical" && + object.description?.presentAndInferredIdentical !== undefined && + object.description?.presentAndInferredIdentical !== null + ) { + message.description = { + $case: "presentAndInferredIdentical", + presentAndInferredIdentical: object.description.presentAndInferredIdentical, + }; + } + if ( + object.description?.$case === "presentWithDifferentInference" && + object.description?.presentWithDifferentInference !== undefined && + object.description?.presentWithDifferentInference !== null + ) { + message.description = { + $case: "presentWithDifferentInference", + presentWithDifferentInference: RowDescription_PresentWithInference.fromPartial( + object.description.presentWithDifferentInference, + ), + }; + } + if ( + object.description?.$case === "inferred" && + object.description?.inferred !== undefined && + object.description?.inferred !== null + ) { + message.description = { $case: "inferred", inferred: object.description.inferred }; + } + if ( + object.description?.$case === "notPresent" && + object.description?.notPresent !== undefined && + object.description?.notPresent !== null + ) { + message.description = { $case: "notPresent", notPresent: Empty.fromPartial(object.description.notPresent) }; + } + return message; + }, +}; + +function createBaseRowDescription_PresentWithInference(): RowDescription_PresentWithInference { + return { present: "", inferred: "" }; +} + +export const RowDescription_PresentWithInference = { + encode(message: RowDescription_PresentWithInference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.present !== "") { + writer.uint32(10).string(message.present); + } + if (message.inferred !== "") { + writer.uint32(18).string(message.inferred); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RowDescription_PresentWithInference { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRowDescription_PresentWithInference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.present = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inferred = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RowDescription_PresentWithInference { + return { + present: isSet(object.present) ? gt.String(object.present) : "", + inferred: isSet(object.inferred) ? gt.String(object.inferred) : "", + }; + }, + + toJSON(message: RowDescription_PresentWithInference): unknown { + const obj: any = {}; + if (message.present !== "") { + obj.present = message.present; + } + if (message.inferred !== "") { + obj.inferred = message.inferred; + } + return obj; + }, + + create<I extends Exact<DeepPartial<RowDescription_PresentWithInference>, I>>( + base?: I, + ): RowDescription_PresentWithInference { + return RowDescription_PresentWithInference.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RowDescription_PresentWithInference>, I>>( + object: I, + ): RowDescription_PresentWithInference { + const message = createBaseRowDescription_PresentWithInference(); + message.present = object.present ?? ""; + message.inferred = object.inferred ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/table_address.ts b/js/packages/proto/src/generated/quary/service/v1/table_address.ts new file mode 100644 index 00000000..7cca91a8 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/table_address.ts @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/table_address.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +/** TableAddress is a struct that represents a table in a database. It contains the name of the table and the full path. */ +export interface TableAddress { + name: string; + fullPath: string; +} + +function createBaseTableAddress(): TableAddress { + return { name: "", fullPath: "" }; +} + +export const TableAddress = { + encode(message: TableAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullPath !== "") { + writer.uint32(18).string(message.fullPath); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TableAddress { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fullPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TableAddress { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + fullPath: isSet(object.fullPath) ? gt.String(object.fullPath) : "", + }; + }, + + toJSON(message: TableAddress): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.fullPath !== "") { + obj.fullPath = message.fullPath; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TableAddress>, I>>(base?: I): TableAddress { + return TableAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TableAddress>, I>>(object: I): TableAddress { + const message = createBaseTableAddress(); + message.name = object.name ?? ""; + message.fullPath = object.fullPath ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/test_result.ts b/js/packages/proto/src/generated/quary/service/v1/test_result.ts new file mode 100644 index 00000000..6c36784e --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/test_result.ts @@ -0,0 +1,774 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/test_result.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Empty } from "../../../google/protobuf/empty"; +import { QueryResult } from "./query_result"; + +export const protobufPackage = "quary.service.v1"; + +/** TestResult is the result of a test serializable so it can be shared */ +export interface TestResult { + testName: string; + query: string; + testResult?: { $case: "passed"; passed: Passed } | { $case: "failed"; failed: Failed } | undefined; +} + +export interface InferredChain { + inferredChain: string[]; +} + +export interface InferredChainWithOperation { + inferredChain: string[]; + operation: string; +} + +export interface Passed { + reason?: + | { $case: "ran"; ran: Empty } + | { $case: "inferredFromTests"; inferredFromTests: InferredChain } + | { $case: "inferredFromLogic"; inferredFromLogic: string } + | { $case: "inferredThroughTestsOperation"; inferredThroughTestsOperation: InferredChainWithOperation } + | undefined; +} + +export interface Failed { + reason?: + | { $case: "ran"; ran: FailedRunResults } + | { $case: "inferredFromTests"; inferredFromTests: InferredChain } + | { $case: "inferredThroughTestsOperation"; inferredThroughTestsOperation: InferredChainWithOperation } + | { $case: "failedRunMessage"; failedRunMessage: FailedRunMessage } + | undefined; +} + +export interface FailedRunResults { + queryResult: QueryResult | undefined; +} + +/** + * FailedRunMessage is a message that contains a message that can be displayed + * to the user when a test fails. This shoudl be used when the failure is not + * due to a query result but due to some other reason for example an incorrect + * query or a query that is not supported. + */ +export interface FailedRunMessage { + message: string; +} + +function createBaseTestResult(): TestResult { + return { testName: "", query: "", testResult: undefined }; +} + +export const TestResult = { + encode(message: TestResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.testName !== "") { + writer.uint32(10).string(message.testName); + } + if (message.query !== "") { + writer.uint32(18).string(message.query); + } + switch (message.testResult?.$case) { + case "passed": + Passed.encode(message.testResult.passed, writer.uint32(26).fork()).ldelim(); + break; + case "failed": + Failed.encode(message.testResult.failed, writer.uint32(34).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestResult { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.testName = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.testResult = { $case: "passed", passed: Passed.decode(reader, reader.uint32()) }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.testResult = { $case: "failed", failed: Failed.decode(reader, reader.uint32()) }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestResult { + return { + testName: isSet(object.testName) ? gt.String(object.testName) : "", + query: isSet(object.query) ? gt.String(object.query) : "", + testResult: isSet(object.passed) + ? { $case: "passed", passed: Passed.fromJSON(object.passed) } + : isSet(object.failed) + ? { $case: "failed", failed: Failed.fromJSON(object.failed) } + : undefined, + }; + }, + + toJSON(message: TestResult): unknown { + const obj: any = {}; + if (message.testName !== "") { + obj.testName = message.testName; + } + if (message.query !== "") { + obj.query = message.query; + } + if (message.testResult?.$case === "passed") { + obj.passed = Passed.toJSON(message.testResult.passed); + } + if (message.testResult?.$case === "failed") { + obj.failed = Failed.toJSON(message.testResult.failed); + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestResult>, I>>(base?: I): TestResult { + return TestResult.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestResult>, I>>(object: I): TestResult { + const message = createBaseTestResult(); + message.testName = object.testName ?? ""; + message.query = object.query ?? ""; + if ( + object.testResult?.$case === "passed" && + object.testResult?.passed !== undefined && + object.testResult?.passed !== null + ) { + message.testResult = { $case: "passed", passed: Passed.fromPartial(object.testResult.passed) }; + } + if ( + object.testResult?.$case === "failed" && + object.testResult?.failed !== undefined && + object.testResult?.failed !== null + ) { + message.testResult = { $case: "failed", failed: Failed.fromPartial(object.testResult.failed) }; + } + return message; + }, +}; + +function createBaseInferredChain(): InferredChain { + return { inferredChain: [] }; +} + +export const InferredChain = { + encode(message: InferredChain, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.inferredChain) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InferredChain { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInferredChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inferredChain.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): InferredChain { + return { + inferredChain: gt.Array.isArray(object?.inferredChain) ? object.inferredChain.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: InferredChain): unknown { + const obj: any = {}; + if (message.inferredChain?.length) { + obj.inferredChain = message.inferredChain; + } + return obj; + }, + + create<I extends Exact<DeepPartial<InferredChain>, I>>(base?: I): InferredChain { + return InferredChain.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<InferredChain>, I>>(object: I): InferredChain { + const message = createBaseInferredChain(); + message.inferredChain = object.inferredChain?.map((e) => e) || []; + return message; + }, +}; + +function createBaseInferredChainWithOperation(): InferredChainWithOperation { + return { inferredChain: [], operation: "" }; +} + +export const InferredChainWithOperation = { + encode(message: InferredChainWithOperation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.inferredChain) { + writer.uint32(10).string(v!); + } + if (message.operation !== "") { + writer.uint32(18).string(message.operation); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InferredChainWithOperation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInferredChainWithOperation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inferredChain.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.operation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): InferredChainWithOperation { + return { + inferredChain: gt.Array.isArray(object?.inferredChain) ? object.inferredChain.map((e: any) => gt.String(e)) : [], + operation: isSet(object.operation) ? gt.String(object.operation) : "", + }; + }, + + toJSON(message: InferredChainWithOperation): unknown { + const obj: any = {}; + if (message.inferredChain?.length) { + obj.inferredChain = message.inferredChain; + } + if (message.operation !== "") { + obj.operation = message.operation; + } + return obj; + }, + + create<I extends Exact<DeepPartial<InferredChainWithOperation>, I>>(base?: I): InferredChainWithOperation { + return InferredChainWithOperation.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<InferredChainWithOperation>, I>>(object: I): InferredChainWithOperation { + const message = createBaseInferredChainWithOperation(); + message.inferredChain = object.inferredChain?.map((e) => e) || []; + message.operation = object.operation ?? ""; + return message; + }, +}; + +function createBasePassed(): Passed { + return { reason: undefined }; +} + +export const Passed = { + encode(message: Passed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.reason?.$case) { + case "ran": + Empty.encode(message.reason.ran, writer.uint32(10).fork()).ldelim(); + break; + case "inferredFromTests": + InferredChain.encode(message.reason.inferredFromTests, writer.uint32(18).fork()).ldelim(); + break; + case "inferredFromLogic": + writer.uint32(26).string(message.reason.inferredFromLogic); + break; + case "inferredThroughTestsOperation": + InferredChainWithOperation.encode(message.reason.inferredThroughTestsOperation, writer.uint32(34).fork()) + .ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Passed { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePassed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reason = { $case: "ran", ran: Empty.decode(reader, reader.uint32()) }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reason = { + $case: "inferredFromTests", + inferredFromTests: InferredChain.decode(reader, reader.uint32()), + }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reason = { $case: "inferredFromLogic", inferredFromLogic: reader.string() }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.reason = { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Passed { + return { + reason: isSet(object.ran) + ? { $case: "ran", ran: Empty.fromJSON(object.ran) } + : isSet(object.inferredFromTests) + ? { $case: "inferredFromTests", inferredFromTests: InferredChain.fromJSON(object.inferredFromTests) } + : isSet(object.inferredFromLogic) + ? { $case: "inferredFromLogic", inferredFromLogic: gt.String(object.inferredFromLogic) } + : isSet(object.inferredThroughTestsOperation) + ? { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.fromJSON(object.inferredThroughTestsOperation), + } + : undefined, + }; + }, + + toJSON(message: Passed): unknown { + const obj: any = {}; + if (message.reason?.$case === "ran") { + obj.ran = Empty.toJSON(message.reason.ran); + } + if (message.reason?.$case === "inferredFromTests") { + obj.inferredFromTests = InferredChain.toJSON(message.reason.inferredFromTests); + } + if (message.reason?.$case === "inferredFromLogic") { + obj.inferredFromLogic = message.reason.inferredFromLogic; + } + if (message.reason?.$case === "inferredThroughTestsOperation") { + obj.inferredThroughTestsOperation = InferredChainWithOperation.toJSON( + message.reason.inferredThroughTestsOperation, + ); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Passed>, I>>(base?: I): Passed { + return Passed.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Passed>, I>>(object: I): Passed { + const message = createBasePassed(); + if (object.reason?.$case === "ran" && object.reason?.ran !== undefined && object.reason?.ran !== null) { + message.reason = { $case: "ran", ran: Empty.fromPartial(object.reason.ran) }; + } + if ( + object.reason?.$case === "inferredFromTests" && + object.reason?.inferredFromTests !== undefined && + object.reason?.inferredFromTests !== null + ) { + message.reason = { + $case: "inferredFromTests", + inferredFromTests: InferredChain.fromPartial(object.reason.inferredFromTests), + }; + } + if ( + object.reason?.$case === "inferredFromLogic" && + object.reason?.inferredFromLogic !== undefined && + object.reason?.inferredFromLogic !== null + ) { + message.reason = { $case: "inferredFromLogic", inferredFromLogic: object.reason.inferredFromLogic }; + } + if ( + object.reason?.$case === "inferredThroughTestsOperation" && + object.reason?.inferredThroughTestsOperation !== undefined && + object.reason?.inferredThroughTestsOperation !== null + ) { + message.reason = { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.fromPartial( + object.reason.inferredThroughTestsOperation, + ), + }; + } + return message; + }, +}; + +function createBaseFailed(): Failed { + return { reason: undefined }; +} + +export const Failed = { + encode(message: Failed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.reason?.$case) { + case "ran": + FailedRunResults.encode(message.reason.ran, writer.uint32(10).fork()).ldelim(); + break; + case "inferredFromTests": + InferredChain.encode(message.reason.inferredFromTests, writer.uint32(18).fork()).ldelim(); + break; + case "inferredThroughTestsOperation": + InferredChainWithOperation.encode(message.reason.inferredThroughTestsOperation, writer.uint32(26).fork()) + .ldelim(); + break; + case "failedRunMessage": + FailedRunMessage.encode(message.reason.failedRunMessage, writer.uint32(34).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Failed { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFailed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.reason = { $case: "ran", ran: FailedRunResults.decode(reader, reader.uint32()) }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reason = { + $case: "inferredFromTests", + inferredFromTests: InferredChain.decode(reader, reader.uint32()), + }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reason = { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.decode(reader, reader.uint32()), + }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.reason = { + $case: "failedRunMessage", + failedRunMessage: FailedRunMessage.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Failed { + return { + reason: isSet(object.ran) + ? { $case: "ran", ran: FailedRunResults.fromJSON(object.ran) } + : isSet(object.inferredFromTests) + ? { $case: "inferredFromTests", inferredFromTests: InferredChain.fromJSON(object.inferredFromTests) } + : isSet(object.inferredThroughTestsOperation) + ? { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.fromJSON(object.inferredThroughTestsOperation), + } + : isSet(object.failedRunMessage) + ? { $case: "failedRunMessage", failedRunMessage: FailedRunMessage.fromJSON(object.failedRunMessage) } + : undefined, + }; + }, + + toJSON(message: Failed): unknown { + const obj: any = {}; + if (message.reason?.$case === "ran") { + obj.ran = FailedRunResults.toJSON(message.reason.ran); + } + if (message.reason?.$case === "inferredFromTests") { + obj.inferredFromTests = InferredChain.toJSON(message.reason.inferredFromTests); + } + if (message.reason?.$case === "inferredThroughTestsOperation") { + obj.inferredThroughTestsOperation = InferredChainWithOperation.toJSON( + message.reason.inferredThroughTestsOperation, + ); + } + if (message.reason?.$case === "failedRunMessage") { + obj.failedRunMessage = FailedRunMessage.toJSON(message.reason.failedRunMessage); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Failed>, I>>(base?: I): Failed { + return Failed.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Failed>, I>>(object: I): Failed { + const message = createBaseFailed(); + if (object.reason?.$case === "ran" && object.reason?.ran !== undefined && object.reason?.ran !== null) { + message.reason = { $case: "ran", ran: FailedRunResults.fromPartial(object.reason.ran) }; + } + if ( + object.reason?.$case === "inferredFromTests" && + object.reason?.inferredFromTests !== undefined && + object.reason?.inferredFromTests !== null + ) { + message.reason = { + $case: "inferredFromTests", + inferredFromTests: InferredChain.fromPartial(object.reason.inferredFromTests), + }; + } + if ( + object.reason?.$case === "inferredThroughTestsOperation" && + object.reason?.inferredThroughTestsOperation !== undefined && + object.reason?.inferredThroughTestsOperation !== null + ) { + message.reason = { + $case: "inferredThroughTestsOperation", + inferredThroughTestsOperation: InferredChainWithOperation.fromPartial( + object.reason.inferredThroughTestsOperation, + ), + }; + } + if ( + object.reason?.$case === "failedRunMessage" && + object.reason?.failedRunMessage !== undefined && + object.reason?.failedRunMessage !== null + ) { + message.reason = { + $case: "failedRunMessage", + failedRunMessage: FailedRunMessage.fromPartial(object.reason.failedRunMessage), + }; + } + return message; + }, +}; + +function createBaseFailedRunResults(): FailedRunResults { + return { queryResult: undefined }; +} + +export const FailedRunResults = { + encode(message: FailedRunResults, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.queryResult !== undefined) { + QueryResult.encode(message.queryResult, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FailedRunResults { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFailedRunResults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.queryResult = QueryResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FailedRunResults { + return { queryResult: isSet(object.queryResult) ? QueryResult.fromJSON(object.queryResult) : undefined }; + }, + + toJSON(message: FailedRunResults): unknown { + const obj: any = {}; + if (message.queryResult !== undefined) { + obj.queryResult = QueryResult.toJSON(message.queryResult); + } + return obj; + }, + + create<I extends Exact<DeepPartial<FailedRunResults>, I>>(base?: I): FailedRunResults { + return FailedRunResults.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<FailedRunResults>, I>>(object: I): FailedRunResults { + const message = createBaseFailedRunResults(); + message.queryResult = (object.queryResult !== undefined && object.queryResult !== null) + ? QueryResult.fromPartial(object.queryResult) + : undefined; + return message; + }, +}; + +function createBaseFailedRunMessage(): FailedRunMessage { + return { message: "" }; +} + +export const FailedRunMessage = { + encode(message: FailedRunMessage, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FailedRunMessage { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFailedRunMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): FailedRunMessage { + return { message: isSet(object.message) ? gt.String(object.message) : "" }; + }, + + toJSON(message: FailedRunMessage): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create<I extends Exact<DeepPartial<FailedRunMessage>, I>>(base?: I): FailedRunMessage { + return FailedRunMessage.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<FailedRunMessage>, I>>(object: I): FailedRunMessage { + const message = createBaseFailedRunMessage(); + message.message = object.message ?? ""; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/test_results.ts b/js/packages/proto/src/generated/quary/service/v1/test_results.ts new file mode 100644 index 00000000..d81f6539 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/test_results.ts @@ -0,0 +1,108 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/test_results.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { TestResult } from "./test_result"; + +export const protobufPackage = "quary.service.v1"; + +/** + * WasmRunTestResponse is a temporary message type to work on inferring in Rust rather than in Typescript. + * The goal is to make better interfaces over time. + */ +export interface TestResults { + results: TestResult[]; +} + +function createBaseTestResults(): TestResults { + return { results: [] }; +} + +export const TestResults = { + encode(message: TestResults, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.results) { + TestResult.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestResults { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestResults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(TestResult.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestResults { + return { results: gt.Array.isArray(object?.results) ? object.results.map((e: any) => TestResult.fromJSON(e)) : [] }; + }, + + toJSON(message: TestResults): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => TestResult.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestResults>, I>>(base?: I): TestResults { + return TestResults.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestResults>, I>>(object: I): TestResults { + const message = createBaseTestResults(); + message.results = object.results?.map((e) => TestResult.fromPartial(e)) || []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; diff --git a/js/packages/proto/src/generated/quary/service/v1/test_runner.ts b/js/packages/proto/src/generated/quary/service/v1/test_runner.ts new file mode 100644 index 00000000..1b3180e8 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/test_runner.ts @@ -0,0 +1,50 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/test_runner.proto + +/* eslint-disable */ + +export const protobufPackage = "quary.service.v1"; + +export enum TestRunner { + TEST_RUNNER_UNSPECIFIED = 0, + /** TEST_RUNNER_ALL - TEST_RUNNER_ALL is a runner that will run all the tests in the test suite. */ + TEST_RUNNER_ALL = 1, + /** TEST_RUNNER_SKIP - TEST_RUNNER_NONE is a runner that will run skip tests in the test suite that can be inferred from other tests in the test suite. */ + TEST_RUNNER_SKIP = 2, + UNRECOGNIZED = -1, +} + +export function testRunnerFromJSON(object: any): TestRunner { + switch (object) { + case 0: + case "TEST_RUNNER_UNSPECIFIED": + return TestRunner.TEST_RUNNER_UNSPECIFIED; + case 1: + case "TEST_RUNNER_ALL": + return TestRunner.TEST_RUNNER_ALL; + case 2: + case "TEST_RUNNER_SKIP": + return TestRunner.TEST_RUNNER_SKIP; + case -1: + case "UNRECOGNIZED": + default: + return TestRunner.UNRECOGNIZED; + } +} + +export function testRunnerToJSON(object: TestRunner): string { + switch (object) { + case TestRunner.TEST_RUNNER_UNSPECIFIED: + return "TEST_RUNNER_UNSPECIFIED"; + case TestRunner.TEST_RUNNER_ALL: + return "TEST_RUNNER_ALL"; + case TestRunner.TEST_RUNNER_SKIP: + return "TEST_RUNNER_SKIP"; + case TestRunner.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/js/packages/proto/src/generated/quary/service/v1/types.ts b/js/packages/proto/src/generated/quary/service/v1/types.ts new file mode 100644 index 00000000..2602c062 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/types.ts @@ -0,0 +1,2596 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/types.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "quary.service.v1"; + +export interface Test { + testType?: + | { $case: "sql"; sql: TestSQLFile } + | { $case: "unique"; unique: TestUnique } + | { $case: "notNull"; notNull: TestNotNull } + | { $case: "relationship"; relationship: TestRelationship } + | { $case: "acceptedValues"; acceptedValues: TestAcceptedValues } + | { $case: "greaterThanOrEqual"; greaterThanOrEqual: TestGreaterThanOrEqual } + | { $case: "lessThanOrEqual"; lessThanOrEqual: TestLessThanOrEqual } + | { $case: "greaterThan"; greaterThan: TestGreaterThan } + | { $case: "lessThan"; lessThan: TestLessThan } + | { $case: "multiColumnUnique"; multiColumnUnique: TestMultiColumnUnique } + | undefined; +} + +export interface TestSQLFile { + filePath: string; + references: string[]; +} + +export interface TestUnique { + filePath: string; + model: string; + path: string; + column: string; +} + +export interface TestNotNull { + filePath: string; + model: string; + path: string; + column: string; +} + +export interface TestGreaterThanOrEqual { + filePath: string; + model: string; + path: string; + column: string; + value: string; +} + +export interface TestLessThanOrEqual { + filePath: string; + model: string; + path: string; + column: string; + value: string; +} + +export interface TestGreaterThan { + filePath: string; + model: string; + path: string; + column: string; + value: string; +} + +export interface TestLessThan { + filePath: string; + model: string; + path: string; + column: string; + value: string; +} + +export interface TestRelationship { + filePath: string; + sourceModel: string; + sourcePath: string; + sourceColumn: string; + targetModel: string; + targetPath: string; + targetColumn: string; +} + +export interface TestAcceptedValues { + filePath: string; + model: string; + path: string; + column: string; + acceptedValues: string[]; +} + +export interface TestMultiColumnUnique { + filePath: string; + model: string; + path: string; + columns: string[]; +} + +export interface Seed { + name: string; + filePath: string; + fileSha256Hash: string; +} + +export interface Model { + name: string; + description?: + | string + | undefined; + /** Tags are used to group different parts of the project together. */ + tags: string[]; + filePath: string; + fileSha256Hash: string; + materialization?: string | undefined; + columns: Model_ModelColum[]; + /** + * References to other models/seeds/snapshots that are used in the model. These are unique keys and sorted + * alphabetically. + */ + references: string[]; +} + +export interface Model_ModelColum { + title: string; + description?: string | undefined; +} + +export interface Snapshot { + name: string; + description?: + | string + | undefined; + /** Tags are used to group different parts of the project together. */ + tags: string[]; + filePath: string; + fileSha256Hash: string; + uniqueKey: string; + strategy: + | Snapshot_SnapshotStrategy + | undefined; + /** + * References to other seeds/sources that are used in the snapshot. These are unique keys and sorted + * alphabetically. + */ + references: string[]; +} + +export interface Snapshot_SnapshotStrategy { + strategyType?: { $case: "timestamp"; timestamp: Snapshot_SnapshotStrategy_TimestampStrategy } | undefined; +} + +export interface Snapshot_SnapshotStrategy_TimestampStrategy { + updatedAt: string; +} + +/** Generic source structure, used as input to generate the quary-specific source structure */ +export interface DatabaseSource { + name: string; + path: string; + columns: string[]; +} + +export interface Source { + name: string; + description?: string | undefined; + path: string; + /** Tags are used to group different parts of the project together. */ + tags: string[]; + /** TODO Replace File path references with whole file references */ + filePath: string; + columns: Source_SourceColumn[]; +} + +export interface Source_SourceColumn { + title: string; + description?: string | undefined; +} + +function createBaseTest(): Test { + return { testType: undefined }; +} + +export const Test = { + encode(message: Test, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.testType?.$case) { + case "sql": + TestSQLFile.encode(message.testType.sql, writer.uint32(10).fork()).ldelim(); + break; + case "unique": + TestUnique.encode(message.testType.unique, writer.uint32(18).fork()).ldelim(); + break; + case "notNull": + TestNotNull.encode(message.testType.notNull, writer.uint32(26).fork()).ldelim(); + break; + case "relationship": + TestRelationship.encode(message.testType.relationship, writer.uint32(34).fork()).ldelim(); + break; + case "acceptedValues": + TestAcceptedValues.encode(message.testType.acceptedValues, writer.uint32(42).fork()).ldelim(); + break; + case "greaterThanOrEqual": + TestGreaterThanOrEqual.encode(message.testType.greaterThanOrEqual, writer.uint32(50).fork()).ldelim(); + break; + case "lessThanOrEqual": + TestLessThanOrEqual.encode(message.testType.lessThanOrEqual, writer.uint32(58).fork()).ldelim(); + break; + case "greaterThan": + TestGreaterThan.encode(message.testType.greaterThan, writer.uint32(66).fork()).ldelim(); + break; + case "lessThan": + TestLessThan.encode(message.testType.lessThan, writer.uint32(74).fork()).ldelim(); + break; + case "multiColumnUnique": + TestMultiColumnUnique.encode(message.testType.multiColumnUnique, writer.uint32(82).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Test { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.testType = { $case: "sql", sql: TestSQLFile.decode(reader, reader.uint32()) }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.testType = { $case: "unique", unique: TestUnique.decode(reader, reader.uint32()) }; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.testType = { $case: "notNull", notNull: TestNotNull.decode(reader, reader.uint32()) }; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.testType = { $case: "relationship", relationship: TestRelationship.decode(reader, reader.uint32()) }; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.testType = { + $case: "acceptedValues", + acceptedValues: TestAcceptedValues.decode(reader, reader.uint32()), + }; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.testType = { + $case: "greaterThanOrEqual", + greaterThanOrEqual: TestGreaterThanOrEqual.decode(reader, reader.uint32()), + }; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.testType = { + $case: "lessThanOrEqual", + lessThanOrEqual: TestLessThanOrEqual.decode(reader, reader.uint32()), + }; + continue; + case 8: + if (tag !== 66) { + break; + } + + message.testType = { $case: "greaterThan", greaterThan: TestGreaterThan.decode(reader, reader.uint32()) }; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.testType = { $case: "lessThan", lessThan: TestLessThan.decode(reader, reader.uint32()) }; + continue; + case 10: + if (tag !== 82) { + break; + } + + message.testType = { + $case: "multiColumnUnique", + multiColumnUnique: TestMultiColumnUnique.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Test { + return { + testType: isSet(object.sql) + ? { $case: "sql", sql: TestSQLFile.fromJSON(object.sql) } + : isSet(object.unique) + ? { $case: "unique", unique: TestUnique.fromJSON(object.unique) } + : isSet(object.notNull) + ? { $case: "notNull", notNull: TestNotNull.fromJSON(object.notNull) } + : isSet(object.relationship) + ? { $case: "relationship", relationship: TestRelationship.fromJSON(object.relationship) } + : isSet(object.acceptedValues) + ? { $case: "acceptedValues", acceptedValues: TestAcceptedValues.fromJSON(object.acceptedValues) } + : isSet(object.greaterThanOrEqual) + ? { + $case: "greaterThanOrEqual", + greaterThanOrEqual: TestGreaterThanOrEqual.fromJSON(object.greaterThanOrEqual), + } + : isSet(object.lessThanOrEqual) + ? { $case: "lessThanOrEqual", lessThanOrEqual: TestLessThanOrEqual.fromJSON(object.lessThanOrEqual) } + : isSet(object.greaterThan) + ? { $case: "greaterThan", greaterThan: TestGreaterThan.fromJSON(object.greaterThan) } + : isSet(object.lessThan) + ? { $case: "lessThan", lessThan: TestLessThan.fromJSON(object.lessThan) } + : isSet(object.multiColumnUnique) + ? { $case: "multiColumnUnique", multiColumnUnique: TestMultiColumnUnique.fromJSON(object.multiColumnUnique) } + : undefined, + }; + }, + + toJSON(message: Test): unknown { + const obj: any = {}; + if (message.testType?.$case === "sql") { + obj.sql = TestSQLFile.toJSON(message.testType.sql); + } + if (message.testType?.$case === "unique") { + obj.unique = TestUnique.toJSON(message.testType.unique); + } + if (message.testType?.$case === "notNull") { + obj.notNull = TestNotNull.toJSON(message.testType.notNull); + } + if (message.testType?.$case === "relationship") { + obj.relationship = TestRelationship.toJSON(message.testType.relationship); + } + if (message.testType?.$case === "acceptedValues") { + obj.acceptedValues = TestAcceptedValues.toJSON(message.testType.acceptedValues); + } + if (message.testType?.$case === "greaterThanOrEqual") { + obj.greaterThanOrEqual = TestGreaterThanOrEqual.toJSON(message.testType.greaterThanOrEqual); + } + if (message.testType?.$case === "lessThanOrEqual") { + obj.lessThanOrEqual = TestLessThanOrEqual.toJSON(message.testType.lessThanOrEqual); + } + if (message.testType?.$case === "greaterThan") { + obj.greaterThan = TestGreaterThan.toJSON(message.testType.greaterThan); + } + if (message.testType?.$case === "lessThan") { + obj.lessThan = TestLessThan.toJSON(message.testType.lessThan); + } + if (message.testType?.$case === "multiColumnUnique") { + obj.multiColumnUnique = TestMultiColumnUnique.toJSON(message.testType.multiColumnUnique); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Test>, I>>(base?: I): Test { + return Test.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Test>, I>>(object: I): Test { + const message = createBaseTest(); + if (object.testType?.$case === "sql" && object.testType?.sql !== undefined && object.testType?.sql !== null) { + message.testType = { $case: "sql", sql: TestSQLFile.fromPartial(object.testType.sql) }; + } + if ( + object.testType?.$case === "unique" && object.testType?.unique !== undefined && object.testType?.unique !== null + ) { + message.testType = { $case: "unique", unique: TestUnique.fromPartial(object.testType.unique) }; + } + if ( + object.testType?.$case === "notNull" && + object.testType?.notNull !== undefined && + object.testType?.notNull !== null + ) { + message.testType = { $case: "notNull", notNull: TestNotNull.fromPartial(object.testType.notNull) }; + } + if ( + object.testType?.$case === "relationship" && + object.testType?.relationship !== undefined && + object.testType?.relationship !== null + ) { + message.testType = { + $case: "relationship", + relationship: TestRelationship.fromPartial(object.testType.relationship), + }; + } + if ( + object.testType?.$case === "acceptedValues" && + object.testType?.acceptedValues !== undefined && + object.testType?.acceptedValues !== null + ) { + message.testType = { + $case: "acceptedValues", + acceptedValues: TestAcceptedValues.fromPartial(object.testType.acceptedValues), + }; + } + if ( + object.testType?.$case === "greaterThanOrEqual" && + object.testType?.greaterThanOrEqual !== undefined && + object.testType?.greaterThanOrEqual !== null + ) { + message.testType = { + $case: "greaterThanOrEqual", + greaterThanOrEqual: TestGreaterThanOrEqual.fromPartial(object.testType.greaterThanOrEqual), + }; + } + if ( + object.testType?.$case === "lessThanOrEqual" && + object.testType?.lessThanOrEqual !== undefined && + object.testType?.lessThanOrEqual !== null + ) { + message.testType = { + $case: "lessThanOrEqual", + lessThanOrEqual: TestLessThanOrEqual.fromPartial(object.testType.lessThanOrEqual), + }; + } + if ( + object.testType?.$case === "greaterThan" && + object.testType?.greaterThan !== undefined && + object.testType?.greaterThan !== null + ) { + message.testType = { + $case: "greaterThan", + greaterThan: TestGreaterThan.fromPartial(object.testType.greaterThan), + }; + } + if ( + object.testType?.$case === "lessThan" && + object.testType?.lessThan !== undefined && + object.testType?.lessThan !== null + ) { + message.testType = { $case: "lessThan", lessThan: TestLessThan.fromPartial(object.testType.lessThan) }; + } + if ( + object.testType?.$case === "multiColumnUnique" && + object.testType?.multiColumnUnique !== undefined && + object.testType?.multiColumnUnique !== null + ) { + message.testType = { + $case: "multiColumnUnique", + multiColumnUnique: TestMultiColumnUnique.fromPartial(object.testType.multiColumnUnique), + }; + } + return message; + }, +}; + +function createBaseTestSQLFile(): TestSQLFile { + return { filePath: "", references: [] }; +} + +export const TestSQLFile = { + encode(message: TestSQLFile, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + for (const v of message.references) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestSQLFile { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestSQLFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.references.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestSQLFile { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + references: gt.Array.isArray(object?.references) ? object.references.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: TestSQLFile): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.references?.length) { + obj.references = message.references; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestSQLFile>, I>>(base?: I): TestSQLFile { + return TestSQLFile.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestSQLFile>, I>>(object: I): TestSQLFile { + const message = createBaseTestSQLFile(); + message.filePath = object.filePath ?? ""; + message.references = object.references?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTestUnique(): TestUnique { + return { filePath: "", model: "", path: "", column: "" }; +} + +export const TestUnique = { + encode(message: TestUnique, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestUnique { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestUnique(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestUnique { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + }; + }, + + toJSON(message: TestUnique): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestUnique>, I>>(base?: I): TestUnique { + return TestUnique.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestUnique>, I>>(object: I): TestUnique { + const message = createBaseTestUnique(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + return message; + }, +}; + +function createBaseTestNotNull(): TestNotNull { + return { filePath: "", model: "", path: "", column: "" }; +} + +export const TestNotNull = { + encode(message: TestNotNull, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestNotNull { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestNotNull(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestNotNull { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + }; + }, + + toJSON(message: TestNotNull): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestNotNull>, I>>(base?: I): TestNotNull { + return TestNotNull.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestNotNull>, I>>(object: I): TestNotNull { + const message = createBaseTestNotNull(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + return message; + }, +}; + +function createBaseTestGreaterThanOrEqual(): TestGreaterThanOrEqual { + return { filePath: "", model: "", path: "", column: "", value: "" }; +} + +export const TestGreaterThanOrEqual = { + encode(message: TestGreaterThanOrEqual, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestGreaterThanOrEqual { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestGreaterThanOrEqual(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestGreaterThanOrEqual { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: TestGreaterThanOrEqual): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestGreaterThanOrEqual>, I>>(base?: I): TestGreaterThanOrEqual { + return TestGreaterThanOrEqual.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestGreaterThanOrEqual>, I>>(object: I): TestGreaterThanOrEqual { + const message = createBaseTestGreaterThanOrEqual(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseTestLessThanOrEqual(): TestLessThanOrEqual { + return { filePath: "", model: "", path: "", column: "", value: "" }; +} + +export const TestLessThanOrEqual = { + encode(message: TestLessThanOrEqual, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestLessThanOrEqual { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestLessThanOrEqual(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestLessThanOrEqual { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: TestLessThanOrEqual): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestLessThanOrEqual>, I>>(base?: I): TestLessThanOrEqual { + return TestLessThanOrEqual.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestLessThanOrEqual>, I>>(object: I): TestLessThanOrEqual { + const message = createBaseTestLessThanOrEqual(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseTestGreaterThan(): TestGreaterThan { + return { filePath: "", model: "", path: "", column: "", value: "" }; +} + +export const TestGreaterThan = { + encode(message: TestGreaterThan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestGreaterThan { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestGreaterThan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestGreaterThan { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: TestGreaterThan): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestGreaterThan>, I>>(base?: I): TestGreaterThan { + return TestGreaterThan.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestGreaterThan>, I>>(object: I): TestGreaterThan { + const message = createBaseTestGreaterThan(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseTestLessThan(): TestLessThan { + return { filePath: "", model: "", path: "", column: "", value: "" }; +} + +export const TestLessThan = { + encode(message: TestLessThan, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestLessThan { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestLessThan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestLessThan { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + value: isSet(object.value) ? gt.String(object.value) : "", + }; + }, + + toJSON(message: TestLessThan): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestLessThan>, I>>(base?: I): TestLessThan { + return TestLessThan.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestLessThan>, I>>(object: I): TestLessThan { + const message = createBaseTestLessThan(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseTestRelationship(): TestRelationship { + return { + filePath: "", + sourceModel: "", + sourcePath: "", + sourceColumn: "", + targetModel: "", + targetPath: "", + targetColumn: "", + }; +} + +export const TestRelationship = { + encode(message: TestRelationship, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.sourceModel !== "") { + writer.uint32(18).string(message.sourceModel); + } + if (message.sourcePath !== "") { + writer.uint32(26).string(message.sourcePath); + } + if (message.sourceColumn !== "") { + writer.uint32(34).string(message.sourceColumn); + } + if (message.targetModel !== "") { + writer.uint32(42).string(message.targetModel); + } + if (message.targetPath !== "") { + writer.uint32(58).string(message.targetPath); + } + if (message.targetColumn !== "") { + writer.uint32(66).string(message.targetColumn); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestRelationship { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestRelationship(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sourceModel = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sourcePath = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.sourceColumn = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.targetModel = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.targetPath = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.targetColumn = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestRelationship { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + sourceModel: isSet(object.sourceModel) ? gt.String(object.sourceModel) : "", + sourcePath: isSet(object.sourcePath) ? gt.String(object.sourcePath) : "", + sourceColumn: isSet(object.sourceColumn) ? gt.String(object.sourceColumn) : "", + targetModel: isSet(object.targetModel) ? gt.String(object.targetModel) : "", + targetPath: isSet(object.targetPath) ? gt.String(object.targetPath) : "", + targetColumn: isSet(object.targetColumn) ? gt.String(object.targetColumn) : "", + }; + }, + + toJSON(message: TestRelationship): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.sourceModel !== "") { + obj.sourceModel = message.sourceModel; + } + if (message.sourcePath !== "") { + obj.sourcePath = message.sourcePath; + } + if (message.sourceColumn !== "") { + obj.sourceColumn = message.sourceColumn; + } + if (message.targetModel !== "") { + obj.targetModel = message.targetModel; + } + if (message.targetPath !== "") { + obj.targetPath = message.targetPath; + } + if (message.targetColumn !== "") { + obj.targetColumn = message.targetColumn; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestRelationship>, I>>(base?: I): TestRelationship { + return TestRelationship.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestRelationship>, I>>(object: I): TestRelationship { + const message = createBaseTestRelationship(); + message.filePath = object.filePath ?? ""; + message.sourceModel = object.sourceModel ?? ""; + message.sourcePath = object.sourcePath ?? ""; + message.sourceColumn = object.sourceColumn ?? ""; + message.targetModel = object.targetModel ?? ""; + message.targetPath = object.targetPath ?? ""; + message.targetColumn = object.targetColumn ?? ""; + return message; + }, +}; + +function createBaseTestAcceptedValues(): TestAcceptedValues { + return { filePath: "", model: "", path: "", column: "", acceptedValues: [] }; +} + +export const TestAcceptedValues = { + encode(message: TestAcceptedValues, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + if (message.column !== "") { + writer.uint32(34).string(message.column); + } + for (const v of message.acceptedValues) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestAcceptedValues { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestAcceptedValues(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.column = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.acceptedValues.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestAcceptedValues { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + column: isSet(object.column) ? gt.String(object.column) : "", + acceptedValues: gt.Array.isArray(object?.acceptedValues) + ? object.acceptedValues.map((e: any) => gt.String(e)) + : [], + }; + }, + + toJSON(message: TestAcceptedValues): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.column !== "") { + obj.column = message.column; + } + if (message.acceptedValues?.length) { + obj.acceptedValues = message.acceptedValues; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestAcceptedValues>, I>>(base?: I): TestAcceptedValues { + return TestAcceptedValues.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestAcceptedValues>, I>>(object: I): TestAcceptedValues { + const message = createBaseTestAcceptedValues(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.column = object.column ?? ""; + message.acceptedValues = object.acceptedValues?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTestMultiColumnUnique(): TestMultiColumnUnique { + return { filePath: "", model: "", path: "", columns: [] }; +} + +export const TestMultiColumnUnique = { + encode(message: TestMultiColumnUnique, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filePath !== "") { + writer.uint32(10).string(message.filePath); + } + if (message.model !== "") { + writer.uint32(18).string(message.model); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + for (const v of message.columns) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TestMultiColumnUnique { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTestMultiColumnUnique(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.filePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.model = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columns.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): TestMultiColumnUnique { + return { + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + model: isSet(object.model) ? gt.String(object.model) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: TestMultiColumnUnique): unknown { + const obj: any = {}; + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.columns?.length) { + obj.columns = message.columns; + } + return obj; + }, + + create<I extends Exact<DeepPartial<TestMultiColumnUnique>, I>>(base?: I): TestMultiColumnUnique { + return TestMultiColumnUnique.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TestMultiColumnUnique>, I>>(object: I): TestMultiColumnUnique { + const message = createBaseTestMultiColumnUnique(); + message.filePath = object.filePath ?? ""; + message.model = object.model ?? ""; + message.path = object.path ?? ""; + message.columns = object.columns?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSeed(): Seed { + return { name: "", filePath: "", fileSha256Hash: "" }; +} + +export const Seed = { + encode(message: Seed, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.filePath !== "") { + writer.uint32(18).string(message.filePath); + } + if (message.fileSha256Hash !== "") { + writer.uint32(26).string(message.fileSha256Hash); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Seed { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSeed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.filePath = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.fileSha256Hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Seed { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + fileSha256Hash: isSet(object.fileSha256Hash) ? gt.String(object.fileSha256Hash) : "", + }; + }, + + toJSON(message: Seed): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.fileSha256Hash !== "") { + obj.fileSha256Hash = message.fileSha256Hash; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Seed>, I>>(base?: I): Seed { + return Seed.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Seed>, I>>(object: I): Seed { + const message = createBaseSeed(); + message.name = object.name ?? ""; + message.filePath = object.filePath ?? ""; + message.fileSha256Hash = object.fileSha256Hash ?? ""; + return message; + }, +}; + +function createBaseModel(): Model { + return { + name: "", + description: undefined, + tags: [], + filePath: "", + fileSha256Hash: "", + materialization: undefined, + columns: [], + references: [], + }; +} + +export const Model = { + encode(message: Model, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tags) { + writer.uint32(34).string(v!); + } + if (message.filePath !== "") { + writer.uint32(26).string(message.filePath); + } + if (message.fileSha256Hash !== "") { + writer.uint32(58).string(message.fileSha256Hash); + } + if (message.materialization !== undefined) { + writer.uint32(66).string(message.materialization); + } + for (const v of message.columns) { + Model_ModelColum.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.references) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Model { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.tags.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.filePath = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.fileSha256Hash = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.materialization = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.columns.push(Model_ModelColum.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.references.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Model { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + fileSha256Hash: isSet(object.fileSha256Hash) ? gt.String(object.fileSha256Hash) : "", + materialization: isSet(object.materialization) ? gt.String(object.materialization) : undefined, + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => Model_ModelColum.fromJSON(e)) : [], + references: gt.Array.isArray(object?.references) ? object.references.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: Model): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.fileSha256Hash !== "") { + obj.fileSha256Hash = message.fileSha256Hash; + } + if (message.materialization !== undefined) { + obj.materialization = message.materialization; + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => Model_ModelColum.toJSON(e)); + } + if (message.references?.length) { + obj.references = message.references; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Model>, I>>(base?: I): Model { + return Model.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Model>, I>>(object: I): Model { + const message = createBaseModel(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tags = object.tags?.map((e) => e) || []; + message.filePath = object.filePath ?? ""; + message.fileSha256Hash = object.fileSha256Hash ?? ""; + message.materialization = object.materialization ?? undefined; + message.columns = object.columns?.map((e) => Model_ModelColum.fromPartial(e)) || []; + message.references = object.references?.map((e) => e) || []; + return message; + }, +}; + +function createBaseModel_ModelColum(): Model_ModelColum { + return { title: "", description: undefined }; +} + +export const Model_ModelColum = { + encode(message: Model_ModelColum, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Model_ModelColum { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel_ModelColum(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Model_ModelColum { + return { + title: isSet(object.title) ? gt.String(object.title) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + }; + }, + + toJSON(message: Model_ModelColum): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== undefined) { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Model_ModelColum>, I>>(base?: I): Model_ModelColum { + return Model_ModelColum.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Model_ModelColum>, I>>(object: I): Model_ModelColum { + const message = createBaseModel_ModelColum(); + message.title = object.title ?? ""; + message.description = object.description ?? undefined; + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { + name: "", + description: undefined, + tags: [], + filePath: "", + fileSha256Hash: "", + uniqueKey: "", + strategy: undefined, + references: [], + }; +} + +export const Snapshot = { + encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tags) { + writer.uint32(66).string(v!); + } + if (message.filePath !== "") { + writer.uint32(26).string(message.filePath); + } + if (message.fileSha256Hash !== "") { + writer.uint32(34).string(message.fileSha256Hash); + } + if (message.uniqueKey !== "") { + writer.uint32(42).string(message.uniqueKey); + } + if (message.strategy !== undefined) { + Snapshot_SnapshotStrategy.encode(message.strategy, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.references) { + writer.uint32(58).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.tags.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.filePath = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.fileSha256Hash = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.uniqueKey = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.strategy = Snapshot_SnapshotStrategy.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.references.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + fileSha256Hash: isSet(object.fileSha256Hash) ? gt.String(object.fileSha256Hash) : "", + uniqueKey: isSet(object.uniqueKey) ? gt.String(object.uniqueKey) : "", + strategy: isSet(object.strategy) ? Snapshot_SnapshotStrategy.fromJSON(object.strategy) : undefined, + references: gt.Array.isArray(object?.references) ? object.references.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.fileSha256Hash !== "") { + obj.fileSha256Hash = message.fileSha256Hash; + } + if (message.uniqueKey !== "") { + obj.uniqueKey = message.uniqueKey; + } + if (message.strategy !== undefined) { + obj.strategy = Snapshot_SnapshotStrategy.toJSON(message.strategy); + } + if (message.references?.length) { + obj.references = message.references; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Snapshot>, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Snapshot>, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tags = object.tags?.map((e) => e) || []; + message.filePath = object.filePath ?? ""; + message.fileSha256Hash = object.fileSha256Hash ?? ""; + message.uniqueKey = object.uniqueKey ?? ""; + message.strategy = (object.strategy !== undefined && object.strategy !== null) + ? Snapshot_SnapshotStrategy.fromPartial(object.strategy) + : undefined; + message.references = object.references?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSnapshot_SnapshotStrategy(): Snapshot_SnapshotStrategy { + return { strategyType: undefined }; +} + +export const Snapshot_SnapshotStrategy = { + encode(message: Snapshot_SnapshotStrategy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.strategyType?.$case) { + case "timestamp": + Snapshot_SnapshotStrategy_TimestampStrategy.encode(message.strategyType.timestamp, writer.uint32(10).fork()) + .ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot_SnapshotStrategy { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot_SnapshotStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.strategyType = { + $case: "timestamp", + timestamp: Snapshot_SnapshotStrategy_TimestampStrategy.decode(reader, reader.uint32()), + }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot_SnapshotStrategy { + return { + strategyType: isSet(object.timestamp) + ? { $case: "timestamp", timestamp: Snapshot_SnapshotStrategy_TimestampStrategy.fromJSON(object.timestamp) } + : undefined, + }; + }, + + toJSON(message: Snapshot_SnapshotStrategy): unknown { + const obj: any = {}; + if (message.strategyType?.$case === "timestamp") { + obj.timestamp = Snapshot_SnapshotStrategy_TimestampStrategy.toJSON(message.strategyType.timestamp); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Snapshot_SnapshotStrategy>, I>>(base?: I): Snapshot_SnapshotStrategy { + return Snapshot_SnapshotStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Snapshot_SnapshotStrategy>, I>>(object: I): Snapshot_SnapshotStrategy { + const message = createBaseSnapshot_SnapshotStrategy(); + if ( + object.strategyType?.$case === "timestamp" && + object.strategyType?.timestamp !== undefined && + object.strategyType?.timestamp !== null + ) { + message.strategyType = { + $case: "timestamp", + timestamp: Snapshot_SnapshotStrategy_TimestampStrategy.fromPartial(object.strategyType.timestamp), + }; + } + return message; + }, +}; + +function createBaseSnapshot_SnapshotStrategy_TimestampStrategy(): Snapshot_SnapshotStrategy_TimestampStrategy { + return { updatedAt: "" }; +} + +export const Snapshot_SnapshotStrategy_TimestampStrategy = { + encode(message: Snapshot_SnapshotStrategy_TimestampStrategy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.updatedAt !== "") { + writer.uint32(10).string(message.updatedAt); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot_SnapshotStrategy_TimestampStrategy { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot_SnapshotStrategy_TimestampStrategy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.updatedAt = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot_SnapshotStrategy_TimestampStrategy { + return { updatedAt: isSet(object.updatedAt) ? gt.String(object.updatedAt) : "" }; + }, + + toJSON(message: Snapshot_SnapshotStrategy_TimestampStrategy): unknown { + const obj: any = {}; + if (message.updatedAt !== "") { + obj.updatedAt = message.updatedAt; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Snapshot_SnapshotStrategy_TimestampStrategy>, I>>( + base?: I, + ): Snapshot_SnapshotStrategy_TimestampStrategy { + return Snapshot_SnapshotStrategy_TimestampStrategy.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Snapshot_SnapshotStrategy_TimestampStrategy>, I>>( + object: I, + ): Snapshot_SnapshotStrategy_TimestampStrategy { + const message = createBaseSnapshot_SnapshotStrategy_TimestampStrategy(); + message.updatedAt = object.updatedAt ?? ""; + return message; + }, +}; + +function createBaseDatabaseSource(): DatabaseSource { + return { name: "", path: "", columns: [] }; +} + +export const DatabaseSource = { + encode(message: DatabaseSource, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + for (const v of message.columns) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DatabaseSource { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDatabaseSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.columns.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DatabaseSource { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + path: isSet(object.path) ? gt.String(object.path) : "", + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => gt.String(e)) : [], + }; + }, + + toJSON(message: DatabaseSource): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.columns?.length) { + obj.columns = message.columns; + } + return obj; + }, + + create<I extends Exact<DeepPartial<DatabaseSource>, I>>(base?: I): DatabaseSource { + return DatabaseSource.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<DatabaseSource>, I>>(object: I): DatabaseSource { + const message = createBaseDatabaseSource(); + message.name = object.name ?? ""; + message.path = object.path ?? ""; + message.columns = object.columns?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSource(): Source { + return { name: "", description: undefined, path: "", tags: [], filePath: "", columns: [] }; +} + +export const Source = { + encode(message: Source, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + if (message.path !== "") { + writer.uint32(26).string(message.path); + } + for (const v of message.tags) { + writer.uint32(50).string(v!); + } + if (message.filePath !== "") { + writer.uint32(34).string(message.filePath); + } + for (const v of message.columns) { + Source_SourceColumn.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Source { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.path = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tags.push(reader.string()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.filePath = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.columns.push(Source_SourceColumn.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Source { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + path: isSet(object.path) ? gt.String(object.path) : "", + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => Source_SourceColumn.fromJSON(e)) : [], + }; + }, + + toJSON(message: Source): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => Source_SourceColumn.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<Source>, I>>(base?: I): Source { + return Source.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Source>, I>>(object: I): Source { + const message = createBaseSource(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.path = object.path ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.filePath = object.filePath ?? ""; + message.columns = object.columns?.map((e) => Source_SourceColumn.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSource_SourceColumn(): Source_SourceColumn { + return { title: "", description: undefined }; +} + +export const Source_SourceColumn = { + encode(message: Source_SourceColumn, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Source_SourceColumn { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSource_SourceColumn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Source_SourceColumn { + return { + title: isSet(object.title) ? gt.String(object.title) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + }; + }, + + toJSON(message: Source_SourceColumn): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== undefined) { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<Source_SourceColumn>, I>>(base?: I): Source_SourceColumn { + return Source_SourceColumn.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<Source_SourceColumn>, I>>(object: I): Source_SourceColumn { + const message = createBaseSource_SourceColumn(); + message.title = object.title ?? ""; + message.description = object.description ?? undefined; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/src/generated/quary/service/v1/wasm_rust_rpc_calls.ts b/js/packages/proto/src/generated/quary/service/v1/wasm_rust_rpc_calls.ts new file mode 100644 index 00000000..fe35b978 --- /dev/null +++ b/js/packages/proto/src/generated/quary/service/v1/wasm_rust_rpc_calls.ts @@ -0,0 +1,4039 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.176.0 +// protoc unknown +// source: quary/service/v1/wasm_rust_rpc_calls.proto + +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Empty } from "../../../google/protobuf/empty"; +import { ColumnDescription } from "./column_description"; +import { ConnectionConfig } from "./connection_config"; +import { Project } from "./project"; +import { ProjectDag } from "./project_dag"; +import { ColumnTest, ProjectFile } from "./project_file"; +import { Range } from "./range"; +import { Table } from "./table"; +import { DatabaseSource } from "./types"; + +export const protobufPackage = "quary.service.v1"; + +export interface GetProjectConfigRequest { + projectRoot: string; +} + +export interface GetProjectConfigResponse { + connectionConfig: ConnectionConfig | undefined; +} + +export interface InitFilesRequest { +} + +export interface InitFilesResponse { +} + +export interface IsPathEmptyRequest { + projectRoot: string; +} + +export interface IsPathEmptyResponse { + isEmpty: boolean; +} + +export interface GenerateProjectFilesRequest { + connectionConfig: ConnectionConfig | undefined; +} + +export interface GenerateProjectFilesResponse { +} + +export interface StringifyProjectFileRequest { + projectFile: ProjectFile | undefined; +} + +export interface StringifyProjectFileResponse { + stringifiedProjectFile: string; +} + +export interface ListAssetsRequest { + projectRoot: string; +} + +export interface ListAssetsResponse { + assets: ListAssetsResponse_Asset[]; +} + +/** TODO This asset type should probably be refactored to just use the core types. */ +export interface ListAssetsResponse_Asset { + name: string; + description?: string | undefined; + tags: string[]; + assetType: ListAssetsResponse_Asset_AssetType; + filePath: string; +} + +export enum ListAssetsResponse_Asset_AssetType { + ASSET_TYPE_UNSPECIFIED = 0, + ASSET_TYPE_MODEL = 1, + ASSET_TYPE_SEED = 2, + ASSET_TYPE_SOURCE = 3, + ASSET_TYPE_SNAPSHOT = 4, + UNRECOGNIZED = -1, +} + +export function listAssetsResponse_Asset_AssetTypeFromJSON(object: any): ListAssetsResponse_Asset_AssetType { + switch (object) { + case 0: + case "ASSET_TYPE_UNSPECIFIED": + return ListAssetsResponse_Asset_AssetType.ASSET_TYPE_UNSPECIFIED; + case 1: + case "ASSET_TYPE_MODEL": + return ListAssetsResponse_Asset_AssetType.ASSET_TYPE_MODEL; + case 2: + case "ASSET_TYPE_SEED": + return ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SEED; + case 3: + case "ASSET_TYPE_SOURCE": + return ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SOURCE; + case 4: + case "ASSET_TYPE_SNAPSHOT": + return ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ListAssetsResponse_Asset_AssetType.UNRECOGNIZED; + } +} + +export function listAssetsResponse_Asset_AssetTypeToJSON(object: ListAssetsResponse_Asset_AssetType): string { + switch (object) { + case ListAssetsResponse_Asset_AssetType.ASSET_TYPE_UNSPECIFIED: + return "ASSET_TYPE_UNSPECIFIED"; + case ListAssetsResponse_Asset_AssetType.ASSET_TYPE_MODEL: + return "ASSET_TYPE_MODEL"; + case ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SEED: + return "ASSET_TYPE_SEED"; + case ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SOURCE: + return "ASSET_TYPE_SOURCE"; + case ListAssetsResponse_Asset_AssetType.ASSET_TYPE_SNAPSHOT: + return "ASSET_TYPE_SNAPSHOT"; + case ListAssetsResponse_Asset_AssetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ParseProjectRequest { + projectRoot: string; +} + +export interface ParseProjectResponse { + project: Project | undefined; +} + +export interface RenderSchemaRequest { + projectRoot: string; +} + +export interface RenderSchemaResponse { + schema: string; +} + +export interface ReturnSQLForSeedsAndModelsRequest { + projectRoot: string; + dbQualifier: string; +} + +export interface ReturnSQLForSeedsAndModelsResponse { + sql: string[]; + project: Project | undefined; +} + +export interface ReturnFullProjectDagRequest { + projectRoot: string; +} + +export interface ReturnFullProjectDagResponse { + dag: ProjectDag | undefined; +} + +export interface ReturnDataForDocViewRequest { + projectRoot: string; + assetName: string; + /** cache_view defines whether or not to use the cached views in the returned sql and dag. */ + cacheViewInformation: CacheViewInformation | undefined; +} + +export interface ReturnDataForDocViewResponse { + fullSql: string; + description?: string | undefined; + dag: ProjectDag | undefined; + columns: ColumnDescription[]; + isAssetInSchemaFiles: boolean; +} + +export interface ReturnFullSqlForAssetRequest { + projectRoot: string; + assetName: string; + /** cache_view defines whether or not to use the cached views in the returned sql and dag. */ + cacheViewInformation: CacheViewInformation | undefined; +} + +export interface CacheViewInformation { + cacheView?: { $case: "cacheViewInformation"; cacheViewInformation: CacheViewInformationPaths } | { + $case: "doNotUse"; + doNotUse: Empty; + } | undefined; +} + +export interface CacheViewInformationPaths { + cacheViewPaths: string[]; +} + +export interface ReturnFullSqlForAssetResponse { + fullSql: string; + description?: string | undefined; + dag: ProjectDag | undefined; + columns: ColumnDescription[]; +} + +export interface GetModelTableRequest { + projectRoot: string; + modelName: string; +} + +export interface GetModelTableResponse { + table: Table | undefined; +} + +export interface CreateModelSchemaEntryRequest { + projectRoot: string; + modelName: string; +} + +export interface CreateModelSchemaEntryResponse { + path: string; + projectFile: ProjectFile | undefined; +} + +export interface UpdateAssetDescriptionRequest { + projectRoot: string; + assetName: string; + description: string; +} + +export interface UpdateAssetDescriptionResponse { +} + +export interface AddColumnToModelOrSourceRequest { + projectRoot: string; + modelOrSourceName: string; + columnName: string; +} + +export interface AddColumnToModelOrSourceResponse { +} + +export interface UpdateModelOrSourceColumnDescriptionRequest { + projectRoot: string; + modelOrSourceName: string; + columnName: string; + description?: string | undefined; +} + +export interface UpdateModelOrSourceColumnDescriptionResponse { +} + +export interface AddColumnTestToModelOrSourceColumnRequest { + projectRoot: string; + modelOrSourceName: string; + columnName: string; + columnTest: ColumnTest | undefined; +} + +export interface AddColumnTestToModelOrSourceColumnResponse { +} + +export interface RemoveColumnTestFromModelOrSourceColumnRequest { + projectRoot: string; + modelOrSourceName: string; + columnName: string; + columnTest: ColumnTest | undefined; +} + +export interface RemoveColumnTestFromModelOrSourceColumnResponse { +} + +export interface GenerateSourceFilesRequest { + projectRoot: string; + sources: DatabaseSource[]; + /** folder_path is the path to the folder where the source files will be generated. */ + folderPath: string; +} + +export interface GenerateSourceFilesResponse { +} + +export interface ReturnDefinitionLocationsForSQLRequest { + projectRoot: string; + sql: string; +} + +export interface ReturnDefinitionLocationsForSQLResponse { + definitions: ReturnDefinitionLocationsForSQLResponse_Definition[]; +} + +export interface ReturnDefinitionLocationsForSQLResponse_Definition { + range: Range | undefined; + targetModel: string; + targetFile: string; +} + +export interface ReturnSQLForInjectedModelRequest { + projectRoot: string; + sql: string; + /** + * temporary_id is the unique identifier for the artificially created model in the file system. + * It is manually parsed in the function and serves as a temporary ID (model name) for the model. + * It must be distinct from any other model names in the project to avoid collisions. + */ + temporaryId: string; +} + +export interface ReturnSQLForInjectedModelResponse { + sql: string; +} + +function createBaseGetProjectConfigRequest(): GetProjectConfigRequest { + return { projectRoot: "" }; +} + +export const GetProjectConfigRequest = { + encode(message: GetProjectConfigRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetProjectConfigRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetProjectConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetProjectConfigRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: GetProjectConfigRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<GetProjectConfigRequest>, I>>(base?: I): GetProjectConfigRequest { + return GetProjectConfigRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GetProjectConfigRequest>, I>>(object: I): GetProjectConfigRequest { + const message = createBaseGetProjectConfigRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseGetProjectConfigResponse(): GetProjectConfigResponse { + return { connectionConfig: undefined }; +} + +export const GetProjectConfigResponse = { + encode(message: GetProjectConfigResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.connectionConfig !== undefined) { + ConnectionConfig.encode(message.connectionConfig, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetProjectConfigResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetProjectConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.connectionConfig = ConnectionConfig.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetProjectConfigResponse { + return { + connectionConfig: isSet(object.connectionConfig) ? ConnectionConfig.fromJSON(object.connectionConfig) : undefined, + }; + }, + + toJSON(message: GetProjectConfigResponse): unknown { + const obj: any = {}; + if (message.connectionConfig !== undefined) { + obj.connectionConfig = ConnectionConfig.toJSON(message.connectionConfig); + } + return obj; + }, + + create<I extends Exact<DeepPartial<GetProjectConfigResponse>, I>>(base?: I): GetProjectConfigResponse { + return GetProjectConfigResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GetProjectConfigResponse>, I>>(object: I): GetProjectConfigResponse { + const message = createBaseGetProjectConfigResponse(); + message.connectionConfig = (object.connectionConfig !== undefined && object.connectionConfig !== null) + ? ConnectionConfig.fromPartial(object.connectionConfig) + : undefined; + return message; + }, +}; + +function createBaseInitFilesRequest(): InitFilesRequest { + return {}; +} + +export const InitFilesRequest = { + encode(_: InitFilesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InitFilesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): InitFilesRequest { + return {}; + }, + + toJSON(_: InitFilesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<InitFilesRequest>, I>>(base?: I): InitFilesRequest { + return InitFilesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<InitFilesRequest>, I>>(_: I): InitFilesRequest { + const message = createBaseInitFilesRequest(); + return message; + }, +}; + +function createBaseInitFilesResponse(): InitFilesResponse { + return {}; +} + +export const InitFilesResponse = { + encode(_: InitFilesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InitFilesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): InitFilesResponse { + return {}; + }, + + toJSON(_: InitFilesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<InitFilesResponse>, I>>(base?: I): InitFilesResponse { + return InitFilesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<InitFilesResponse>, I>>(_: I): InitFilesResponse { + const message = createBaseInitFilesResponse(); + return message; + }, +}; + +function createBaseIsPathEmptyRequest(): IsPathEmptyRequest { + return { projectRoot: "" }; +} + +export const IsPathEmptyRequest = { + encode(message: IsPathEmptyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IsPathEmptyRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIsPathEmptyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): IsPathEmptyRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: IsPathEmptyRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<IsPathEmptyRequest>, I>>(base?: I): IsPathEmptyRequest { + return IsPathEmptyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<IsPathEmptyRequest>, I>>(object: I): IsPathEmptyRequest { + const message = createBaseIsPathEmptyRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseIsPathEmptyResponse(): IsPathEmptyResponse { + return { isEmpty: false }; +} + +export const IsPathEmptyResponse = { + encode(message: IsPathEmptyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.isEmpty !== false) { + writer.uint32(8).bool(message.isEmpty); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): IsPathEmptyResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIsPathEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.isEmpty = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): IsPathEmptyResponse { + return { isEmpty: isSet(object.isEmpty) ? gt.Boolean(object.isEmpty) : false }; + }, + + toJSON(message: IsPathEmptyResponse): unknown { + const obj: any = {}; + if (message.isEmpty !== false) { + obj.isEmpty = message.isEmpty; + } + return obj; + }, + + create<I extends Exact<DeepPartial<IsPathEmptyResponse>, I>>(base?: I): IsPathEmptyResponse { + return IsPathEmptyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<IsPathEmptyResponse>, I>>(object: I): IsPathEmptyResponse { + const message = createBaseIsPathEmptyResponse(); + message.isEmpty = object.isEmpty ?? false; + return message; + }, +}; + +function createBaseGenerateProjectFilesRequest(): GenerateProjectFilesRequest { + return { connectionConfig: undefined }; +} + +export const GenerateProjectFilesRequest = { + encode(message: GenerateProjectFilesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.connectionConfig !== undefined) { + ConnectionConfig.encode(message.connectionConfig, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenerateProjectFilesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenerateProjectFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.connectionConfig = ConnectionConfig.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenerateProjectFilesRequest { + return { + connectionConfig: isSet(object.connectionConfig) ? ConnectionConfig.fromJSON(object.connectionConfig) : undefined, + }; + }, + + toJSON(message: GenerateProjectFilesRequest): unknown { + const obj: any = {}; + if (message.connectionConfig !== undefined) { + obj.connectionConfig = ConnectionConfig.toJSON(message.connectionConfig); + } + return obj; + }, + + create<I extends Exact<DeepPartial<GenerateProjectFilesRequest>, I>>(base?: I): GenerateProjectFilesRequest { + return GenerateProjectFilesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GenerateProjectFilesRequest>, I>>(object: I): GenerateProjectFilesRequest { + const message = createBaseGenerateProjectFilesRequest(); + message.connectionConfig = (object.connectionConfig !== undefined && object.connectionConfig !== null) + ? ConnectionConfig.fromPartial(object.connectionConfig) + : undefined; + return message; + }, +}; + +function createBaseGenerateProjectFilesResponse(): GenerateProjectFilesResponse { + return {}; +} + +export const GenerateProjectFilesResponse = { + encode(_: GenerateProjectFilesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenerateProjectFilesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenerateProjectFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): GenerateProjectFilesResponse { + return {}; + }, + + toJSON(_: GenerateProjectFilesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<GenerateProjectFilesResponse>, I>>(base?: I): GenerateProjectFilesResponse { + return GenerateProjectFilesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GenerateProjectFilesResponse>, I>>(_: I): GenerateProjectFilesResponse { + const message = createBaseGenerateProjectFilesResponse(); + return message; + }, +}; + +function createBaseStringifyProjectFileRequest(): StringifyProjectFileRequest { + return { projectFile: undefined }; +} + +export const StringifyProjectFileRequest = { + encode(message: StringifyProjectFileRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectFile !== undefined) { + ProjectFile.encode(message.projectFile, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StringifyProjectFileRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringifyProjectFileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectFile = ProjectFile.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringifyProjectFileRequest { + return { projectFile: isSet(object.projectFile) ? ProjectFile.fromJSON(object.projectFile) : undefined }; + }, + + toJSON(message: StringifyProjectFileRequest): unknown { + const obj: any = {}; + if (message.projectFile !== undefined) { + obj.projectFile = ProjectFile.toJSON(message.projectFile); + } + return obj; + }, + + create<I extends Exact<DeepPartial<StringifyProjectFileRequest>, I>>(base?: I): StringifyProjectFileRequest { + return StringifyProjectFileRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<StringifyProjectFileRequest>, I>>(object: I): StringifyProjectFileRequest { + const message = createBaseStringifyProjectFileRequest(); + message.projectFile = (object.projectFile !== undefined && object.projectFile !== null) + ? ProjectFile.fromPartial(object.projectFile) + : undefined; + return message; + }, +}; + +function createBaseStringifyProjectFileResponse(): StringifyProjectFileResponse { + return { stringifiedProjectFile: "" }; +} + +export const StringifyProjectFileResponse = { + encode(message: StringifyProjectFileResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.stringifiedProjectFile !== "") { + writer.uint32(10).string(message.stringifiedProjectFile); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): StringifyProjectFileResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringifyProjectFileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.stringifiedProjectFile = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringifyProjectFileResponse { + return { + stringifiedProjectFile: isSet(object.stringifiedProjectFile) ? gt.String(object.stringifiedProjectFile) : "", + }; + }, + + toJSON(message: StringifyProjectFileResponse): unknown { + const obj: any = {}; + if (message.stringifiedProjectFile !== "") { + obj.stringifiedProjectFile = message.stringifiedProjectFile; + } + return obj; + }, + + create<I extends Exact<DeepPartial<StringifyProjectFileResponse>, I>>(base?: I): StringifyProjectFileResponse { + return StringifyProjectFileResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<StringifyProjectFileResponse>, I>>(object: I): StringifyProjectFileResponse { + const message = createBaseStringifyProjectFileResponse(); + message.stringifiedProjectFile = object.stringifiedProjectFile ?? ""; + return message; + }, +}; + +function createBaseListAssetsRequest(): ListAssetsRequest { + return { projectRoot: "" }; +} + +export const ListAssetsRequest = { + encode(message: ListAssetsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(26).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAssetsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAssetsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAssetsRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: ListAssetsRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListAssetsRequest>, I>>(base?: I): ListAssetsRequest { + return ListAssetsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListAssetsRequest>, I>>(object: I): ListAssetsRequest { + const message = createBaseListAssetsRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseListAssetsResponse(): ListAssetsResponse { + return { assets: [] }; +} + +export const ListAssetsResponse = { + encode(message: ListAssetsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.assets) { + ListAssetsResponse_Asset.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAssetsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAssetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.assets.push(ListAssetsResponse_Asset.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAssetsResponse { + return { + assets: gt.Array.isArray(object?.assets) + ? object.assets.map((e: any) => ListAssetsResponse_Asset.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListAssetsResponse): unknown { + const obj: any = {}; + if (message.assets?.length) { + obj.assets = message.assets.map((e) => ListAssetsResponse_Asset.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListAssetsResponse>, I>>(base?: I): ListAssetsResponse { + return ListAssetsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListAssetsResponse>, I>>(object: I): ListAssetsResponse { + const message = createBaseListAssetsResponse(); + message.assets = object.assets?.map((e) => ListAssetsResponse_Asset.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListAssetsResponse_Asset(): ListAssetsResponse_Asset { + return { name: "", description: undefined, tags: [], assetType: 0, filePath: "" }; +} + +export const ListAssetsResponse_Asset = { + encode(message: ListAssetsResponse_Asset, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + for (const v of message.tags) { + writer.uint32(42).string(v!); + } + if (message.assetType !== 0) { + writer.uint32(24).int32(message.assetType); + } + if (message.filePath !== "") { + writer.uint32(34).string(message.filePath); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListAssetsResponse_Asset { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAssetsResponse_Asset(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tags.push(reader.string()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.assetType = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.filePath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAssetsResponse_Asset { + return { + name: isSet(object.name) ? gt.String(object.name) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + tags: gt.Array.isArray(object?.tags) ? object.tags.map((e: any) => gt.String(e)) : [], + assetType: isSet(object.assetType) ? listAssetsResponse_Asset_AssetTypeFromJSON(object.assetType) : 0, + filePath: isSet(object.filePath) ? gt.String(object.filePath) : "", + }; + }, + + toJSON(message: ListAssetsResponse_Asset): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.tags?.length) { + obj.tags = message.tags; + } + if (message.assetType !== 0) { + obj.assetType = listAssetsResponse_Asset_AssetTypeToJSON(message.assetType); + } + if (message.filePath !== "") { + obj.filePath = message.filePath; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ListAssetsResponse_Asset>, I>>(base?: I): ListAssetsResponse_Asset { + return ListAssetsResponse_Asset.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ListAssetsResponse_Asset>, I>>(object: I): ListAssetsResponse_Asset { + const message = createBaseListAssetsResponse_Asset(); + message.name = object.name ?? ""; + message.description = object.description ?? undefined; + message.tags = object.tags?.map((e) => e) || []; + message.assetType = object.assetType ?? 0; + message.filePath = object.filePath ?? ""; + return message; + }, +}; + +function createBaseParseProjectRequest(): ParseProjectRequest { + return { projectRoot: "" }; +} + +export const ParseProjectRequest = { + encode(message: ParseProjectRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(26).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParseProjectRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParseProjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParseProjectRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: ParseProjectRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ParseProjectRequest>, I>>(base?: I): ParseProjectRequest { + return ParseProjectRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ParseProjectRequest>, I>>(object: I): ParseProjectRequest { + const message = createBaseParseProjectRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseParseProjectResponse(): ParseProjectResponse { + return { project: undefined }; +} + +export const ParseProjectResponse = { + encode(message: ParseProjectResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.project !== undefined) { + Project.encode(message.project, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ParseProjectResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParseProjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.project = Project.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParseProjectResponse { + return { project: isSet(object.project) ? Project.fromJSON(object.project) : undefined }; + }, + + toJSON(message: ParseProjectResponse): unknown { + const obj: any = {}; + if (message.project !== undefined) { + obj.project = Project.toJSON(message.project); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ParseProjectResponse>, I>>(base?: I): ParseProjectResponse { + return ParseProjectResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ParseProjectResponse>, I>>(object: I): ParseProjectResponse { + const message = createBaseParseProjectResponse(); + message.project = (object.project !== undefined && object.project !== null) + ? Project.fromPartial(object.project) + : undefined; + return message; + }, +}; + +function createBaseRenderSchemaRequest(): RenderSchemaRequest { + return { projectRoot: "" }; +} + +export const RenderSchemaRequest = { + encode(message: RenderSchemaRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(26).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RenderSchemaRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRenderSchemaRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RenderSchemaRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: RenderSchemaRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<RenderSchemaRequest>, I>>(base?: I): RenderSchemaRequest { + return RenderSchemaRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RenderSchemaRequest>, I>>(object: I): RenderSchemaRequest { + const message = createBaseRenderSchemaRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseRenderSchemaResponse(): RenderSchemaResponse { + return { schema: "" }; +} + +export const RenderSchemaResponse = { + encode(message: RenderSchemaResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.schema !== "") { + writer.uint32(10).string(message.schema); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RenderSchemaResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRenderSchemaResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.schema = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RenderSchemaResponse { + return { schema: isSet(object.schema) ? gt.String(object.schema) : "" }; + }, + + toJSON(message: RenderSchemaResponse): unknown { + const obj: any = {}; + if (message.schema !== "") { + obj.schema = message.schema; + } + return obj; + }, + + create<I extends Exact<DeepPartial<RenderSchemaResponse>, I>>(base?: I): RenderSchemaResponse { + return RenderSchemaResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RenderSchemaResponse>, I>>(object: I): RenderSchemaResponse { + const message = createBaseRenderSchemaResponse(); + message.schema = object.schema ?? ""; + return message; + }, +}; + +function createBaseReturnSQLForSeedsAndModelsRequest(): ReturnSQLForSeedsAndModelsRequest { + return { projectRoot: "", dbQualifier: "" }; +} + +export const ReturnSQLForSeedsAndModelsRequest = { + encode(message: ReturnSQLForSeedsAndModelsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(26).string(message.projectRoot); + } + if (message.dbQualifier !== "") { + writer.uint32(34).string(message.dbQualifier); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnSQLForSeedsAndModelsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnSQLForSeedsAndModelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.dbQualifier = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnSQLForSeedsAndModelsRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + dbQualifier: isSet(object.dbQualifier) ? gt.String(object.dbQualifier) : "", + }; + }, + + toJSON(message: ReturnSQLForSeedsAndModelsRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.dbQualifier !== "") { + obj.dbQualifier = message.dbQualifier; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnSQLForSeedsAndModelsRequest>, I>>( + base?: I, + ): ReturnSQLForSeedsAndModelsRequest { + return ReturnSQLForSeedsAndModelsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnSQLForSeedsAndModelsRequest>, I>>( + object: I, + ): ReturnSQLForSeedsAndModelsRequest { + const message = createBaseReturnSQLForSeedsAndModelsRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.dbQualifier = object.dbQualifier ?? ""; + return message; + }, +}; + +function createBaseReturnSQLForSeedsAndModelsResponse(): ReturnSQLForSeedsAndModelsResponse { + return { sql: [], project: undefined }; +} + +export const ReturnSQLForSeedsAndModelsResponse = { + encode(message: ReturnSQLForSeedsAndModelsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.sql) { + writer.uint32(10).string(v!); + } + if (message.project !== undefined) { + Project.encode(message.project, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnSQLForSeedsAndModelsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnSQLForSeedsAndModelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sql.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.project = Project.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnSQLForSeedsAndModelsResponse { + return { + sql: gt.Array.isArray(object?.sql) ? object.sql.map((e: any) => gt.String(e)) : [], + project: isSet(object.project) ? Project.fromJSON(object.project) : undefined, + }; + }, + + toJSON(message: ReturnSQLForSeedsAndModelsResponse): unknown { + const obj: any = {}; + if (message.sql?.length) { + obj.sql = message.sql; + } + if (message.project !== undefined) { + obj.project = Project.toJSON(message.project); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnSQLForSeedsAndModelsResponse>, I>>( + base?: I, + ): ReturnSQLForSeedsAndModelsResponse { + return ReturnSQLForSeedsAndModelsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnSQLForSeedsAndModelsResponse>, I>>( + object: I, + ): ReturnSQLForSeedsAndModelsResponse { + const message = createBaseReturnSQLForSeedsAndModelsResponse(); + message.sql = object.sql?.map((e) => e) || []; + message.project = (object.project !== undefined && object.project !== null) + ? Project.fromPartial(object.project) + : undefined; + return message; + }, +}; + +function createBaseReturnFullProjectDagRequest(): ReturnFullProjectDagRequest { + return { projectRoot: "" }; +} + +export const ReturnFullProjectDagRequest = { + encode(message: ReturnFullProjectDagRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnFullProjectDagRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnFullProjectDagRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnFullProjectDagRequest { + return { projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "" }; + }, + + toJSON(message: ReturnFullProjectDagRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnFullProjectDagRequest>, I>>(base?: I): ReturnFullProjectDagRequest { + return ReturnFullProjectDagRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnFullProjectDagRequest>, I>>(object: I): ReturnFullProjectDagRequest { + const message = createBaseReturnFullProjectDagRequest(); + message.projectRoot = object.projectRoot ?? ""; + return message; + }, +}; + +function createBaseReturnFullProjectDagResponse(): ReturnFullProjectDagResponse { + return { dag: undefined }; +} + +export const ReturnFullProjectDagResponse = { + encode(message: ReturnFullProjectDagResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.dag !== undefined) { + ProjectDag.encode(message.dag, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnFullProjectDagResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnFullProjectDagResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dag = ProjectDag.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnFullProjectDagResponse { + return { dag: isSet(object.dag) ? ProjectDag.fromJSON(object.dag) : undefined }; + }, + + toJSON(message: ReturnFullProjectDagResponse): unknown { + const obj: any = {}; + if (message.dag !== undefined) { + obj.dag = ProjectDag.toJSON(message.dag); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnFullProjectDagResponse>, I>>(base?: I): ReturnFullProjectDagResponse { + return ReturnFullProjectDagResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnFullProjectDagResponse>, I>>(object: I): ReturnFullProjectDagResponse { + const message = createBaseReturnFullProjectDagResponse(); + message.dag = (object.dag !== undefined && object.dag !== null) ? ProjectDag.fromPartial(object.dag) : undefined; + return message; + }, +}; + +function createBaseReturnDataForDocViewRequest(): ReturnDataForDocViewRequest { + return { projectRoot: "", assetName: "", cacheViewInformation: undefined }; +} + +export const ReturnDataForDocViewRequest = { + encode(message: ReturnDataForDocViewRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(10).string(message.projectRoot); + } + if (message.assetName !== "") { + writer.uint32(18).string(message.assetName); + } + if (message.cacheViewInformation !== undefined) { + CacheViewInformation.encode(message.cacheViewInformation, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnDataForDocViewRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnDataForDocViewRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.assetName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.cacheViewInformation = CacheViewInformation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnDataForDocViewRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + assetName: isSet(object.assetName) ? gt.String(object.assetName) : "", + cacheViewInformation: isSet(object.cacheViewInformation) + ? CacheViewInformation.fromJSON(object.cacheViewInformation) + : undefined, + }; + }, + + toJSON(message: ReturnDataForDocViewRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.assetName !== "") { + obj.assetName = message.assetName; + } + if (message.cacheViewInformation !== undefined) { + obj.cacheViewInformation = CacheViewInformation.toJSON(message.cacheViewInformation); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnDataForDocViewRequest>, I>>(base?: I): ReturnDataForDocViewRequest { + return ReturnDataForDocViewRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnDataForDocViewRequest>, I>>(object: I): ReturnDataForDocViewRequest { + const message = createBaseReturnDataForDocViewRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.assetName = object.assetName ?? ""; + message.cacheViewInformation = (object.cacheViewInformation !== undefined && object.cacheViewInformation !== null) + ? CacheViewInformation.fromPartial(object.cacheViewInformation) + : undefined; + return message; + }, +}; + +function createBaseReturnDataForDocViewResponse(): ReturnDataForDocViewResponse { + return { fullSql: "", description: undefined, dag: undefined, columns: [], isAssetInSchemaFiles: false }; +} + +export const ReturnDataForDocViewResponse = { + encode(message: ReturnDataForDocViewResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullSql !== "") { + writer.uint32(10).string(message.fullSql); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + if (message.dag !== undefined) { + ProjectDag.encode(message.dag, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.columns) { + ColumnDescription.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.isAssetInSchemaFiles !== false) { + writer.uint32(40).bool(message.isAssetInSchemaFiles); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnDataForDocViewResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnDataForDocViewResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullSql = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dag = ProjectDag.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columns.push(ColumnDescription.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.isAssetInSchemaFiles = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnDataForDocViewResponse { + return { + fullSql: isSet(object.fullSql) ? gt.String(object.fullSql) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + dag: isSet(object.dag) ? ProjectDag.fromJSON(object.dag) : undefined, + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnDescription.fromJSON(e)) : [], + isAssetInSchemaFiles: isSet(object.isAssetInSchemaFiles) ? gt.Boolean(object.isAssetInSchemaFiles) : false, + }; + }, + + toJSON(message: ReturnDataForDocViewResponse): unknown { + const obj: any = {}; + if (message.fullSql !== "") { + obj.fullSql = message.fullSql; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.dag !== undefined) { + obj.dag = ProjectDag.toJSON(message.dag); + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => ColumnDescription.toJSON(e)); + } + if (message.isAssetInSchemaFiles !== false) { + obj.isAssetInSchemaFiles = message.isAssetInSchemaFiles; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnDataForDocViewResponse>, I>>(base?: I): ReturnDataForDocViewResponse { + return ReturnDataForDocViewResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnDataForDocViewResponse>, I>>(object: I): ReturnDataForDocViewResponse { + const message = createBaseReturnDataForDocViewResponse(); + message.fullSql = object.fullSql ?? ""; + message.description = object.description ?? undefined; + message.dag = (object.dag !== undefined && object.dag !== null) ? ProjectDag.fromPartial(object.dag) : undefined; + message.columns = object.columns?.map((e) => ColumnDescription.fromPartial(e)) || []; + message.isAssetInSchemaFiles = object.isAssetInSchemaFiles ?? false; + return message; + }, +}; + +function createBaseReturnFullSqlForAssetRequest(): ReturnFullSqlForAssetRequest { + return { projectRoot: "", assetName: "", cacheViewInformation: undefined }; +} + +export const ReturnFullSqlForAssetRequest = { + encode(message: ReturnFullSqlForAssetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(10).string(message.projectRoot); + } + if (message.assetName !== "") { + writer.uint32(18).string(message.assetName); + } + if (message.cacheViewInformation !== undefined) { + CacheViewInformation.encode(message.cacheViewInformation, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnFullSqlForAssetRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnFullSqlForAssetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.assetName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.cacheViewInformation = CacheViewInformation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnFullSqlForAssetRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + assetName: isSet(object.assetName) ? gt.String(object.assetName) : "", + cacheViewInformation: isSet(object.cacheViewInformation) + ? CacheViewInformation.fromJSON(object.cacheViewInformation) + : undefined, + }; + }, + + toJSON(message: ReturnFullSqlForAssetRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.assetName !== "") { + obj.assetName = message.assetName; + } + if (message.cacheViewInformation !== undefined) { + obj.cacheViewInformation = CacheViewInformation.toJSON(message.cacheViewInformation); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnFullSqlForAssetRequest>, I>>(base?: I): ReturnFullSqlForAssetRequest { + return ReturnFullSqlForAssetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnFullSqlForAssetRequest>, I>>(object: I): ReturnFullSqlForAssetRequest { + const message = createBaseReturnFullSqlForAssetRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.assetName = object.assetName ?? ""; + message.cacheViewInformation = (object.cacheViewInformation !== undefined && object.cacheViewInformation !== null) + ? CacheViewInformation.fromPartial(object.cacheViewInformation) + : undefined; + return message; + }, +}; + +function createBaseCacheViewInformation(): CacheViewInformation { + return { cacheView: undefined }; +} + +export const CacheViewInformation = { + encode(message: CacheViewInformation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + switch (message.cacheView?.$case) { + case "cacheViewInformation": + CacheViewInformationPaths.encode(message.cacheView.cacheViewInformation, writer.uint32(10).fork()).ldelim(); + break; + case "doNotUse": + Empty.encode(message.cacheView.doNotUse, writer.uint32(18).fork()).ldelim(); + break; + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CacheViewInformation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCacheViewInformation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cacheView = { + $case: "cacheViewInformation", + cacheViewInformation: CacheViewInformationPaths.decode(reader, reader.uint32()), + }; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.cacheView = { $case: "doNotUse", doNotUse: Empty.decode(reader, reader.uint32()) }; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CacheViewInformation { + return { + cacheView: isSet(object.cacheViewInformation) + ? { + $case: "cacheViewInformation", + cacheViewInformation: CacheViewInformationPaths.fromJSON(object.cacheViewInformation), + } + : isSet(object.doNotUse) + ? { $case: "doNotUse", doNotUse: Empty.fromJSON(object.doNotUse) } + : undefined, + }; + }, + + toJSON(message: CacheViewInformation): unknown { + const obj: any = {}; + if (message.cacheView?.$case === "cacheViewInformation") { + obj.cacheViewInformation = CacheViewInformationPaths.toJSON(message.cacheView.cacheViewInformation); + } + if (message.cacheView?.$case === "doNotUse") { + obj.doNotUse = Empty.toJSON(message.cacheView.doNotUse); + } + return obj; + }, + + create<I extends Exact<DeepPartial<CacheViewInformation>, I>>(base?: I): CacheViewInformation { + return CacheViewInformation.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<CacheViewInformation>, I>>(object: I): CacheViewInformation { + const message = createBaseCacheViewInformation(); + if ( + object.cacheView?.$case === "cacheViewInformation" && + object.cacheView?.cacheViewInformation !== undefined && + object.cacheView?.cacheViewInformation !== null + ) { + message.cacheView = { + $case: "cacheViewInformation", + cacheViewInformation: CacheViewInformationPaths.fromPartial(object.cacheView.cacheViewInformation), + }; + } + if ( + object.cacheView?.$case === "doNotUse" && + object.cacheView?.doNotUse !== undefined && + object.cacheView?.doNotUse !== null + ) { + message.cacheView = { $case: "doNotUse", doNotUse: Empty.fromPartial(object.cacheView.doNotUse) }; + } + return message; + }, +}; + +function createBaseCacheViewInformationPaths(): CacheViewInformationPaths { + return { cacheViewPaths: [] }; +} + +export const CacheViewInformationPaths = { + encode(message: CacheViewInformationPaths, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.cacheViewPaths) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CacheViewInformationPaths { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCacheViewInformationPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cacheViewPaths.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CacheViewInformationPaths { + return { + cacheViewPaths: gt.Array.isArray(object?.cacheViewPaths) + ? object.cacheViewPaths.map((e: any) => gt.String(e)) + : [], + }; + }, + + toJSON(message: CacheViewInformationPaths): unknown { + const obj: any = {}; + if (message.cacheViewPaths?.length) { + obj.cacheViewPaths = message.cacheViewPaths; + } + return obj; + }, + + create<I extends Exact<DeepPartial<CacheViewInformationPaths>, I>>(base?: I): CacheViewInformationPaths { + return CacheViewInformationPaths.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<CacheViewInformationPaths>, I>>(object: I): CacheViewInformationPaths { + const message = createBaseCacheViewInformationPaths(); + message.cacheViewPaths = object.cacheViewPaths?.map((e) => e) || []; + return message; + }, +}; + +function createBaseReturnFullSqlForAssetResponse(): ReturnFullSqlForAssetResponse { + return { fullSql: "", description: undefined, dag: undefined, columns: [] }; +} + +export const ReturnFullSqlForAssetResponse = { + encode(message: ReturnFullSqlForAssetResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.fullSql !== "") { + writer.uint32(10).string(message.fullSql); + } + if (message.description !== undefined) { + writer.uint32(18).string(message.description); + } + if (message.dag !== undefined) { + ProjectDag.encode(message.dag, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.columns) { + ColumnDescription.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnFullSqlForAssetResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnFullSqlForAssetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullSql = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dag = ProjectDag.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columns.push(ColumnDescription.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnFullSqlForAssetResponse { + return { + fullSql: isSet(object.fullSql) ? gt.String(object.fullSql) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + dag: isSet(object.dag) ? ProjectDag.fromJSON(object.dag) : undefined, + columns: gt.Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnDescription.fromJSON(e)) : [], + }; + }, + + toJSON(message: ReturnFullSqlForAssetResponse): unknown { + const obj: any = {}; + if (message.fullSql !== "") { + obj.fullSql = message.fullSql; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.dag !== undefined) { + obj.dag = ProjectDag.toJSON(message.dag); + } + if (message.columns?.length) { + obj.columns = message.columns.map((e) => ColumnDescription.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnFullSqlForAssetResponse>, I>>(base?: I): ReturnFullSqlForAssetResponse { + return ReturnFullSqlForAssetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnFullSqlForAssetResponse>, I>>( + object: I, + ): ReturnFullSqlForAssetResponse { + const message = createBaseReturnFullSqlForAssetResponse(); + message.fullSql = object.fullSql ?? ""; + message.description = object.description ?? undefined; + message.dag = (object.dag !== undefined && object.dag !== null) ? ProjectDag.fromPartial(object.dag) : undefined; + message.columns = object.columns?.map((e) => ColumnDescription.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetModelTableRequest(): GetModelTableRequest { + return { projectRoot: "", modelName: "" }; +} + +export const GetModelTableRequest = { + encode(message: GetModelTableRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(26).string(message.projectRoot); + } + if (message.modelName !== "") { + writer.uint32(34).string(message.modelName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetModelTableRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetModelTableRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.modelName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetModelTableRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelName: isSet(object.modelName) ? gt.String(object.modelName) : "", + }; + }, + + toJSON(message: GetModelTableRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelName !== "") { + obj.modelName = message.modelName; + } + return obj; + }, + + create<I extends Exact<DeepPartial<GetModelTableRequest>, I>>(base?: I): GetModelTableRequest { + return GetModelTableRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GetModelTableRequest>, I>>(object: I): GetModelTableRequest { + const message = createBaseGetModelTableRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelName = object.modelName ?? ""; + return message; + }, +}; + +function createBaseGetModelTableResponse(): GetModelTableResponse { + return { table: undefined }; +} + +export const GetModelTableResponse = { + encode(message: GetModelTableResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.table !== undefined) { + Table.encode(message.table, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetModelTableResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetModelTableResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.table = Table.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetModelTableResponse { + return { table: isSet(object.table) ? Table.fromJSON(object.table) : undefined }; + }, + + toJSON(message: GetModelTableResponse): unknown { + const obj: any = {}; + if (message.table !== undefined) { + obj.table = Table.toJSON(message.table); + } + return obj; + }, + + create<I extends Exact<DeepPartial<GetModelTableResponse>, I>>(base?: I): GetModelTableResponse { + return GetModelTableResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GetModelTableResponse>, I>>(object: I): GetModelTableResponse { + const message = createBaseGetModelTableResponse(); + message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; + return message; + }, +}; + +function createBaseCreateModelSchemaEntryRequest(): CreateModelSchemaEntryRequest { + return { projectRoot: "", modelName: "" }; +} + +export const CreateModelSchemaEntryRequest = { + encode(message: CreateModelSchemaEntryRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.modelName !== "") { + writer.uint32(26).string(message.modelName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateModelSchemaEntryRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateModelSchemaEntryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.modelName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateModelSchemaEntryRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelName: isSet(object.modelName) ? gt.String(object.modelName) : "", + }; + }, + + toJSON(message: CreateModelSchemaEntryRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelName !== "") { + obj.modelName = message.modelName; + } + return obj; + }, + + create<I extends Exact<DeepPartial<CreateModelSchemaEntryRequest>, I>>(base?: I): CreateModelSchemaEntryRequest { + return CreateModelSchemaEntryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<CreateModelSchemaEntryRequest>, I>>( + object: I, + ): CreateModelSchemaEntryRequest { + const message = createBaseCreateModelSchemaEntryRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelName = object.modelName ?? ""; + return message; + }, +}; + +function createBaseCreateModelSchemaEntryResponse(): CreateModelSchemaEntryResponse { + return { path: "", projectFile: undefined }; +} + +export const CreateModelSchemaEntryResponse = { + encode(message: CreateModelSchemaEntryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.projectFile !== undefined) { + ProjectFile.encode(message.projectFile, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateModelSchemaEntryResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateModelSchemaEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.projectFile = ProjectFile.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateModelSchemaEntryResponse { + return { + path: isSet(object.path) ? gt.String(object.path) : "", + projectFile: isSet(object.projectFile) ? ProjectFile.fromJSON(object.projectFile) : undefined, + }; + }, + + toJSON(message: CreateModelSchemaEntryResponse): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.projectFile !== undefined) { + obj.projectFile = ProjectFile.toJSON(message.projectFile); + } + return obj; + }, + + create<I extends Exact<DeepPartial<CreateModelSchemaEntryResponse>, I>>(base?: I): CreateModelSchemaEntryResponse { + return CreateModelSchemaEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<CreateModelSchemaEntryResponse>, I>>( + object: I, + ): CreateModelSchemaEntryResponse { + const message = createBaseCreateModelSchemaEntryResponse(); + message.path = object.path ?? ""; + message.projectFile = (object.projectFile !== undefined && object.projectFile !== null) + ? ProjectFile.fromPartial(object.projectFile) + : undefined; + return message; + }, +}; + +function createBaseUpdateAssetDescriptionRequest(): UpdateAssetDescriptionRequest { + return { projectRoot: "", assetName: "", description: "" }; +} + +export const UpdateAssetDescriptionRequest = { + encode(message: UpdateAssetDescriptionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.assetName !== "") { + writer.uint32(26).string(message.assetName); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateAssetDescriptionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateAssetDescriptionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.assetName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateAssetDescriptionRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + assetName: isSet(object.assetName) ? gt.String(object.assetName) : "", + description: isSet(object.description) ? gt.String(object.description) : "", + }; + }, + + toJSON(message: UpdateAssetDescriptionRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.assetName !== "") { + obj.assetName = message.assetName; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<UpdateAssetDescriptionRequest>, I>>(base?: I): UpdateAssetDescriptionRequest { + return UpdateAssetDescriptionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<UpdateAssetDescriptionRequest>, I>>( + object: I, + ): UpdateAssetDescriptionRequest { + const message = createBaseUpdateAssetDescriptionRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.assetName = object.assetName ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +function createBaseUpdateAssetDescriptionResponse(): UpdateAssetDescriptionResponse { + return {}; +} + +export const UpdateAssetDescriptionResponse = { + encode(_: UpdateAssetDescriptionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateAssetDescriptionResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateAssetDescriptionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): UpdateAssetDescriptionResponse { + return {}; + }, + + toJSON(_: UpdateAssetDescriptionResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<UpdateAssetDescriptionResponse>, I>>(base?: I): UpdateAssetDescriptionResponse { + return UpdateAssetDescriptionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<UpdateAssetDescriptionResponse>, I>>(_: I): UpdateAssetDescriptionResponse { + const message = createBaseUpdateAssetDescriptionResponse(); + return message; + }, +}; + +function createBaseAddColumnToModelOrSourceRequest(): AddColumnToModelOrSourceRequest { + return { projectRoot: "", modelOrSourceName: "", columnName: "" }; +} + +export const AddColumnToModelOrSourceRequest = { + encode(message: AddColumnToModelOrSourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.modelOrSourceName !== "") { + writer.uint32(26).string(message.modelOrSourceName); + } + if (message.columnName !== "") { + writer.uint32(34).string(message.columnName); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddColumnToModelOrSourceRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddColumnToModelOrSourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.modelOrSourceName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columnName = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddColumnToModelOrSourceRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelOrSourceName: isSet(object.modelOrSourceName) ? gt.String(object.modelOrSourceName) : "", + columnName: isSet(object.columnName) ? gt.String(object.columnName) : "", + }; + }, + + toJSON(message: AddColumnToModelOrSourceRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelOrSourceName !== "") { + obj.modelOrSourceName = message.modelOrSourceName; + } + if (message.columnName !== "") { + obj.columnName = message.columnName; + } + return obj; + }, + + create<I extends Exact<DeepPartial<AddColumnToModelOrSourceRequest>, I>>(base?: I): AddColumnToModelOrSourceRequest { + return AddColumnToModelOrSourceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AddColumnToModelOrSourceRequest>, I>>( + object: I, + ): AddColumnToModelOrSourceRequest { + const message = createBaseAddColumnToModelOrSourceRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelOrSourceName = object.modelOrSourceName ?? ""; + message.columnName = object.columnName ?? ""; + return message; + }, +}; + +function createBaseAddColumnToModelOrSourceResponse(): AddColumnToModelOrSourceResponse { + return {}; +} + +export const AddColumnToModelOrSourceResponse = { + encode(_: AddColumnToModelOrSourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddColumnToModelOrSourceResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddColumnToModelOrSourceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): AddColumnToModelOrSourceResponse { + return {}; + }, + + toJSON(_: AddColumnToModelOrSourceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<AddColumnToModelOrSourceResponse>, I>>( + base?: I, + ): AddColumnToModelOrSourceResponse { + return AddColumnToModelOrSourceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AddColumnToModelOrSourceResponse>, I>>( + _: I, + ): AddColumnToModelOrSourceResponse { + const message = createBaseAddColumnToModelOrSourceResponse(); + return message; + }, +}; + +function createBaseUpdateModelOrSourceColumnDescriptionRequest(): UpdateModelOrSourceColumnDescriptionRequest { + return { projectRoot: "", modelOrSourceName: "", columnName: "", description: undefined }; +} + +export const UpdateModelOrSourceColumnDescriptionRequest = { + encode(message: UpdateModelOrSourceColumnDescriptionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.modelOrSourceName !== "") { + writer.uint32(26).string(message.modelOrSourceName); + } + if (message.columnName !== "") { + writer.uint32(34).string(message.columnName); + } + if (message.description !== undefined) { + writer.uint32(42).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateModelOrSourceColumnDescriptionRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateModelOrSourceColumnDescriptionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.modelOrSourceName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columnName = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateModelOrSourceColumnDescriptionRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelOrSourceName: isSet(object.modelOrSourceName) ? gt.String(object.modelOrSourceName) : "", + columnName: isSet(object.columnName) ? gt.String(object.columnName) : "", + description: isSet(object.description) ? gt.String(object.description) : undefined, + }; + }, + + toJSON(message: UpdateModelOrSourceColumnDescriptionRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelOrSourceName !== "") { + obj.modelOrSourceName = message.modelOrSourceName; + } + if (message.columnName !== "") { + obj.columnName = message.columnName; + } + if (message.description !== undefined) { + obj.description = message.description; + } + return obj; + }, + + create<I extends Exact<DeepPartial<UpdateModelOrSourceColumnDescriptionRequest>, I>>( + base?: I, + ): UpdateModelOrSourceColumnDescriptionRequest { + return UpdateModelOrSourceColumnDescriptionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<UpdateModelOrSourceColumnDescriptionRequest>, I>>( + object: I, + ): UpdateModelOrSourceColumnDescriptionRequest { + const message = createBaseUpdateModelOrSourceColumnDescriptionRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelOrSourceName = object.modelOrSourceName ?? ""; + message.columnName = object.columnName ?? ""; + message.description = object.description ?? undefined; + return message; + }, +}; + +function createBaseUpdateModelOrSourceColumnDescriptionResponse(): UpdateModelOrSourceColumnDescriptionResponse { + return {}; +} + +export const UpdateModelOrSourceColumnDescriptionResponse = { + encode(_: UpdateModelOrSourceColumnDescriptionResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateModelOrSourceColumnDescriptionResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateModelOrSourceColumnDescriptionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): UpdateModelOrSourceColumnDescriptionResponse { + return {}; + }, + + toJSON(_: UpdateModelOrSourceColumnDescriptionResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<UpdateModelOrSourceColumnDescriptionResponse>, I>>( + base?: I, + ): UpdateModelOrSourceColumnDescriptionResponse { + return UpdateModelOrSourceColumnDescriptionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<UpdateModelOrSourceColumnDescriptionResponse>, I>>( + _: I, + ): UpdateModelOrSourceColumnDescriptionResponse { + const message = createBaseUpdateModelOrSourceColumnDescriptionResponse(); + return message; + }, +}; + +function createBaseAddColumnTestToModelOrSourceColumnRequest(): AddColumnTestToModelOrSourceColumnRequest { + return { projectRoot: "", modelOrSourceName: "", columnName: "", columnTest: undefined }; +} + +export const AddColumnTestToModelOrSourceColumnRequest = { + encode(message: AddColumnTestToModelOrSourceColumnRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.modelOrSourceName !== "") { + writer.uint32(26).string(message.modelOrSourceName); + } + if (message.columnName !== "") { + writer.uint32(34).string(message.columnName); + } + if (message.columnTest !== undefined) { + ColumnTest.encode(message.columnTest, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddColumnTestToModelOrSourceColumnRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddColumnTestToModelOrSourceColumnRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.modelOrSourceName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columnName = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.columnTest = ColumnTest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddColumnTestToModelOrSourceColumnRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelOrSourceName: isSet(object.modelOrSourceName) ? gt.String(object.modelOrSourceName) : "", + columnName: isSet(object.columnName) ? gt.String(object.columnName) : "", + columnTest: isSet(object.columnTest) ? ColumnTest.fromJSON(object.columnTest) : undefined, + }; + }, + + toJSON(message: AddColumnTestToModelOrSourceColumnRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelOrSourceName !== "") { + obj.modelOrSourceName = message.modelOrSourceName; + } + if (message.columnName !== "") { + obj.columnName = message.columnName; + } + if (message.columnTest !== undefined) { + obj.columnTest = ColumnTest.toJSON(message.columnTest); + } + return obj; + }, + + create<I extends Exact<DeepPartial<AddColumnTestToModelOrSourceColumnRequest>, I>>( + base?: I, + ): AddColumnTestToModelOrSourceColumnRequest { + return AddColumnTestToModelOrSourceColumnRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AddColumnTestToModelOrSourceColumnRequest>, I>>( + object: I, + ): AddColumnTestToModelOrSourceColumnRequest { + const message = createBaseAddColumnTestToModelOrSourceColumnRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelOrSourceName = object.modelOrSourceName ?? ""; + message.columnName = object.columnName ?? ""; + message.columnTest = (object.columnTest !== undefined && object.columnTest !== null) + ? ColumnTest.fromPartial(object.columnTest) + : undefined; + return message; + }, +}; + +function createBaseAddColumnTestToModelOrSourceColumnResponse(): AddColumnTestToModelOrSourceColumnResponse { + return {}; +} + +export const AddColumnTestToModelOrSourceColumnResponse = { + encode(_: AddColumnTestToModelOrSourceColumnResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AddColumnTestToModelOrSourceColumnResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddColumnTestToModelOrSourceColumnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): AddColumnTestToModelOrSourceColumnResponse { + return {}; + }, + + toJSON(_: AddColumnTestToModelOrSourceColumnResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<AddColumnTestToModelOrSourceColumnResponse>, I>>( + base?: I, + ): AddColumnTestToModelOrSourceColumnResponse { + return AddColumnTestToModelOrSourceColumnResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AddColumnTestToModelOrSourceColumnResponse>, I>>( + _: I, + ): AddColumnTestToModelOrSourceColumnResponse { + const message = createBaseAddColumnTestToModelOrSourceColumnResponse(); + return message; + }, +}; + +function createBaseRemoveColumnTestFromModelOrSourceColumnRequest(): RemoveColumnTestFromModelOrSourceColumnRequest { + return { projectRoot: "", modelOrSourceName: "", columnName: "", columnTest: undefined }; +} + +export const RemoveColumnTestFromModelOrSourceColumnRequest = { + encode( + message: RemoveColumnTestFromModelOrSourceColumnRequest, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.modelOrSourceName !== "") { + writer.uint32(26).string(message.modelOrSourceName); + } + if (message.columnName !== "") { + writer.uint32(34).string(message.columnName); + } + if (message.columnTest !== undefined) { + ColumnTest.encode(message.columnTest, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RemoveColumnTestFromModelOrSourceColumnRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRemoveColumnTestFromModelOrSourceColumnRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.modelOrSourceName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.columnName = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.columnTest = ColumnTest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): RemoveColumnTestFromModelOrSourceColumnRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + modelOrSourceName: isSet(object.modelOrSourceName) ? gt.String(object.modelOrSourceName) : "", + columnName: isSet(object.columnName) ? gt.String(object.columnName) : "", + columnTest: isSet(object.columnTest) ? ColumnTest.fromJSON(object.columnTest) : undefined, + }; + }, + + toJSON(message: RemoveColumnTestFromModelOrSourceColumnRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.modelOrSourceName !== "") { + obj.modelOrSourceName = message.modelOrSourceName; + } + if (message.columnName !== "") { + obj.columnName = message.columnName; + } + if (message.columnTest !== undefined) { + obj.columnTest = ColumnTest.toJSON(message.columnTest); + } + return obj; + }, + + create<I extends Exact<DeepPartial<RemoveColumnTestFromModelOrSourceColumnRequest>, I>>( + base?: I, + ): RemoveColumnTestFromModelOrSourceColumnRequest { + return RemoveColumnTestFromModelOrSourceColumnRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RemoveColumnTestFromModelOrSourceColumnRequest>, I>>( + object: I, + ): RemoveColumnTestFromModelOrSourceColumnRequest { + const message = createBaseRemoveColumnTestFromModelOrSourceColumnRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.modelOrSourceName = object.modelOrSourceName ?? ""; + message.columnName = object.columnName ?? ""; + message.columnTest = (object.columnTest !== undefined && object.columnTest !== null) + ? ColumnTest.fromPartial(object.columnTest) + : undefined; + return message; + }, +}; + +function createBaseRemoveColumnTestFromModelOrSourceColumnResponse(): RemoveColumnTestFromModelOrSourceColumnResponse { + return {}; +} + +export const RemoveColumnTestFromModelOrSourceColumnResponse = { + encode(_: RemoveColumnTestFromModelOrSourceColumnResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RemoveColumnTestFromModelOrSourceColumnResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRemoveColumnTestFromModelOrSourceColumnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): RemoveColumnTestFromModelOrSourceColumnResponse { + return {}; + }, + + toJSON(_: RemoveColumnTestFromModelOrSourceColumnResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<RemoveColumnTestFromModelOrSourceColumnResponse>, I>>( + base?: I, + ): RemoveColumnTestFromModelOrSourceColumnResponse { + return RemoveColumnTestFromModelOrSourceColumnResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<RemoveColumnTestFromModelOrSourceColumnResponse>, I>>( + _: I, + ): RemoveColumnTestFromModelOrSourceColumnResponse { + const message = createBaseRemoveColumnTestFromModelOrSourceColumnResponse(); + return message; + }, +}; + +function createBaseGenerateSourceFilesRequest(): GenerateSourceFilesRequest { + return { projectRoot: "", sources: [], folderPath: "" }; +} + +export const GenerateSourceFilesRequest = { + encode(message: GenerateSourceFilesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + for (const v of message.sources) { + DatabaseSource.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.folderPath !== "") { + writer.uint32(34).string(message.folderPath); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenerateSourceFilesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenerateSourceFilesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sources.push(DatabaseSource.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.folderPath = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenerateSourceFilesRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + sources: gt.Array.isArray(object?.sources) ? object.sources.map((e: any) => DatabaseSource.fromJSON(e)) : [], + folderPath: isSet(object.folderPath) ? gt.String(object.folderPath) : "", + }; + }, + + toJSON(message: GenerateSourceFilesRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.sources?.length) { + obj.sources = message.sources.map((e) => DatabaseSource.toJSON(e)); + } + if (message.folderPath !== "") { + obj.folderPath = message.folderPath; + } + return obj; + }, + + create<I extends Exact<DeepPartial<GenerateSourceFilesRequest>, I>>(base?: I): GenerateSourceFilesRequest { + return GenerateSourceFilesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GenerateSourceFilesRequest>, I>>(object: I): GenerateSourceFilesRequest { + const message = createBaseGenerateSourceFilesRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.sources = object.sources?.map((e) => DatabaseSource.fromPartial(e)) || []; + message.folderPath = object.folderPath ?? ""; + return message; + }, +}; + +function createBaseGenerateSourceFilesResponse(): GenerateSourceFilesResponse { + return {}; +} + +export const GenerateSourceFilesResponse = { + encode(_: GenerateSourceFilesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenerateSourceFilesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenerateSourceFilesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): GenerateSourceFilesResponse { + return {}; + }, + + toJSON(_: GenerateSourceFilesResponse): unknown { + const obj: any = {}; + return obj; + }, + + create<I extends Exact<DeepPartial<GenerateSourceFilesResponse>, I>>(base?: I): GenerateSourceFilesResponse { + return GenerateSourceFilesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GenerateSourceFilesResponse>, I>>(_: I): GenerateSourceFilesResponse { + const message = createBaseGenerateSourceFilesResponse(); + return message; + }, +}; + +function createBaseReturnDefinitionLocationsForSQLRequest(): ReturnDefinitionLocationsForSQLRequest { + return { projectRoot: "", sql: "" }; +} + +export const ReturnDefinitionLocationsForSQLRequest = { + encode(message: ReturnDefinitionLocationsForSQLRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(18).string(message.projectRoot); + } + if (message.sql !== "") { + writer.uint32(26).string(message.sql); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnDefinitionLocationsForSQLRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnDefinitionLocationsForSQLRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sql = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnDefinitionLocationsForSQLRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + sql: isSet(object.sql) ? gt.String(object.sql) : "", + }; + }, + + toJSON(message: ReturnDefinitionLocationsForSQLRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.sql !== "") { + obj.sql = message.sql; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLRequest>, I>>( + base?: I, + ): ReturnDefinitionLocationsForSQLRequest { + return ReturnDefinitionLocationsForSQLRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLRequest>, I>>( + object: I, + ): ReturnDefinitionLocationsForSQLRequest { + const message = createBaseReturnDefinitionLocationsForSQLRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.sql = object.sql ?? ""; + return message; + }, +}; + +function createBaseReturnDefinitionLocationsForSQLResponse(): ReturnDefinitionLocationsForSQLResponse { + return { definitions: [] }; +} + +export const ReturnDefinitionLocationsForSQLResponse = { + encode(message: ReturnDefinitionLocationsForSQLResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.definitions) { + ReturnDefinitionLocationsForSQLResponse_Definition.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnDefinitionLocationsForSQLResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnDefinitionLocationsForSQLResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.definitions.push(ReturnDefinitionLocationsForSQLResponse_Definition.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnDefinitionLocationsForSQLResponse { + return { + definitions: gt.Array.isArray(object?.definitions) + ? object.definitions.map((e: any) => ReturnDefinitionLocationsForSQLResponse_Definition.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ReturnDefinitionLocationsForSQLResponse): unknown { + const obj: any = {}; + if (message.definitions?.length) { + obj.definitions = message.definitions.map((e) => ReturnDefinitionLocationsForSQLResponse_Definition.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLResponse>, I>>( + base?: I, + ): ReturnDefinitionLocationsForSQLResponse { + return ReturnDefinitionLocationsForSQLResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLResponse>, I>>( + object: I, + ): ReturnDefinitionLocationsForSQLResponse { + const message = createBaseReturnDefinitionLocationsForSQLResponse(); + message.definitions = + object.definitions?.map((e) => ReturnDefinitionLocationsForSQLResponse_Definition.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseReturnDefinitionLocationsForSQLResponse_Definition(): ReturnDefinitionLocationsForSQLResponse_Definition { + return { range: undefined, targetModel: "", targetFile: "" }; +} + +export const ReturnDefinitionLocationsForSQLResponse_Definition = { + encode( + message: ReturnDefinitionLocationsForSQLResponse_Definition, + writer: _m0.Writer = _m0.Writer.create(), + ): _m0.Writer { + if (message.range !== undefined) { + Range.encode(message.range, writer.uint32(10).fork()).ldelim(); + } + if (message.targetModel !== "") { + writer.uint32(18).string(message.targetModel); + } + if (message.targetFile !== "") { + writer.uint32(26).string(message.targetFile); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnDefinitionLocationsForSQLResponse_Definition { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnDefinitionLocationsForSQLResponse_Definition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.range = Range.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.targetModel = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.targetFile = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnDefinitionLocationsForSQLResponse_Definition { + return { + range: isSet(object.range) ? Range.fromJSON(object.range) : undefined, + targetModel: isSet(object.targetModel) ? gt.String(object.targetModel) : "", + targetFile: isSet(object.targetFile) ? gt.String(object.targetFile) : "", + }; + }, + + toJSON(message: ReturnDefinitionLocationsForSQLResponse_Definition): unknown { + const obj: any = {}; + if (message.range !== undefined) { + obj.range = Range.toJSON(message.range); + } + if (message.targetModel !== "") { + obj.targetModel = message.targetModel; + } + if (message.targetFile !== "") { + obj.targetFile = message.targetFile; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLResponse_Definition>, I>>( + base?: I, + ): ReturnDefinitionLocationsForSQLResponse_Definition { + return ReturnDefinitionLocationsForSQLResponse_Definition.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnDefinitionLocationsForSQLResponse_Definition>, I>>( + object: I, + ): ReturnDefinitionLocationsForSQLResponse_Definition { + const message = createBaseReturnDefinitionLocationsForSQLResponse_Definition(); + message.range = (object.range !== undefined && object.range !== null) ? Range.fromPartial(object.range) : undefined; + message.targetModel = object.targetModel ?? ""; + message.targetFile = object.targetFile ?? ""; + return message; + }, +}; + +function createBaseReturnSQLForInjectedModelRequest(): ReturnSQLForInjectedModelRequest { + return { projectRoot: "", sql: "", temporaryId: "" }; +} + +export const ReturnSQLForInjectedModelRequest = { + encode(message: ReturnSQLForInjectedModelRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.projectRoot !== "") { + writer.uint32(10).string(message.projectRoot); + } + if (message.sql !== "") { + writer.uint32(18).string(message.sql); + } + if (message.temporaryId !== "") { + writer.uint32(26).string(message.temporaryId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnSQLForInjectedModelRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnSQLForInjectedModelRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.projectRoot = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sql = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.temporaryId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnSQLForInjectedModelRequest { + return { + projectRoot: isSet(object.projectRoot) ? gt.String(object.projectRoot) : "", + sql: isSet(object.sql) ? gt.String(object.sql) : "", + temporaryId: isSet(object.temporaryId) ? gt.String(object.temporaryId) : "", + }; + }, + + toJSON(message: ReturnSQLForInjectedModelRequest): unknown { + const obj: any = {}; + if (message.projectRoot !== "") { + obj.projectRoot = message.projectRoot; + } + if (message.sql !== "") { + obj.sql = message.sql; + } + if (message.temporaryId !== "") { + obj.temporaryId = message.temporaryId; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnSQLForInjectedModelRequest>, I>>( + base?: I, + ): ReturnSQLForInjectedModelRequest { + return ReturnSQLForInjectedModelRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnSQLForInjectedModelRequest>, I>>( + object: I, + ): ReturnSQLForInjectedModelRequest { + const message = createBaseReturnSQLForInjectedModelRequest(); + message.projectRoot = object.projectRoot ?? ""; + message.sql = object.sql ?? ""; + message.temporaryId = object.temporaryId ?? ""; + return message; + }, +}; + +function createBaseReturnSQLForInjectedModelResponse(): ReturnSQLForInjectedModelResponse { + return { sql: "" }; +} + +export const ReturnSQLForInjectedModelResponse = { + encode(message: ReturnSQLForInjectedModelResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sql !== "") { + writer.uint32(10).string(message.sql); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ReturnSQLForInjectedModelResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReturnSQLForInjectedModelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sql = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReturnSQLForInjectedModelResponse { + return { sql: isSet(object.sql) ? gt.String(object.sql) : "" }; + }, + + toJSON(message: ReturnSQLForInjectedModelResponse): unknown { + const obj: any = {}; + if (message.sql !== "") { + obj.sql = message.sql; + } + return obj; + }, + + create<I extends Exact<DeepPartial<ReturnSQLForInjectedModelResponse>, I>>( + base?: I, + ): ReturnSQLForInjectedModelResponse { + return ReturnSQLForInjectedModelResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ReturnSQLForInjectedModelResponse>, I>>( + object: I, + ): ReturnSQLForInjectedModelResponse { + const message = createBaseReturnSQLForInjectedModelResponse(); + message.sql = object.sql ?? ""; + return message; + }, +}; + +/** + * RustWithoutDatabaseService is the service that is used and where the database is not used and so not passed in as a + * parameter in. + */ +export interface RustWithoutDatabaseService { + /** GetProjectConfig returns the config from quary.yaml */ + GetProjectConfig(request: GetProjectConfigRequest): Promise<GetProjectConfigResponse>; + /** InitFiles returns the init files to start off a project. */ + InitFiles(request: InitFilesRequest): Promise<InitFilesResponse>; + /** ListFiles returns the list of files in the project, bar ignored files. */ + IsPathEmpty(request: IsPathEmptyRequest): Promise<IsPathEmptyResponse>; + /** StringifyProjectFile returns the stringified version of the given project file. */ + StringifyProjectFile(request: StringifyProjectFileRequest): Promise<StringifyProjectFileResponse>; + /** + * GenerateProjectFiles generates the project files after onboarding. This includes the project file, and some other + * ancillary files for set up like .gitignore, github actions, and some folders. + */ + GenerateProjectFiles(request: GenerateProjectFilesRequest): Promise<GenerateProjectFilesResponse>; +} + +export const RustWithoutDatabaseServiceServiceName = "quary.service.v1.RustWithoutDatabaseService"; +export class RustWithoutDatabaseServiceClientImpl implements RustWithoutDatabaseService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || RustWithoutDatabaseServiceServiceName; + this.rpc = rpc; + this.GetProjectConfig = this.GetProjectConfig.bind(this); + this.InitFiles = this.InitFiles.bind(this); + this.IsPathEmpty = this.IsPathEmpty.bind(this); + this.StringifyProjectFile = this.StringifyProjectFile.bind(this); + this.GenerateProjectFiles = this.GenerateProjectFiles.bind(this); + } + GetProjectConfig(request: GetProjectConfigRequest): Promise<GetProjectConfigResponse> { + const data = GetProjectConfigRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetProjectConfig", data); + return promise.then((data) => GetProjectConfigResponse.decode(_m0.Reader.create(data))); + } + + InitFiles(request: InitFilesRequest): Promise<InitFilesResponse> { + const data = InitFilesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "InitFiles", data); + return promise.then((data) => InitFilesResponse.decode(_m0.Reader.create(data))); + } + + IsPathEmpty(request: IsPathEmptyRequest): Promise<IsPathEmptyResponse> { + const data = IsPathEmptyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "IsPathEmpty", data); + return promise.then((data) => IsPathEmptyResponse.decode(_m0.Reader.create(data))); + } + + StringifyProjectFile(request: StringifyProjectFileRequest): Promise<StringifyProjectFileResponse> { + const data = StringifyProjectFileRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StringifyProjectFile", data); + return promise.then((data) => StringifyProjectFileResponse.decode(_m0.Reader.create(data))); + } + + GenerateProjectFiles(request: GenerateProjectFilesRequest): Promise<GenerateProjectFilesResponse> { + const data = GenerateProjectFilesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GenerateProjectFiles", data); + return promise.then((data) => GenerateProjectFilesResponse.decode(_m0.Reader.create(data))); + } +} + +/** + * RustServiceWithDatabase is the service that is used and where the database is used and so passed in as a parameter in + * the rpc calls + */ +export interface RustWithDatabaseService { + /** ListAssets returns a list of model, seeds, sources & snapshots */ + ListAssets(request: ListAssetsRequest): Promise<ListAssetsResponse>; + /** ParseProject returns the project for the given project file. */ + ParseProject(request: ParseProjectRequest): Promise<ParseProjectResponse>; + /** RenderSchema renderSchema returns the sql to create the views for the seeds and the models but without any data */ + RenderSchema(request: RenderSchemaRequest): Promise<RenderSchemaResponse>; + /** + * ReturnDataForDocView returns the data for the doc view for the given asset. It also includes the dag and columns + * and descriptions as well. At the moment it is a wrapper of ReturnFullSqlForAsset but we are moving towards making + * the extension "dumber" and so this will be the only way to get the data for the doc view and more logic will move + * WASM. + */ + ReturnDataForDocView(request: ReturnDataForDocViewRequest): Promise<ReturnDataForDocViewResponse>; + /** + * ReturnFullSqlForAsset returns the sql to create the view for the given asset. It also returns the dag and the + * columns as well as the description for the asset. + */ + ReturnFullSqlForAsset(request: ReturnFullSqlForAssetRequest): Promise<ReturnFullSqlForAssetResponse>; + /** ReturnFullProjectDag returns the dag for the full project. Manually Excludes tests from the dag response. */ + ReturnFullProjectDag(request: ReturnFullProjectDagRequest): Promise<ReturnFullProjectDagResponse>; + /** ReturnSQLForSeedsAndModels returns sql to create tables for the seeds and views for the models. */ + ReturnSQLForSeedsAndModels(request: ReturnSQLForSeedsAndModelsRequest): Promise<ReturnSQLForSeedsAndModelsResponse>; + /** + * ReturnSQLForInjectedModel returns the sql select statement that isn't part of the project yet but you want to + * inject into the project to get the sql out for it. + * TODO Implement caching + */ + ReturnSQLForInjectedModel(request: ReturnSQLForInjectedModelRequest): Promise<ReturnSQLForInjectedModelResponse>; + /** + * GetModelTableDetails returns the details of the model table. It can also return details for a source. + * + * If there is no schema entry this returns an error. + */ + GetModelTable(request: GetModelTableRequest): Promise<GetModelTableResponse>; + /** + * CreateModelSchemaEntry creates a schema entry for the given model. If the model already has a schema entry this returns nothing. + * By default the schema entry is created with the name of the model and no description. + * The schema is put inside the file schema.yaml in the same folder as the model's sql definition. + */ + CreateModelSchemaEntry(request: CreateModelSchemaEntryRequest): Promise<CreateModelSchemaEntryResponse>; + /** + * UpdateAssetDescription updates the description for the given model, source or snapshot. + * If the model or source cannot be found, UpdateAssetDescription essentially calls CreateModelSchemaEntry and + * adds the description to the schema entry. + */ + UpdateAssetDescription(request: UpdateAssetDescriptionRequest): Promise<UpdateAssetDescriptionResponse>; + /** + * AddColumnToModelOrSource adds a column to the given model schema definition. If the column already exists, this + * returns nothing. + */ + AddColumnToModelOrSource(request: AddColumnToModelOrSourceRequest): Promise<AddColumnToModelOrSourceResponse>; + /** + * UpdateModelOrSourceColumnDescription sets the description for the given column. If the column, model, source definition doesn't + * exist, this calls AddColumnToModelOrSource and then adds the description. + */ + UpdateModelOrSourceColumnDescription( + request: UpdateModelOrSourceColumnDescriptionRequest, + ): Promise<UpdateModelOrSourceColumnDescriptionResponse>; + /** + * AddColumnTestToModelOrSourceColumn adds a column test to the given column. If the column test already exists, this + * returns nothing. If no entry exists for the column, this creates it. + */ + AddColumnTestToModelOrSourceColumn( + request: AddColumnTestToModelOrSourceColumnRequest, + ): Promise<AddColumnTestToModelOrSourceColumnResponse>; + /** + * RemoveColumnTestFromModelOrSourceColumn removes a column test for a given column by finding a matching the full column test. + * If the column test does not exist, this returns nothing. If an entry exists for the column, this removes it. + */ + RemoveColumnTestFromModelOrSourceColumn( + request: RemoveColumnTestFromModelOrSourceColumnRequest, + ): Promise<RemoveColumnTestFromModelOrSourceColumnResponse>; + /** GenerateSourceFiles generates the source files for the given project that have been selected in an import flow. */ + GenerateSourceFiles(request: GenerateSourceFilesRequest): Promise<GenerateSourceFilesResponse>; + /** + * ReturnDefinitionLocationsForSQL takes in a SQL statement, looks for the models it references and returns location of those + * definitions in the file as well as the file path for the definition. + */ + ReturnDefinitionLocationsForSQL( + request: ReturnDefinitionLocationsForSQLRequest, + ): Promise<ReturnDefinitionLocationsForSQLResponse>; +} + +export const RustWithDatabaseServiceServiceName = "quary.service.v1.RustWithDatabaseService"; +export class RustWithDatabaseServiceClientImpl implements RustWithDatabaseService { + private readonly rpc: Rpc; + private readonly service: string; + constructor(rpc: Rpc, opts?: { service?: string }) { + this.service = opts?.service || RustWithDatabaseServiceServiceName; + this.rpc = rpc; + this.ListAssets = this.ListAssets.bind(this); + this.ParseProject = this.ParseProject.bind(this); + this.RenderSchema = this.RenderSchema.bind(this); + this.ReturnDataForDocView = this.ReturnDataForDocView.bind(this); + this.ReturnFullSqlForAsset = this.ReturnFullSqlForAsset.bind(this); + this.ReturnFullProjectDag = this.ReturnFullProjectDag.bind(this); + this.ReturnSQLForSeedsAndModels = this.ReturnSQLForSeedsAndModels.bind(this); + this.ReturnSQLForInjectedModel = this.ReturnSQLForInjectedModel.bind(this); + this.GetModelTable = this.GetModelTable.bind(this); + this.CreateModelSchemaEntry = this.CreateModelSchemaEntry.bind(this); + this.UpdateAssetDescription = this.UpdateAssetDescription.bind(this); + this.AddColumnToModelOrSource = this.AddColumnToModelOrSource.bind(this); + this.UpdateModelOrSourceColumnDescription = this.UpdateModelOrSourceColumnDescription.bind(this); + this.AddColumnTestToModelOrSourceColumn = this.AddColumnTestToModelOrSourceColumn.bind(this); + this.RemoveColumnTestFromModelOrSourceColumn = this.RemoveColumnTestFromModelOrSourceColumn.bind(this); + this.GenerateSourceFiles = this.GenerateSourceFiles.bind(this); + this.ReturnDefinitionLocationsForSQL = this.ReturnDefinitionLocationsForSQL.bind(this); + } + ListAssets(request: ListAssetsRequest): Promise<ListAssetsResponse> { + const data = ListAssetsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListAssets", data); + return promise.then((data) => ListAssetsResponse.decode(_m0.Reader.create(data))); + } + + ParseProject(request: ParseProjectRequest): Promise<ParseProjectResponse> { + const data = ParseProjectRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ParseProject", data); + return promise.then((data) => ParseProjectResponse.decode(_m0.Reader.create(data))); + } + + RenderSchema(request: RenderSchemaRequest): Promise<RenderSchemaResponse> { + const data = RenderSchemaRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RenderSchema", data); + return promise.then((data) => RenderSchemaResponse.decode(_m0.Reader.create(data))); + } + + ReturnDataForDocView(request: ReturnDataForDocViewRequest): Promise<ReturnDataForDocViewResponse> { + const data = ReturnDataForDocViewRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnDataForDocView", data); + return promise.then((data) => ReturnDataForDocViewResponse.decode(_m0.Reader.create(data))); + } + + ReturnFullSqlForAsset(request: ReturnFullSqlForAssetRequest): Promise<ReturnFullSqlForAssetResponse> { + const data = ReturnFullSqlForAssetRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnFullSqlForAsset", data); + return promise.then((data) => ReturnFullSqlForAssetResponse.decode(_m0.Reader.create(data))); + } + + ReturnFullProjectDag(request: ReturnFullProjectDagRequest): Promise<ReturnFullProjectDagResponse> { + const data = ReturnFullProjectDagRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnFullProjectDag", data); + return promise.then((data) => ReturnFullProjectDagResponse.decode(_m0.Reader.create(data))); + } + + ReturnSQLForSeedsAndModels(request: ReturnSQLForSeedsAndModelsRequest): Promise<ReturnSQLForSeedsAndModelsResponse> { + const data = ReturnSQLForSeedsAndModelsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnSQLForSeedsAndModels", data); + return promise.then((data) => ReturnSQLForSeedsAndModelsResponse.decode(_m0.Reader.create(data))); + } + + ReturnSQLForInjectedModel(request: ReturnSQLForInjectedModelRequest): Promise<ReturnSQLForInjectedModelResponse> { + const data = ReturnSQLForInjectedModelRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnSQLForInjectedModel", data); + return promise.then((data) => ReturnSQLForInjectedModelResponse.decode(_m0.Reader.create(data))); + } + + GetModelTable(request: GetModelTableRequest): Promise<GetModelTableResponse> { + const data = GetModelTableRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GetModelTable", data); + return promise.then((data) => GetModelTableResponse.decode(_m0.Reader.create(data))); + } + + CreateModelSchemaEntry(request: CreateModelSchemaEntryRequest): Promise<CreateModelSchemaEntryResponse> { + const data = CreateModelSchemaEntryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "CreateModelSchemaEntry", data); + return promise.then((data) => CreateModelSchemaEntryResponse.decode(_m0.Reader.create(data))); + } + + UpdateAssetDescription(request: UpdateAssetDescriptionRequest): Promise<UpdateAssetDescriptionResponse> { + const data = UpdateAssetDescriptionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAssetDescription", data); + return promise.then((data) => UpdateAssetDescriptionResponse.decode(_m0.Reader.create(data))); + } + + AddColumnToModelOrSource(request: AddColumnToModelOrSourceRequest): Promise<AddColumnToModelOrSourceResponse> { + const data = AddColumnToModelOrSourceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddColumnToModelOrSource", data); + return promise.then((data) => AddColumnToModelOrSourceResponse.decode(_m0.Reader.create(data))); + } + + UpdateModelOrSourceColumnDescription( + request: UpdateModelOrSourceColumnDescriptionRequest, + ): Promise<UpdateModelOrSourceColumnDescriptionResponse> { + const data = UpdateModelOrSourceColumnDescriptionRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateModelOrSourceColumnDescription", data); + return promise.then((data) => UpdateModelOrSourceColumnDescriptionResponse.decode(_m0.Reader.create(data))); + } + + AddColumnTestToModelOrSourceColumn( + request: AddColumnTestToModelOrSourceColumnRequest, + ): Promise<AddColumnTestToModelOrSourceColumnResponse> { + const data = AddColumnTestToModelOrSourceColumnRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddColumnTestToModelOrSourceColumn", data); + return promise.then((data) => AddColumnTestToModelOrSourceColumnResponse.decode(_m0.Reader.create(data))); + } + + RemoveColumnTestFromModelOrSourceColumn( + request: RemoveColumnTestFromModelOrSourceColumnRequest, + ): Promise<RemoveColumnTestFromModelOrSourceColumnResponse> { + const data = RemoveColumnTestFromModelOrSourceColumnRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RemoveColumnTestFromModelOrSourceColumn", data); + return promise.then((data) => RemoveColumnTestFromModelOrSourceColumnResponse.decode(_m0.Reader.create(data))); + } + + GenerateSourceFiles(request: GenerateSourceFilesRequest): Promise<GenerateSourceFilesResponse> { + const data = GenerateSourceFilesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "GenerateSourceFiles", data); + return promise.then((data) => GenerateSourceFilesResponse.decode(_m0.Reader.create(data))); + } + + ReturnDefinitionLocationsForSQL( + request: ReturnDefinitionLocationsForSQLRequest, + ): Promise<ReturnDefinitionLocationsForSQLResponse> { + const data = ReturnDefinitionLocationsForSQLRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ReturnDefinitionLocationsForSQL", data); + return promise.then((data) => ReturnDefinitionLocationsForSQLResponse.decode(_m0.Reader.create(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>; +} + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const gt: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial<T> = T extends Builtin ? T + : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> + : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> + : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] } + : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } + : Partial<T>; + +type KeysOfUnion<T> = T extends T ? keyof T : never; +export type Exact<P, I extends P> = P extends Builtin ? P + : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/js/packages/proto/tsconfig.json b/js/packages/proto/tsconfig.json new file mode 100644 index 00000000..3baef5a6 --- /dev/null +++ b/js/packages/proto/tsconfig.json @@ -0,0 +1,100 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Language and Environment */ + "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "lib": [ + "ES2020" + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "ESNext" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + "types": [ + "node" + ] /* Specify type package names to be included without being referenced in a source file. */, + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, + "declarationMap": true /* Create sourcemaps for d.ts files. */, + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true /* Create source map files for emitted JavaScript files. */, + //"outFile": "./dist/index.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + "noEmitOnError": true /* Disable emitting files if any type checking errors are reported. */, + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": ["src/"] +} diff --git a/js/packages/quary-extension-bus/.gitignore b/js/packages/quary-extension-bus/.gitignore new file mode 100644 index 00000000..53c37a16 --- /dev/null +++ b/js/packages/quary-extension-bus/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/js/packages/quary-extension-bus/jest.config.js b/js/packages/quary-extension-bus/jest.config.js new file mode 100644 index 00000000..8bb37208 --- /dev/null +++ b/js/packages/quary-extension-bus/jest.config.js @@ -0,0 +1,5 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', +} diff --git a/js/packages/quary-extension-bus/package.json b/js/packages/quary-extension-bus/package.json new file mode 100644 index 00000000..60dcbfd6 --- /dev/null +++ b/js/packages/quary-extension-bus/package.json @@ -0,0 +1,26 @@ +{ + "name": "quary-extension-bus", + "private": true, + "version": "0.0.1", + "scripts": { + "build": "tsc", + "dev": "tsc -w", + "test": "jest" + }, + "files": [ + "/dist" + ], + "main": "dist/index.js", + "types": "dist/index.d.ts", + "dependencies": { + "@types/vscode": "^1.89.0" + }, + "devDependencies": { + "@jest/globals": "^29.7.0", + "@types/jest": "^29.5.12", + "@types/vscode-webview": "^1.57.5", + "jest": "^29.7.0", + "ts-jest": "^29.1.4", + "typescript": "^5.4.5" + } +} diff --git a/js/packages/quary-extension-bus/src/callBacks.ts b/js/packages/quary-extension-bus/src/callBacks.ts new file mode 100644 index 00000000..68e0f83f --- /dev/null +++ b/js/packages/quary-extension-bus/src/callBacks.ts @@ -0,0 +1,106 @@ +import type { ExtensionContext, WebviewPanel } from 'vscode' +import type { WebviewApi } from 'vscode-webview' +import { + OnboardingViewDatabaseType, + USE_GLOBAL_STATE_MESSAGE_TYPE_SET, + USE_GLOBAL_STATE_MESSAGE_TYPE_NOT_SET, + View, +} from './globalViewState' +import { + ColumnTest, + ProjectFileSource, +} from '@quary/proto/quary/service/v1/project_file' +import { ConnectionConfig } from '@quary/proto/quary/service/v1/connection_config' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' +import { ChartFile } from '@quary/proto/quary/service/v1/chart_file' + +export type Callbacks = { + useGlobalStateNotSet: null + documentationViewRunSqlQuery: null + documentationViewLoad: null + documentationViewOpenFile: { filePath: string } + documentationViewAddToSchema: null + documentationViewUpdateColumnDescription: { + column: string + description: string + } + documentationViewUpdateDescription: { description: string } + documentationViewAddColumn: { column: string } + documentationViewAddColumnTest: { + column: string + columnTest: ColumnTest + } + documentationViewRemoveColumnTest: { + column: string + columnTest: ColumnTest + } + onboardingViewGenerateProject: ConnectionConfig + onboardingViewRestartFlow: null + onboardingViewSelectDatabase: OnboardingViewDatabaseType + executeSQLViewRunQuery: { limit: number | undefined } + executeSQLViewExportCSV: { data: QueryResult } + executeSQLViewCopyToClipboard: { data: QueryResult } + importSources: { + sources: ProjectFileSource[] + folderPath: string + } + chartViewRunQuery: null + chartViewChangeHandler: ChartFile + chartViewMakeSourceEdit: ChartFile['source'] + chartViewMakeChartEdit: ChartFile['config'] + chartViewOpenTextEditor: null + chartViewCreateModel: string +} + +export const useCallBackFrontEnd = <T extends keyof Callbacks>( + methodArray: T[], + messagePoster: WebviewApi<any>['postMessage'], +): { [K in T]: (message: Callbacks[K]) => void } => { + const handlers: Partial<Record<T, (message: Callbacks[T]) => void>> = {} + methodArray.forEach((method) => { + handlers[method] = async (message: Callbacks[T]) => { + // Implementation of each method, for example, you could post a message back to the parent window + messagePoster({ type: method, payload: message }) + } + }) + return handlers as Record<T, (message: Callbacks[T]) => void> +} + +export const useCallBackBackEnd = <T extends keyof Callbacks>( + methodArray: T[], + callbacks: Partial<{ + [K in T]: ( + message: Callbacks[K], + setState: (state: View) => void, + panel: WebviewPanel, + ) => Promise<void> + }>, + setState: (state: View) => void, + panel: WebviewPanel, + context: ExtensionContext, +) => { + const methodSet = new Set(methodArray) + panel.webview.onDidReceiveMessage( + async (event: { type: string; payload: Object }) => { + if ( + event.type === USE_GLOBAL_STATE_MESSAGE_TYPE_SET || + event.type === USE_GLOBAL_STATE_MESSAGE_TYPE_NOT_SET + ) { + return + } else { + const { type, payload } = event + if (!methodSet.has(type as T)) { + throw new Error(`Unknown command ${type}`) + } + const callback = callbacks[type as T] + if (callback) { + await callback(payload as Callbacks[T], setState, panel) + } else { + throw new Error(`Unknown command ${type}`) + } + } + }, + undefined, + context.subscriptions, + ) +} diff --git a/js/packages/quary-extension-bus/src/config.ts b/js/packages/quary-extension-bus/src/config.ts new file mode 100644 index 00000000..616b2db5 --- /dev/null +++ b/js/packages/quary-extension-bus/src/config.ts @@ -0,0 +1,44 @@ +/** + * Database dependent settings are settings in the extension that are + * dependent on the database type. For example, any behavior that should + * be different for sqlite vs bigquery should be in this type. + */ +export type DatabaseDependentSettings = { + /** + * If true, queries will be run by default when certain windows are + * opened, for example, when the documentation of a model is opened. + * + * For local development like in Sqlite, this should be set to true because + * it is fast to run queries. For BigQuery, this should be set to false + * because it is slower to run queries, and it costs money. + */ + runQueriesByDefault: boolean + /** + * If true, the extension will look for cached views when attempting to run a query on a model against the data warehouse. + * + * For example, when running against BigQuery, the extension will look for a cached view in BigQuery that matches + * the model name and hash of the query. If it finds one, it will run the query against the cached view instead of the + * raw model. + */ + lookForCacheViews: boolean + /** + * If true, the extension will open the import sources view after the onboarding step has been completed. This should + * be made true for databases that exist outside Quary and where users may want to pull tables in. This is likely + * to be false for a in-process/in-memory database that spins up with Quary. + */ + importSourcesAfterOnboarding: boolean +} + +export type AIConfig = + | undefined + | { + type: 'openai' + apiKey: string + } + +export type SqlLanguage = + | 'sqlite' + | 'bigquery' + | 'snowflake' + | 'duckdb' + | 'postgresql' diff --git a/js/packages/quary-extension-bus/src/databaseBigQuery.ts b/js/packages/quary-extension-bus/src/databaseBigQuery.ts new file mode 100644 index 00000000..76dc2b6b --- /dev/null +++ b/js/packages/quary-extension-bus/src/databaseBigQuery.ts @@ -0,0 +1,157 @@ +import { Err, ErrorCodes, isErr, Ok, Result } from './result' +import { + BigQueryJobReference, + BigQueryJobResults, + BigQueryJobStatus, +} from '@quary/proto/quary/service/v1/connection_response' +import { columnsValuesToQueryResult } from './shared' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' + +export async function makeBigQueryRequest<T>( + accessToken: string, + url: string, + method: 'GET' | 'POST' | 'PUT' | 'DELETE' = 'GET', + body?: object, +): Promise<Result<T>> { + try { + const headers = { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, + } + const fetchOptions: RequestInit = { method, headers } + + if (body) { + fetchOptions.body = JSON.stringify(body) + } + const response = await fetch(url, fetchOptions) + + if (!response.ok) { + switch (response.status) { + case 400: + // TODO - this is a bit of a hack, we should be parsing the response + const jsonResponse = await response.json() + if (typeof jsonResponse.error?.message === 'string') { + return Err({ + code: ErrorCodes.INVALID_ARGUMENT, + message: jsonResponse.error.message, + }) + } + return Err({ + code: ErrorCodes.INVALID_ARGUMENT, + message: + 'Invalid argument in call to BigQuery API, ' + + JSON.stringify(jsonResponse), + }) + case 401: + return Err({ + code: ErrorCodes.UNAUTHENTICATED, + message: 'Unauthorized call to BigQuery API', + }) + case 403: + return Err({ + code: ErrorCodes.PERMISSION_DENIED, + message: 'Permission denied in call to BigQuery API', + }) + case 404: + return Err({ + code: ErrorCodes.NOT_FOUND, + message: 'Not found in call to BigQuery API', + }) + case 500: + return Err({ + code: ErrorCodes.INTERNAL, + message: 'Internal error in BigQuery', + }) + case 503: + return Err({ + code: ErrorCodes.UNAVAILABLE, + message: 'BigQuery unavailable', + }) + default: + return Err({ + code: ErrorCodes.UNKNOWN, + message: `HTTP error: ${response.status} from BigQuery`, + }) + } + } + const jsonResponse = await response.json() + return Ok(jsonResponse as T) + } catch (error) { + const errorMessage = + error instanceof Error ? error.message : 'Unknown error occurred' + return Err({ code: ErrorCodes.UNKNOWN, message: errorMessage }) + } +} + +export const runBigQueryStatement = async ( + accessToken: string, + query: string, + projectId: string, +): Promise<Result<QueryResult>> => { + const payload = { + configuration: { + query: { + query, + useLegacySql: false, + }, + }, + } + const response = await makeBigQueryRequest<{ + jobReference: BigQueryJobReference + }>( + accessToken, + `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/jobs`, + 'POST', + payload, + ) + if (isErr(response)) { + return response + } + + const { + jobReference: { location: jobLocation, jobId }, + } = response.value + + // Poll the job for completion + const jobUrl = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/jobs/${jobId}?location=${jobLocation}` + + let jobDone = false + let jobJsonResponse + while (!jobDone) { + const jobResponse = await makeBigQueryRequest<{ + status: BigQueryJobStatus + }>(accessToken, jobUrl) + if (isErr(jobResponse)) { + return jobResponse + } + jobJsonResponse = jobResponse.value + jobDone = jobJsonResponse.status.state === 'DONE' + + if (!jobDone) { + await new Promise((resolve) => setTimeout(resolve, 1000)) + } + } + if (!jobJsonResponse) { + throw new Error('Job response is undefined') + } + const resultsUrl = `https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries/${jobId}?location=${jobLocation}` + const jobResults = await makeBigQueryRequest<BigQueryJobResults>( + accessToken, + resultsUrl, + 'GET', + ) + if (isErr(jobResults)) { + return jobResults // TODO: improve error handling + } + const values = jobResults.value.rows?.map((r) => r.f.map((f) => f.v)) || [] + const columns = + jobResults.value.schema?.fields?.map((f) => { + const type = f.mode === 'REPEATED' ? `ARRAY<${f.type}>` : f.type + return { + column: f.name, + type, + } + }) || [] + const out = columnsValuesToQueryResult({ columns, values }) + return Ok(out) +} diff --git a/js/packages/quary-extension-bus/src/databaseSnowflake.ts b/js/packages/quary-extension-bus/src/databaseSnowflake.ts new file mode 100644 index 00000000..c482d791 --- /dev/null +++ b/js/packages/quary-extension-bus/src/databaseSnowflake.ts @@ -0,0 +1,91 @@ +import { Err, ErrorCodes, isErr, Ok, Result } from './result' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' +import { columnsValuesToQueryResult } from './shared' + +export async function makeSnowflakeRequest<T>( + accessToken: string, + accountUrl: string, + body?: object, +): Promise<Result<T>> { + try { + const headers = { + 'Content-Type': 'application/json', + Authorization: `Bearer ${accessToken}`, + } + const fetchOptions: RequestInit = { method: 'POST', headers } + + if (body) { + fetchOptions.body = JSON.stringify(body) + } + const response = await fetch( + `${accountUrl}/api/v2/statements`, + fetchOptions, + ) + + if (!response.ok) { + const error = await response.json() + switch (response.status) { + case 400: + return Err({ + code: ErrorCodes.INVALID_ARGUMENT, + message: `Invalid argument in call to Snowflake API, ${JSON.stringify(error)}`, + }) + default: { + return Err({ + code: ErrorCodes.UNKNOWN, + message: `HTTP error: ${response.status}\nDetails: ${error.message}`, + }) + } + } + } + const jsonResponse = await response.json() + return Ok(jsonResponse as T) + } catch (error) { + const errorMessage = + error instanceof Error ? error.message : 'Unknown error occurred' + return Err({ + code: ErrorCodes.UNKNOWN, + message: `Failed to make Snowflake request: ${errorMessage}`, + }) + } +} + +export async function snowflakeRunStatement( + accessToken: string, + accountUrl: string, + database: string, + schema: string, + warehouse: string, + statement: string, +): Promise<Result<QueryResult>> { + const body = { + statement: statement.replace(/`/g, ''), + database, + schema, + warehouse, + } + const runStatementResponse = await makeSnowflakeRequest( + accessToken, + accountUrl, + body, + ) + if (isErr(runStatementResponse)) { + return runStatementResponse + } + const { resultSetMetaData, data: values } = runStatementResponse.value as { + resultSetMetaData: { + rowType: { + name: string + type: string + }[] + } + data: string[][] + } + + const columns = resultSetMetaData.rowType.map((row) => ({ + column: row.name, + type: row.type, + })) + const out = columnsValuesToQueryResult({ columns, values }) + return Ok(out) +} diff --git a/js/packages/quary-extension-bus/src/globalViewState.ts b/js/packages/quary-extension-bus/src/globalViewState.ts new file mode 100644 index 00000000..6c7375e7 --- /dev/null +++ b/js/packages/quary-extension-bus/src/globalViewState.ts @@ -0,0 +1,250 @@ +import { SqlLanguage } from './config' +import { ProjectDag } from '@quary/proto/quary/service/v1/project_dag' +import { ListAssetsResponse_Asset } from '@quary/proto/quary/service/v1/wasm_rust_rpc_calls' +import { Project } from '@quary/proto/quary/service/v1/project' +import { TestRunner } from '@quary/proto/quary/service/v1/test_runner' +import { ConnectionConfig } from '@quary/proto/quary/service/v1/connection_config' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' +import { ProjectFileSource } from '@quary/proto/quary/service/v1/project_file' +import { ChartFile } from '@quary/proto/quary/service/v1/chart_file' +import { Table } from '@quary/proto/quary/service/v1/table' +import { QuaryError } from './result' + +/** + * The message type that is sent to the webview when the global state is set. + */ +export const USE_GLOBAL_STATE_MESSAGE_TYPE_SET = 'useGlobalStateSet' +/** + * The message type that is sent to the webview when the global state is not set aimed at retrieving the current state. + */ +export const USE_GLOBAL_STATE_MESSAGE_TYPE_NOT_SET = 'useGlobalStateNotSet' + +export type Dag = { + dag: ProjectDag + models: ListAssetsResponse_Asset[] +} + +export type View = + | { + type: 'loading' + } + | { + type: 'error' + error: QuaryError + } + | { + type: 'onboarding' + states: OnboardingViewStates + } + | { + type: 'tables' + tables: string[] + views: string[] + } + | { + type: 'tests' + runner: TestRunner + tests: Test[] + } + | { + type: 'project' + project: Project + seedQueries: string[] + } + | { + type: 'schema' + fullSchema: string + language: SqlLanguage + } + | { + type: 'queryResults' + originalSql: string + language: SqlLanguage + results: QueryResult + limit?: number + } + | { + type: 'databaseConfigShow' + config?: ConnectionConfig + } + | { + type: 'databaseShowProjectFile' + projectFile: string + } + | { + type: 'docsView' + modelName: string + description: string | null + tags: string[] + language: SqlLanguage + results: SqlDocumentationResultsView + limit?: number + dag: Dag + table: Table | null + isModelInSchema: boolean + } + | { + type: 'importSources' + state: ImportSourcesViewState + } + | { + type: 'executeSQL' + results: SqlDocumentationResultsView + limit?: number + } + | { + // Used for editing charts + type: 'chartEditor' + data: ChartEditorData + } + +export type ChartEditorData = { + title: string + chartFile?: ChartFile + allAssets: string[] + results: + | { + type: 'not loaded' + } + | { + type: 'loading' + } + | { + type: 'error' + error: QuaryError + } + | { + type: 'success' + queryResult: QueryResult + } +} + +export type SqlDocumentationResultsView = + | { + type: 'notYetRun' + } + | { + type: 'run' + results: QueryResult + } + | { + type: 'error' + error: QuaryError + } + | { + type: 'loading' + } + +// TODO: Move to Proto or use existing Proto +export enum DatabaseOnboardingOptions { + BigQuery = 'bigQuery', + SQLite = 'sqlite', + SQLiteInMemory = 'sqliteInMemory', + Snowflake = 'snowflake', +} + +export type OnboardingViewStates = + | { type: 'init' } + | { + type: 'listSourcesLoading' + database: OnboardingViewDatabaseType + } + | { + type: 'listSourcesError' + database: OnboardingViewDatabaseType + error: string + } + | { + type: 'listSourcesSuccess' + sourceDetails: + | { + type: DatabaseOnboardingOptions.BigQuery + projectsAndDatasets: Record<string, string[]> + } + | { + type: DatabaseOnboardingOptions.Snowflake + databasesAndSchemas: Record<string, string[]> + config: { + accountUrl: string + clientId: string + clientSecret: string + role: string + warehouse: string + } + } + | { + type: DatabaseOnboardingOptions.SQLite + path: string + } + | { + type: DatabaseOnboardingOptions.SQLiteInMemory + } + } + | { + type: 'generateProjectError' + error: string + } + +export type OnboardingViewDatabaseType = + | { + type: DatabaseOnboardingOptions.BigQuery + } + | { + type: DatabaseOnboardingOptions.SQLite + path: string + } + | { + type: DatabaseOnboardingOptions.SQLiteInMemory + } + | { + type: DatabaseOnboardingOptions.Snowflake + accountUrl: string + clientId: string + clientSecret: string + warehouse: string + role: string + } + +export type TestStatus = + | { + type: 'pass' + } + | { + type: 'fail_with_result' + // TODO Add lines that failed + } + | { + type: 'fail_with_message' + message: string + } + | { + type: 'pass_inferred' + sourceTest: string[] + } + | { + type: 'fail_inferred' + sourceTest: string[] + } + | { + type: 'pass_inferred_from_logic' + explanation: string + } + +export type Test = { + testName: string + status: TestStatus + query: string +} + +export type ImportSourcesViewState = + | { + type: 'loading' + } + | { + type: 'error' + error: string + } + | { + type: 'success' + sources: ProjectFileSource[] + } diff --git a/js/packages/quary-extension-bus/src/jsonValue.ts b/js/packages/quary-extension-bus/src/jsonValue.ts new file mode 100644 index 00000000..71e242fd --- /dev/null +++ b/js/packages/quary-extension-bus/src/jsonValue.ts @@ -0,0 +1,48 @@ +export type JSONValue = + | string + | number + | boolean + | { [x: string]: JSONValue } + | Array<JSONValue> + +export type JSONValueWithNulls = + | string + | number + | boolean + | { [x: string]: JSONValueWithNulls } + | Array<JSONValueWithNulls> + | null + +/** + * Convert a non-legal JSONValueWithNulls to a valid JSONValue by recursively removing all null values + */ +export const dropNullValuesInJSONLike = ( + jsonLike: JSONValueWithNulls, +): JSONValue => { + if (jsonLike === null) { + throw new Error('Top-level value cannot be null') + } + + if (Array.isArray(jsonLike)) { + return jsonLike.reduce((acc: JSONValue[], curr: JSONValueWithNulls) => { + if (curr !== null) { + acc.push(dropNullValuesInJSONLike(curr) as JSONValue) + } + return acc + }, []) + } + + if (typeof jsonLike === 'object') { + return Object.entries(jsonLike).reduce( + (acc: { [x: string]: JSONValue }, [key, value]) => { + if (value !== null) { + acc[key] = dropNullValuesInJSONLike(value) as JSONValue + } + return acc + }, + {}, + ) + } + + return jsonLike +} diff --git a/js/packages/quary-extension-bus/src/result.ts b/js/packages/quary-extension-bus/src/result.ts new file mode 100644 index 00000000..471c6742 --- /dev/null +++ b/js/packages/quary-extension-bus/src/result.ts @@ -0,0 +1,136 @@ +/** + * Result type for functions that can fail. + */ + +export type Result<T> = Ok<T> | Err<QuaryError> +export type ResultE<T, E> = Ok<T> | Err<E> + +export type Ok<T> = { + readonly ok: true + readonly value: T +} + +export type Err<E> = { + readonly ok: false + readonly error: E +} + +export function Ok<T>(value: T): Ok<T> { + return { ok: true, value } +} + +export function Err<E>(error: E): Err<E> +export function Err(error: QuaryError): Err<QuaryError> { + return { ok: false, error } +} + +export function isOk<T>(result: ResultE<T, any>): result is Ok<T> +export function isOk<T>(result: Result<T>): result is Ok<T> { + return result.ok +} + +export function isErr<T, E>(result: ResultE<T, E>): result is Err<E> +export function isErr<T>(result: Result<T>): result is Err<QuaryError> { + return !result.ok +} + +/** + * Collects the results of an array of results into a single result. + */ +export function collectResults<T>( + array: Array<Result<T>>, +): ResultE<Array<T>, Array<QuaryError>> { + const errors: Array<QuaryError> = [] + const values: Array<T> = [] + for (const result of array) { + if (isErr(result)) { + errors.push(result.error) + } else { + values.push(result.value) + } + } + if (errors.length > 0) { + return Err(errors) + } + return Ok(values) +} + +export enum ErrorCodes { + OK = 0, + CANCELLED = 1, + UNKNOWN = 2, + INVALID_ARGUMENT = 3, + DEADLINE_EXCEEDED = 4, + NOT_FOUND = 5, + ALREADY_EXISTS = 6, + PERMISSION_DENIED = 7, + RESOURCE_EXHAUSTED = 8, + FAILED_PRECONDITION = 9, + ABORTED = 10, + OUT_OF_RANGE = 11, + UNIMPLEMENTED = 12, + INTERNAL = 13, + UNAVAILABLE = 14, + DATA_LOSS = 15, + UNAUTHENTICATED = 16, +} + +/** + * Converts an error code to a human-readable string. + * + */ +export function codeToString(code: ErrorCodes): string { + switch (code) { + case ErrorCodes.OK: + return 'Ok' + case ErrorCodes.CANCELLED: + return 'Cancelled' + case ErrorCodes.UNKNOWN: + return 'Unknown Error' + case ErrorCodes.INVALID_ARGUMENT: + return 'Invalid Argument' + case ErrorCodes.DEADLINE_EXCEEDED: + return 'Deadline Exceeded' + case ErrorCodes.NOT_FOUND: + return 'Not Found' + case ErrorCodes.ALREADY_EXISTS: + return 'Already Exists' + case ErrorCodes.PERMISSION_DENIED: + return 'Permission Denied' + case ErrorCodes.RESOURCE_EXHAUSTED: + return 'Resource Exhausted' + case ErrorCodes.FAILED_PRECONDITION: + return 'Failed Precondition' + case ErrorCodes.ABORTED: + return 'Aborted' + case ErrorCodes.OUT_OF_RANGE: + return 'Out of Range' + case ErrorCodes.UNIMPLEMENTED: + return 'Unimplemented' + case ErrorCodes.INTERNAL: + return 'Internal' + case ErrorCodes.UNAVAILABLE: + return 'Unavailable' + case ErrorCodes.DATA_LOSS: + return 'Data Loss' + case ErrorCodes.UNAUTHENTICATED: + return 'Unauthenticated' + default: + throw new Error(`Unknown error code: ${code} that should never happen`) + } +} + +export type QuaryError = { + code: ErrorCodes + message: string + tree?: QuaryError +} + +export function isQuaryError(value: unknown): value is QuaryError { + return ( + typeof value === 'object' && + value !== null && + 'code' in value && + 'message' in value + ) +} diff --git a/js/packages/quary-extension-bus/src/shared.ts b/js/packages/quary-extension-bus/src/shared.ts new file mode 100644 index 00000000..065df6c9 --- /dev/null +++ b/js/packages/quary-extension-bus/src/shared.ts @@ -0,0 +1,69 @@ +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' + +function transpose<T>(matrix: T[][]): T[][] { + // Assuming matrix is not empty and has uniform column lengths across rows + const rows = matrix.length + if (rows === 0) { + return [] + } + const cols = matrix[0].length + let newMatrix: T[][] = Array.from({ length: cols }, () => + Array.from({ length: rows }), + ) + + for (let i = 0; i < cols; i++) { + for (let j = 0; j < rows; j++) { + newMatrix[i][j] = matrix[j][i] + } + } + + return newMatrix +} + +export function columnsValuesToQueryResult({ + columns, + values, +}: { + columns: { column: string; type?: string | undefined }[] + values: string[][] +}): QueryResult { + const outValues = transpose(values) + if (columns.length === 0) { + return { + columns: [], + } + } + if (outValues.length === 0) { + return { + columns: columns.map(({ column: name, type }) => ({ + name, + type, + values: [], + })), + } + } + return { + columns: columns.map(({ column, type }, i) => ({ + name: column, + type, + values: outValues[i].map((v) => `${v}`), + })), + } +} + +export function queryResultToColumnsValues({ columns }: QueryResult): { + columns: { column: string; type: string | undefined }[] + values: string[][] +} { + const values = columns.map((column) => column.values) + const outValues = transpose(values) + const outColumns = columns.map((column) => ({ + column: column.name, + type: column.type, + })) + + return { + columns: outColumns, + values: outValues, + } +} diff --git a/js/packages/quary-extension-bus/src/sleep.ts b/js/packages/quary-extension-bus/src/sleep.ts new file mode 100644 index 00000000..6208254e --- /dev/null +++ b/js/packages/quary-extension-bus/src/sleep.ts @@ -0,0 +1,7 @@ +/** + * Sleep for a given amount of time + * + * @param ms - The amount of time to sleep in milliseconds + */ +export const sleep = (ms: number): Promise<void> => + new Promise((resolve) => setTimeout(resolve, ms)) diff --git a/js/packages/quary-extension-bus/test/shared.test.ts b/js/packages/quary-extension-bus/test/shared.test.ts new file mode 100644 index 00000000..afcb6aab --- /dev/null +++ b/js/packages/quary-extension-bus/test/shared.test.ts @@ -0,0 +1,141 @@ +import { + columnsValuesToQueryResult, + queryResultToColumnsValues, +} from '../src/shared' + +describe('columnsValuesToQueryResult', () => { + it('should transpose the values', () => { + const columns = ['a', 'b'].map((column) => ({ column })) + const values = [ + ['1', '2'], + ['3', '4'], + ] + const values_2 = [ + ['1', '2'], + ['3', '4'], + ] + + const queryResult = columnsValuesToQueryResult({ columns, values }) + expect(queryResult.columns).toEqual([ + { name: 'a', values: ['1', '3'] }, + { name: 'b', values: ['2', '4'] }, + ]) + expect(values).toEqual(values_2) + }) + + it('should transpose the values in non square matrix', () => { + const columns = ['a', 'b', 'c', 'd'].map((column) => ({ column })) + const values = [ + ['1', '2', '3', '4'], + ['3', '4', '5', '6'], + ] + const values_2 = [ + ['1', '2', '3', '4'], + ['3', '4', '5', '6'], + ] + + const queryResult = columnsValuesToQueryResult({ columns, values }) + expect(queryResult.columns).toEqual([ + { name: 'a', values: ['1', '3'] }, + { name: 'b', values: ['2', '4'] }, + { name: 'c', values: ['3', '5'] }, + { name: 'd', values: ['4', '6'] }, + ]) + expect(values).toEqual(values_2) + }) + + it('should transpose empty values', () => { + const columns = ['a', 'b', 'c', 'd'].map((column) => ({ column })) + const values: string[][] = [] + const values_2: string[][] = [] + + const queryResult = columnsValuesToQueryResult({ columns, values }) + expect(queryResult.columns).toEqual([ + { name: 'a', values: [] }, + { name: 'b', values: [] }, + { name: 'c', values: [] }, + { name: 'd', values: [] }, + ]) + expect(values).toEqual(values_2) + }) + + it('should transpose nothing', () => { + const columns: { column: string }[] = [] + const values: string[][] = [] + const values_2: string[][] = [] + + const queryResult = columnsValuesToQueryResult({ columns, values }) + expect(queryResult.columns).toEqual([]) + expect(values).toEqual(values_2) + }) +}) + +describe('queryResultToColumnsValues', () => { + it('should transpose the values', () => { + const queryResult = { + columns: [ + { name: 'a', values: ['1', '3'] }, + { name: 'b', values: ['2', '4'] }, + ], + } + const queryResult2 = { + columns: [ + { name: 'a', values: ['1', '3'] }, + { name: 'b', values: ['2', '4'] }, + ], + } + + const { columns, values } = queryResultToColumnsValues(queryResult) + expect(columns).toEqual(['a', 'b'].map((column) => ({ column }))) + expect(values).toEqual([ + ['1', '2'], + ['3', '4'], + ]) + expect(queryResult).toEqual(queryResult2) + }) + + it('should transpose empty values', () => { + const queryResult = { + columns: [ + { name: 'a', values: [] }, + { name: 'b', values: [] }, + ], + } + const queryResult2 = { + columns: [ + { name: 'a', values: [] }, + { name: 'b', values: [] }, + ], + } + + const { columns, values } = queryResultToColumnsValues(queryResult) + expect(columns).toEqual(['a', 'b'].map((column) => ({ column }))) + expect(values).toEqual([]) + expect(queryResult).toEqual(queryResult2) + }) + + it('should transpose non square values', () => { + const queryResult = { + columns: [ + { name: 'a', values: ['1', '4'] }, + { name: 'b', values: ['2', '5'] }, + { name: 'c', values: ['3', '6'] }, + ], + } + const queryResult2 = { + columns: [ + { name: 'a', values: ['1', '4'] }, + { name: 'b', values: ['2', '5'] }, + { name: 'c', values: ['3', '6'] }, + ], + } + + const { columns, values } = queryResultToColumnsValues(queryResult) + expect(columns).toEqual(['a', 'b', 'c'].map((column) => ({ column }))) + expect(values).toEqual([ + ['1', '2', '3'], + ['4', '5', '6'], + ]) + expect(queryResult).toEqual(queryResult2) + }) +}) diff --git a/js/packages/quary-extension-bus/tsconfig.json b/js/packages/quary-extension-bus/tsconfig.json new file mode 100644 index 00000000..fae065eb --- /dev/null +++ b/js/packages/quary-extension-bus/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "declaration": true, + "outDir": "./dist", + "strict": true, + "noEmit": true, + "moduleResolution": "node", + "baseUrl": "./", + "paths": { + "@quary/proto/*": ["../proto/src/generated/*"] + } + }, + "include": ["src/**/*"] +} diff --git a/js/packages/quary-extension-ui/.eslintrc.cjs b/js/packages/quary-extension-ui/.eslintrc.cjs new file mode 100644 index 00000000..8eb23bef --- /dev/null +++ b/js/packages/quary-extension-ui/.eslintrc.cjs @@ -0,0 +1,14 @@ +module.exports = { + env: { browser: true, es2020: true }, + extends: [ + '@quary/eslint-config-shared', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + ], + parser: '@typescript-eslint/parser', + parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, + plugins: ['react-refresh'], + rules: { + 'react-refresh/only-export-components': 'warn', + }, +} diff --git a/js/packages/quary-extension-ui/.gitignore b/js/packages/quary-extension-ui/.gitignore new file mode 100644 index 00000000..a547bf36 --- /dev/null +++ b/js/packages/quary-extension-ui/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/js/packages/quary-extension-ui/.storybook/main.cjs b/js/packages/quary-extension-ui/.storybook/main.cjs new file mode 100644 index 00000000..06d55093 --- /dev/null +++ b/js/packages/quary-extension-ui/.storybook/main.cjs @@ -0,0 +1,21 @@ +module.exports = { + core: { + disableTelemetry: true, + }, + + addons: ['@storybook/addon-a11y', '@storybook/addon-essentials'], + stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'], + + framework: { + name: '@storybook/react-vite', + options: {}, + }, + + typescript: { + reactDocgen: false, + }, + + docs: { + autodocs: true, + }, +} diff --git a/js/packages/quary-extension-ui/.storybook/preview.js b/js/packages/quary-extension-ui/.storybook/preview.js new file mode 100644 index 00000000..3975ec3a --- /dev/null +++ b/js/packages/quary-extension-ui/.storybook/preview.js @@ -0,0 +1,12 @@ +import '../src/index.css' +import './vscode-colours.css' + +export const parameters = { + actions: { argTypesRegex: '^on[A-Z].*' }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/, + }, + }, +} diff --git a/js/packages/quary-extension-ui/.storybook/vscode-colours.css b/js/packages/quary-extension-ui/.storybook/vscode-colours.css new file mode 100644 index 00000000..90e1b442 --- /dev/null +++ b/js/packages/quary-extension-ui/.storybook/vscode-colours.css @@ -0,0 +1,669 @@ +/* +Copy-pasted this from the VS Code web editor. It's a bit of a mess, but it's the only way to get the colours to match. +*/ + +:root { + --vscode-font-family: -apple-system, BlinkMacSystemFont, sans-serif; + --vscode-font-weight: normal; + --vscode-font-size: 13px; + --vscode-editor-font-family: Menlo, Monaco, 'Courier New', monospace; + --vscode-editor-font-weight: normal; + --vscode-editor-font-size: 12px; + --vscode-foreground: #3b3b3b; + --vscode-disabledForeground: rgba(97, 97, 97, 0.5); + --vscode-errorForeground: #f85149; + --vscode-descriptionForeground: #3b3b3b; + --vscode-icon-foreground: #3b3b3b; + --vscode-focusBorder: #005fb8; + --vscode-textSeparator-foreground: #21262d; + --vscode-textLink-foreground: #005fb8; + --vscode-textLink-activeForeground: #005fb8; + --vscode-textPreformat-foreground: #a31515; + --vscode-textBlockQuote-background: #f8f8f8; + --vscode-textBlockQuote-border: rgba(0, 0, 0, 0.1); + --vscode-textCodeBlock-background: rgba(110, 118, 129, 0.4); + --vscode-widget-shadow: rgba(0, 0, 0, 0.16); + --vscode-widget-border: rgba(0, 0, 0, 0.1); + --vscode-input-background: #ffffff; + --vscode-input-foreground: #3b3b3b; + --vscode-input-border: #cecece; + --vscode-inputOption-activeBorder: #005fb8; + --vscode-inputOption-hoverBackground: rgba(184, 184, 184, 0.31); + --vscode-inputOption-activeBackground: rgba(0, 95, 184, 0.26); + --vscode-inputOption-activeForeground: #000000; + --vscode-input-placeholderForeground: rgba(0, 0, 0, 0.47); + --vscode-inputValidation-infoBackground: #d6ecf2; + --vscode-inputValidation-infoBorder: #007acc; + --vscode-inputValidation-warningBackground: #f6f5d2; + --vscode-inputValidation-warningBorder: #b89500; + --vscode-inputValidation-errorBackground: #f2dede; + --vscode-inputValidation-errorBorder: #be1100; + --vscode-dropdown-background: #ffffff; + --vscode-dropdown-listBackground: #ffffff; + --vscode-dropdown-foreground: #3b3b3b; + --vscode-dropdown-border: #cecece; + --vscode-button-foreground: #ffffff; + --vscode-button-separator: rgba(255, 255, 255, 0.4); + --vscode-button-background: #005fb8; + --vscode-button-hoverBackground: rgba(0, 95, 184, 0.9); + --vscode-button-border: rgba(0, 0, 0, 0.1); + --vscode-button-secondaryForeground: #3b3b3b; + --vscode-button-secondaryBackground: rgba(0, 0, 0, 0.1); + --vscode-button-secondaryHoverBackground: rgba(0, 0, 0, 0.2); + --vscode-badge-background: #005fb8; + --vscode-badge-foreground: #ffffff; + --vscode-scrollbar-shadow: rgba(72, 79, 88, 0.2); + --vscode-scrollbarSlider-background: rgba(110, 118, 129, 0.2); + --vscode-scrollbarSlider-hoverBackground: rgba(110, 118, 129, 0.27); + --vscode-scrollbarSlider-activeBackground: rgba(110, 118, 129, 0.53); + --vscode-progressBar-background: #005fb8; + --vscode-editorError-foreground: #e51400; + --vscode-editorWarning-foreground: #bf8803; + --vscode-editorInfo-foreground: #1a85ff; + --vscode-editorHint-foreground: #6c6c6c; + --vscode-sash-hoverBorder: #005fb8; + --vscode-editor-background: #ffffff; + --vscode-editor-foreground: #3b3b3b; + --vscode-editorStickyScroll-background: #ffffff; + --vscode-editorStickyScrollHover-background: #f0f0f0; + --vscode-editorWidget-background: #ffffff; + --vscode-editorWidget-foreground: #3b3b3b; + --vscode-editorWidget-border: #c8c8c8; + --vscode-quickInput-background: #ffffff; + --vscode-quickInput-foreground: #3b3b3b; + --vscode-quickInputTitle-background: rgba(0, 0, 0, 0.06); + --vscode-pickerGroup-foreground: #8b949e; + --vscode-pickerGroup-border: rgba(0, 0, 0, 0.1); + --vscode-keybindingLabel-background: rgba(221, 221, 221, 0.4); + --vscode-keybindingLabel-foreground: #3b3b3b; + --vscode-keybindingLabel-border: rgba(204, 204, 204, 0.4); + --vscode-keybindingLabel-bottomBorder: rgba(187, 187, 187, 0.4); + --vscode-editor-selectionBackground: #add6ff; + --vscode-editor-inactiveSelectionBackground: #e5ebf1; + --vscode-editor-selectionHighlightBackground: rgba(173, 214, 255, 0.5); + --vscode-editor-findMatchBackground: #a8ac94; + --vscode-editor-findMatchHighlightBackground: rgba(234, 92, 0, 0.33); + --vscode-editor-findRangeHighlightBackground: rgba(180, 180, 180, 0.3); + --vscode-searchEditor-findMatchBackground: rgba(234, 92, 0, 0.22); + --vscode-search-resultsInfoForeground: #3b3b3b; + --vscode-editor-hoverHighlightBackground: rgba(173, 214, 255, 0.15); + --vscode-editorHoverWidget-background: #ffffff; + --vscode-editorHoverWidget-foreground: #3b3b3b; + --vscode-editorHoverWidget-border: #c8c8c8; + --vscode-editorHoverWidget-statusBarBackground: #f2f2f2; + --vscode-editorLink-activeForeground: #0000ff; + --vscode-editorInlayHint-foreground: #8b949e; + --vscode-editorInlayHint-background: rgba(139, 148, 158, 0.2); + --vscode-editorInlayHint-typeForeground: #8b949e; + --vscode-editorInlayHint-typeBackground: rgba(139, 148, 158, 0.2); + --vscode-editorInlayHint-parameterForeground: #8b949e; + --vscode-editorInlayHint-parameterBackground: rgba(139, 148, 158, 0.2); + --vscode-editorLightBulb-foreground: #ddb100; + --vscode-editorLightBulbAutoFix-foreground: #007acc; + --vscode-diffEditor-insertedTextBackground: rgba(35, 134, 54, 0.3); + --vscode-diffEditor-removedTextBackground: rgba(218, 54, 51, 0.3); + --vscode-diffEditor-insertedLineBackground: rgba(35, 134, 54, 0.2); + --vscode-diffEditor-removedLineBackground: rgba(218, 54, 51, 0.2); + --vscode-diffEditor-diagonalFill: rgba(34, 34, 34, 0.2); + --vscode-list-focusOutline: #005fb8; + --vscode-list-focusAndSelectionOutline: #90c2f9; + --vscode-list-activeSelectionBackground: #e8e8e8; + --vscode-list-activeSelectionForeground: #000000; + --vscode-list-activeSelectionIconForeground: #000000; + --vscode-list-inactiveSelectionBackground: #e4e6f1; + --vscode-list-hoverBackground: #f2f2f2; + --vscode-list-dropBackground: #d6ebff; + --vscode-list-highlightForeground: #0066bf; + --vscode-list-focusHighlightForeground: #0066bf; + --vscode-list-invalidItemForeground: #b89500; + --vscode-list-errorForeground: #b01011; + --vscode-list-warningForeground: #855f00; + --vscode-listFilterWidget-background: #ffffff; + --vscode-listFilterWidget-outline: rgba(0, 0, 0, 0); + --vscode-listFilterWidget-noMatchesOutline: #be1100; + --vscode-listFilterWidget-shadow: rgba(0, 0, 0, 0.16); + --vscode-list-filterMatchBackground: rgba(234, 92, 0, 0.33); + --vscode-tree-indentGuidesStroke: #a9a9a9; + --vscode-tree-inactiveIndentGuidesStroke: rgba(169, 169, 169, 0.4); + --vscode-tree-tableColumnsBorder: rgba(97, 97, 97, 0.13); + --vscode-tree-tableOddRowsBackground: rgba(59, 59, 59, 0.04); + --vscode-list-deemphasizedForeground: #8e8e90; + --vscode-checkbox-background: #f8f8f8; + --vscode-checkbox-selectBackground: #ffffff; + --vscode-checkbox-foreground: #3b3b3b; + --vscode-checkbox-border: #cecece; + --vscode-checkbox-selectBorder: #3b3b3b; + --vscode-quickInputList-focusForeground: #000000; + --vscode-quickInputList-focusIconForeground: #000000; + --vscode-quickInputList-focusBackground: #e8e8e8; + --vscode-menu-border: #d4d4d4; + --vscode-menu-foreground: #3b3b3b; + --vscode-menu-background: #ffffff; + --vscode-menu-selectionForeground: #000000; + --vscode-menu-selectionBackground: #e8e8e8; + --vscode-menu-separatorBackground: #d4d4d4; + --vscode-toolbar-hoverBackground: rgba(184, 184, 184, 0.31); + --vscode-toolbar-activeBackground: rgba(166, 166, 166, 0.31); + --vscode-editor-snippetTabstopHighlightBackground: rgba(10, 50, 100, 0.2); + --vscode-editor-snippetFinalTabstopHighlightBorder: rgba(10, 50, 100, 0.5); + --vscode-breadcrumb-foreground: rgba(59, 59, 59, 0.8); + --vscode-breadcrumb-background: #ffffff; + --vscode-breadcrumb-focusForeground: #2f2f2f; + --vscode-breadcrumb-activeSelectionForeground: #2f2f2f; + --vscode-breadcrumbPicker-background: #ffffff; + --vscode-merge-currentHeaderBackground: rgba(64, 200, 174, 0.5); + --vscode-merge-currentContentBackground: rgba(64, 200, 174, 0.2); + --vscode-merge-incomingHeaderBackground: rgba(64, 166, 255, 0.5); + --vscode-merge-incomingContentBackground: rgba(64, 166, 255, 0.2); + --vscode-merge-commonHeaderBackground: rgba(96, 96, 96, 0.4); + --vscode-merge-commonContentBackground: rgba(96, 96, 96, 0.16); + --vscode-editorOverviewRuler-currentContentForeground: rgba( + 64, + 200, + 174, + 0.5 + ); + --vscode-editorOverviewRuler-incomingContentForeground: rgba( + 64, + 166, + 255, + 0.5 + ); + --vscode-editorOverviewRuler-commonContentForeground: rgba(96, 96, 96, 0.4); + --vscode-editorOverviewRuler-findMatchForeground: rgba(209, 134, 22, 0.49); + --vscode-editorOverviewRuler-selectionHighlightForeground: rgba( + 160, + 160, + 160, + 0.8 + ); + --vscode-minimap-findMatchHighlight: #d18616; + --vscode-minimap-selectionOccurrenceHighlight: #c9c9c9; + --vscode-minimap-selectionHighlight: #add6ff; + --vscode-minimap-errorHighlight: rgba(255, 18, 18, 0.7); + --vscode-minimap-warningHighlight: #bf8803; + --vscode-minimap-foregroundOpacity: #000000; + --vscode-minimapSlider-background: rgba(110, 118, 129, 0.1); + --vscode-minimapSlider-hoverBackground: rgba(110, 118, 129, 0.14); + --vscode-minimapSlider-activeBackground: rgba(110, 118, 129, 0.27); + --vscode-problemsErrorIcon-foreground: #e51400; + --vscode-problemsWarningIcon-foreground: #bf8803; + --vscode-problemsInfoIcon-foreground: #1a85ff; + --vscode-charts-foreground: #3b3b3b; + --vscode-charts-lines: rgba(59, 59, 59, 0.5); + --vscode-charts-red: #e51400; + --vscode-charts-blue: #1a85ff; + --vscode-charts-yellow: #bf8803; + --vscode-charts-orange: #d18616; + --vscode-charts-green: #388a34; + --vscode-charts-purple: #652d90; + --vscode-symbolIcon-arrayForeground: #3b3b3b; + --vscode-symbolIcon-booleanForeground: #3b3b3b; + --vscode-symbolIcon-classForeground: #d67e00; + --vscode-symbolIcon-colorForeground: #3b3b3b; + --vscode-symbolIcon-constantForeground: #3b3b3b; + --vscode-symbolIcon-constructorForeground: #652d90; + --vscode-symbolIcon-enumeratorForeground: #d67e00; + --vscode-symbolIcon-enumeratorMemberForeground: #007acc; + --vscode-symbolIcon-eventForeground: #d67e00; + --vscode-symbolIcon-fieldForeground: #007acc; + --vscode-symbolIcon-fileForeground: #3b3b3b; + --vscode-symbolIcon-folderForeground: #3b3b3b; + --vscode-symbolIcon-functionForeground: #652d90; + --vscode-symbolIcon-interfaceForeground: #007acc; + --vscode-symbolIcon-keyForeground: #3b3b3b; + --vscode-symbolIcon-keywordForeground: #3b3b3b; + --vscode-symbolIcon-methodForeground: #652d90; + --vscode-symbolIcon-moduleForeground: #3b3b3b; + --vscode-symbolIcon-namespaceForeground: #3b3b3b; + --vscode-symbolIcon-nullForeground: #3b3b3b; + --vscode-symbolIcon-numberForeground: #3b3b3b; + --vscode-symbolIcon-objectForeground: #3b3b3b; + --vscode-symbolIcon-operatorForeground: #3b3b3b; + --vscode-symbolIcon-packageForeground: #3b3b3b; + --vscode-symbolIcon-propertyForeground: #3b3b3b; + --vscode-symbolIcon-referenceForeground: #3b3b3b; + --vscode-symbolIcon-snippetForeground: #3b3b3b; + --vscode-symbolIcon-stringForeground: #3b3b3b; + --vscode-symbolIcon-structForeground: #3b3b3b; + --vscode-symbolIcon-textForeground: #3b3b3b; + --vscode-symbolIcon-typeParameterForeground: #3b3b3b; + --vscode-symbolIcon-unitForeground: #3b3b3b; + --vscode-symbolIcon-variableForeground: #007acc; + --vscode-editorHoverWidget-highlightForeground: #0066bf; + --vscode-editor-lineHighlightBorder: #eeeeee; + --vscode-editor-rangeHighlightBackground: rgba(253, 255, 0, 0.2); + --vscode-editor-symbolHighlightBackground: rgba(234, 92, 0, 0.33); + --vscode-editorCursor-foreground: #000000; + --vscode-editorWhitespace-foreground: rgba(51, 51, 51, 0.2); + --vscode-editorIndentGuide-background: #d3d3d3; + --vscode-editorIndentGuide-activeBackground: #939393; + --vscode-editorLineNumber-foreground: #6e7681; + --vscode-editorActiveLineNumber-foreground: #0b216f; + --vscode-editorLineNumber-activeForeground: #171184; + --vscode-editorRuler-foreground: #d3d3d3; + --vscode-editorCodeLens-foreground: #919191; + --vscode-editorBracketMatch-background: rgba(0, 100, 0, 0.1); + --vscode-editorBracketMatch-border: #b9b9b9; + --vscode-editorOverviewRuler-border: rgba(0, 0, 0, 0.1); + --vscode-editorGutter-background: #ffffff; + --vscode-editorUnnecessaryCode-opacity: rgba(0, 0, 0, 0.47); + --vscode-editorGhostText-foreground: rgba(0, 0, 0, 0.47); + --vscode-editorOverviewRuler-rangeHighlightForeground: rgba(0, 122, 204, 0.6); + --vscode-editorOverviewRuler-errorForeground: rgba(255, 18, 18, 0.7); + --vscode-editorOverviewRuler-warningForeground: #bf8803; + --vscode-editorOverviewRuler-infoForeground: #1a85ff; + --vscode-editorBracketHighlight-foreground1: #0431fa; + --vscode-editorBracketHighlight-foreground2: #319331; + --vscode-editorBracketHighlight-foreground3: #7b3814; + --vscode-editorBracketHighlight-foreground4: rgba(0, 0, 0, 0); + --vscode-editorBracketHighlight-foreground5: rgba(0, 0, 0, 0); + --vscode-editorBracketHighlight-foreground6: rgba(0, 0, 0, 0); + --vscode-editorBracketHighlight-unexpectedBracket\.foreground: rgba( + 255, + 18, + 18, + 0.8 + ); + --vscode-editorBracketPairGuide-background1: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-background2: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-background3: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-background4: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-background5: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-background6: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground1: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground2: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground3: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground4: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground5: rgba(0, 0, 0, 0); + --vscode-editorBracketPairGuide-activeBackground6: rgba(0, 0, 0, 0); + --vscode-editorUnicodeHighlight-border: #cea33d; + --vscode-editorUnicodeHighlight-background: rgba(206, 163, 61, 0.08); + --vscode-editorOverviewRuler-bracketMatchForeground: #a0a0a0; + --vscode-editor-foldBackground: rgba(173, 214, 255, 0.3); + --vscode-editorGutter-foldingControlForeground: #3b3b3b; + --vscode-editor-linkedEditingBackground: rgba(255, 0, 0, 0.3); + --vscode-editor-wordHighlightBackground: rgba(87, 87, 87, 0.25); + --vscode-editor-wordHighlightStrongBackground: rgba(14, 99, 156, 0.25); + --vscode-editor-wordHighlightTextBackground: rgba(87, 87, 87, 0.25); + --vscode-editorOverviewRuler-wordHighlightForeground: rgba( + 160, + 160, + 160, + 0.8 + ); + --vscode-editorOverviewRuler-wordHighlightStrongForeground: rgba( + 192, + 160, + 192, + 0.8 + ); + --vscode-editorOverviewRuler-wordHighlightTextForeground: rgba( + 160, + 160, + 160, + 0.8 + ); + --vscode-peekViewTitle-background: #f3f3f3; + --vscode-peekViewTitleLabel-foreground: #000000; + --vscode-peekViewTitleDescription-foreground: #616161; + --vscode-peekView-border: #1a85ff; + --vscode-peekViewResult-background: #ffffff; + --vscode-peekViewResult-lineForeground: #646465; + --vscode-peekViewResult-fileForeground: #1e1e1e; + --vscode-peekViewResult-selectionBackground: rgba(51, 153, 255, 0.2); + --vscode-peekViewResult-selectionForeground: #6c6c6c; + --vscode-peekViewEditor-background: #f2f8fc; + --vscode-peekViewEditorGutter-background: #f2f8fc; + --vscode-peekViewEditorStickyScroll-background: #f2f8fc; + --vscode-peekViewResult-matchHighlightBackground: rgba(187, 128, 9, 0.4); + --vscode-peekViewEditor-matchHighlightBackground: rgba(187, 128, 9, 0.4); + --vscode-editorMarkerNavigationError-background: #e51400; + --vscode-editorMarkerNavigationError-headerBackground: rgba(229, 20, 0, 0.1); + --vscode-editorMarkerNavigationWarning-background: #bf8803; + --vscode-editorMarkerNavigationWarning-headerBackground: rgba( + 191, + 136, + 3, + 0.1 + ); + --vscode-editorMarkerNavigationInfo-background: #1a85ff; + --vscode-editorMarkerNavigationInfo-headerBackground: rgba(26, 133, 255, 0.1); + --vscode-editorMarkerNavigation-background: #ffffff; + --vscode-editorSuggestWidget-background: #f8f8f8; + --vscode-editorSuggestWidget-border: #c8c8c8; + --vscode-editorSuggestWidget-foreground: #3b3b3b; + --vscode-editorSuggestWidget-selectedForeground: #000000; + --vscode-editorSuggestWidget-selectedIconForeground: #000000; + --vscode-editorSuggestWidget-selectedBackground: #e8e8e8; + --vscode-editorSuggestWidget-highlightForeground: #0066bf; + --vscode-editorSuggestWidget-focusHighlightForeground: #0066bf; + --vscode-editorSuggestWidgetStatus-foreground: rgba(59, 59, 59, 0.5); + --vscode-tab-activeBackground: #ffffff; + --vscode-tab-unfocusedActiveBackground: #ffffff; + --vscode-tab-inactiveBackground: #f8f8f8; + --vscode-tab-unfocusedInactiveBackground: #f8f8f8; + --vscode-tab-activeForeground: #3b3b3b; + --vscode-tab-inactiveForeground: rgba(0, 0, 0, 0.5); + --vscode-tab-unfocusedActiveForeground: rgba(59, 59, 59, 0.7); + --vscode-tab-unfocusedInactiveForeground: rgba(0, 0, 0, 0.25); + --vscode-tab-hoverBackground: #ffffff; + --vscode-tab-unfocusedHoverBackground: rgba(110, 118, 129, 0.1); + --vscode-tab-border: rgba(0, 0, 0, 0.1); + --vscode-tab-lastPinnedBorder: rgba(59, 59, 59, 0.19); + --vscode-tab-activeBorder: #f8f8f8; + --vscode-tab-unfocusedActiveBorder: #f8f8f8; + --vscode-tab-activeBorderTop: #005fb8; + --vscode-tab-unfocusedActiveBorderTop: rgba(0, 0, 0, 0.08); + --vscode-tab-activeModifiedBorder: #33aaee; + --vscode-tab-inactiveModifiedBorder: rgba(51, 170, 238, 0.5); + --vscode-tab-unfocusedActiveModifiedBorder: rgba(51, 170, 238, 0.7); + --vscode-tab-unfocusedInactiveModifiedBorder: rgba(51, 170, 238, 0.25); + --vscode-editorPane-background: #ffffff; + --vscode-editorGroupHeader-tabsBackground: #f8f8f8; + --vscode-editorGroupHeader-tabsBorder: rgba(0, 0, 0, 0.1); + --vscode-editorGroupHeader-noTabsBackground: #ffffff; + --vscode-editorGroup-border: rgba(0, 0, 0, 0.1); + --vscode-editorGroup-dropBackground: rgba(38, 119, 203, 0.18); + --vscode-editorGroup-dropIntoPromptForeground: #3b3b3b; + --vscode-editorGroup-dropIntoPromptBackground: #ffffff; + --vscode-sideBySideEditor-horizontalBorder: rgba(0, 0, 0, 0.1); + --vscode-sideBySideEditor-verticalBorder: rgba(0, 0, 0, 0.1); + --vscode-panel-background: #f8f8f8; + --vscode-panel-border: rgba(0, 0, 0, 0.1); + --vscode-panelTitle-activeForeground: #3b3b3b; + --vscode-panelTitle-inactiveForeground: #3b3b3b; + --vscode-panelTitle-activeBorder: #005fb8; + --vscode-panelInput-border: rgba(0, 0, 0, 0.1); + --vscode-panel-dropBorder: #3b3b3b; + --vscode-panelSection-dropBackground: rgba(38, 119, 203, 0.18); + --vscode-panelSectionHeader-background: rgba(128, 128, 128, 0.2); + --vscode-panelSection-border: rgba(0, 0, 0, 0.1); + --vscode-banner-background: #a2a2a2; + --vscode-banner-foreground: #000000; + --vscode-banner-iconForeground: #1a85ff; + --vscode-statusBar-foreground: #3b3b3b; + --vscode-statusBar-noFolderForeground: #3b3b3b; + --vscode-statusBar-background: #f8f8f8; + --vscode-statusBar-noFolderBackground: #f8f8f8; + --vscode-statusBar-border: rgba(0, 0, 0, 0.1); + --vscode-statusBar-focusBorder: #005fb8; + --vscode-statusBar-noFolderBorder: rgba(0, 0, 0, 0.1); + --vscode-statusBarItem-activeBackground: rgba(255, 255, 255, 0.18); + --vscode-statusBarItem-focusBorder: #005fb8; + --vscode-statusBarItem-hoverBackground: rgba(255, 255, 255, 0.12); + --vscode-statusBarItem-compactHoverBackground: rgba(255, 255, 255, 0.2); + --vscode-statusBarItem-prominentForeground: #3b3b3b; + --vscode-statusBarItem-prominentBackground: rgba(110, 118, 129, 0.4); + --vscode-statusBarItem-prominentHoverBackground: rgba(0, 0, 0, 0.3); + --vscode-statusBarItem-errorBackground: #c72e0f; + --vscode-statusBarItem-errorForeground: #ffffff; + --vscode-statusBarItem-warningBackground: #725102; + --vscode-statusBarItem-warningForeground: #ffffff; + --vscode-activityBar-background: #f8f8f8; + --vscode-activityBar-foreground: #1f1f1f; + --vscode-activityBar-inactiveForeground: rgba(0, 0, 0, 0.62); + --vscode-activityBar-border: rgba(0, 0, 0, 0.1); + --vscode-activityBar-activeBorder: #005fb8; + --vscode-activityBar-dropBorder: #1f1f1f; + --vscode-activityBarBadge-background: #005fb8; + --vscode-activityBarBadge-foreground: #ffffff; + --vscode-profileBadge-background: #c4c4c4; + --vscode-profileBadge-foreground: #333333; + --vscode-statusBarItem-remoteBackground: #005fb8; + --vscode-statusBarItem-remoteForeground: #ffffff; + --vscode-extensionBadge-remoteBackground: #005fb8; + --vscode-extensionBadge-remoteForeground: #ffffff; + --vscode-sideBar-background: #f8f8f8; + --vscode-sideBar-foreground: #3b3b3b; + --vscode-sideBar-border: rgba(0, 0, 0, 0.1); + --vscode-sideBarTitle-foreground: #3b3b3b; + --vscode-sideBar-dropBackground: rgba(38, 119, 203, 0.18); + --vscode-sideBarSectionHeader-background: #f8f8f8; + --vscode-sideBarSectionHeader-foreground: #3b3b3b; + --vscode-sideBarSectionHeader-border: rgba(0, 0, 0, 0.1); + --vscode-titleBar-activeForeground: #1e1e1e; + --vscode-titleBar-inactiveForeground: #8b949e; + --vscode-titleBar-activeBackground: #f8f8f8; + --vscode-titleBar-inactiveBackground: #f8f8f8; + --vscode-titleBar-border: rgba(0, 0, 0, 0.1); + --vscode-menubar-selectionForeground: #1e1e1e; + --vscode-menubar-selectionBackground: rgba(184, 184, 184, 0.31); + --vscode-notificationCenter-border: rgba(0, 0, 0, 0.1); + --vscode-notificationToast-border: rgba(0, 0, 0, 0.1); + --vscode-notifications-foreground: #3b3b3b; + --vscode-notifications-background: #ffffff; + --vscode-notificationLink-foreground: #005fb8; + --vscode-notificationCenterHeader-foreground: #3b3b3b; + --vscode-notificationCenterHeader-background: #ffffff; + --vscode-notifications-border: rgba(0, 0, 0, 0.1); + --vscode-notificationsErrorIcon-foreground: #e51400; + --vscode-notificationsWarningIcon-foreground: #bf8803; + --vscode-notificationsInfoIcon-foreground: #1a85ff; + --vscode-commandCenter-foreground: #1e1e1e; + --vscode-commandCenter-activeForeground: #1e1e1e; + --vscode-commandCenter-inactiveForeground: #8b949e; + --vscode-commandCenter-background: rgba(0, 0, 0, 0.05); + --vscode-commandCenter-activeBackground: rgba(0, 0, 0, 0.08); + --vscode-commandCenter-border: rgba(30, 30, 30, 0.2); + --vscode-commandCenter-activeBorder: rgba(30, 30, 30, 0.3); + --vscode-commandCenter-inactiveBorder: rgba(139, 148, 158, 0.25); + --vscode-commentsView-resolvedIcon: rgba(97, 97, 97, 0.5); + --vscode-commentsView-unresolvedIcon: #005fb8; + --vscode-editorCommentsWidget-resolvedBorder: rgba(97, 97, 97, 0.5); + --vscode-editorCommentsWidget-unresolvedBorder: #005fb8; + --vscode-editorCommentsWidget-rangeBackground: rgba(0, 95, 184, 0.1); + --vscode-editorCommentsWidget-rangeBorder: rgba(0, 95, 184, 0.4); + --vscode-editorCommentsWidget-rangeActiveBackground: rgba(0, 95, 184, 0.1); + --vscode-editorCommentsWidget-rangeActiveBorder: rgba(0, 95, 184, 0.4); + --vscode-editorGutter-commentRangeForeground: #d5d8e9; + --vscode-editorOverviewRuler-commentForeground: #d5d8e9; + --vscode-editorOverviewRuler-commentUnresolvedForeground: #d5d8e9; + --vscode-editorGutter-commentGlyphForeground: #3b3b3b; + --vscode-editorGutter-commentUnresolvedGlyphForeground: #3b3b3b; + --vscode-debugToolBar-background: #f3f3f3; + --vscode-debugIcon-startForeground: #388a34; + --vscode-editor-stackFrameHighlightBackground: rgba(255, 255, 102, 0.45); + --vscode-editor-focusedStackFrameHighlightBackground: rgba( + 206, + 231, + 206, + 0.45 + ); + --vscode-interactiveEditor-border: #c8c8c8; + --vscode-interactiveEditor-shadow: rgba(0, 0, 0, 0.16); + --vscode-interactiveEditor-regionHighlight: rgba(173, 214, 255, 0.15); + --vscode-interactiveEditorInput-border: #c8c8c8; + --vscode-interactiveEditorInput-focusBorder: #005fb8; + --vscode-interactiveEditorInput-placeholderForeground: rgba(0, 0, 0, 0.47); + --vscode-interactiveEditorInput-background: #ffffff; + --vscode-interactiveEditorDiff-inserted: rgba(35, 134, 54, 0.15); + --vscode-interactiveEditorDiff-removed: rgba(218, 54, 51, 0.15); + --vscode-interactive-requestBackground: rgba(0, 0, 0, 0.03); + --vscode-interactive-requestBorder: rgba(0, 0, 0, 0.1); + --vscode-mergeEditor-change\.background: rgba(155, 185, 85, 0.2); + --vscode-mergeEditor-change\.word\.background: rgba(156, 204, 44, 0.4); + --vscode-mergeEditor-changeBase\.background: #ffcccc; + --vscode-mergeEditor-changeBase\.word\.background: #ffa3a3; + --vscode-mergeEditor-conflict\.unhandledUnfocused\.border: #ffa600; + --vscode-mergeEditor-conflict\.unhandledFocused\.border: #ffa600; + --vscode-mergeEditor-conflict\.handledUnfocused\.border: rgba( + 134, + 134, + 134, + 0.29 + ); + --vscode-mergeEditor-conflict\.handledFocused\.border: rgba( + 193, + 193, + 193, + 0.8 + ); + --vscode-mergeEditor-conflict\.handled\.minimapOverViewRuler: rgba( + 173, + 172, + 168, + 0.93 + ); + --vscode-mergeEditor-conflict\.unhandled\.minimapOverViewRuler: #fcba03; + --vscode-mergeEditor-conflictingLines\.background: rgba(255, 234, 0, 0.28); + --vscode-mergeEditor-conflict\.input1\.background: rgba(64, 200, 174, 0.2); + --vscode-mergeEditor-conflict\.input2\.background: rgba(64, 166, 255, 0.2); + --vscode-settings-headerForeground: #1f1f1f; + --vscode-settings-settingsHeaderHoverForeground: rgba(31, 31, 31, 0.7); + --vscode-settings-modifiedItemIndicator: rgba(187, 128, 9, 0.4); + --vscode-settings-headerBorder: rgba(0, 0, 0, 0.1); + --vscode-settings-sashBorder: rgba(0, 0, 0, 0.1); + --vscode-settings-dropdownBackground: #ffffff; + --vscode-settings-dropdownForeground: #3b3b3b; + --vscode-settings-dropdownBorder: #cecece; + --vscode-settings-dropdownListBorder: #c8c8c8; + --vscode-settings-checkboxBackground: #f8f8f8; + --vscode-settings-checkboxForeground: #3b3b3b; + --vscode-settings-checkboxBorder: #cecece; + --vscode-settings-textInputBackground: #ffffff; + --vscode-settings-textInputForeground: #3b3b3b; + --vscode-settings-textInputBorder: #cecece; + --vscode-settings-numberInputBackground: #ffffff; + --vscode-settings-numberInputForeground: #3b3b3b; + --vscode-settings-numberInputBorder: #cecece; + --vscode-settings-focusedRowBackground: rgba(242, 242, 242, 0.6); + --vscode-settings-rowHoverBackground: rgba(242, 242, 242, 0.3); + --vscode-settings-focusedRowBorder: #005fb8; + --vscode-terminal-foreground: #3b3b3b; + --vscode-terminalCursor-foreground: #005fb8; + --vscode-terminal-selectionBackground: #add6ff; + --vscode-terminal-inactiveSelectionBackground: #e5ebf1; + --vscode-terminalCommandDecoration-defaultBackground: rgba(0, 0, 0, 0.25); + --vscode-terminalCommandDecoration-successBackground: #2090d3; + --vscode-terminalCommandDecoration-errorBackground: #e51400; + --vscode-terminalOverviewRuler-cursorForeground: rgba(160, 160, 160, 0.8); + --vscode-terminal-border: rgba(0, 0, 0, 0.1); + --vscode-terminal-findMatchBackground: #a8ac94; + --vscode-terminal-hoverHighlightBackground: rgba(173, 214, 255, 0.07); + --vscode-terminal-findMatchHighlightBackground: rgba(234, 92, 0, 0.33); + --vscode-terminalOverviewRuler-findMatchForeground: rgba(209, 134, 22, 0.49); + --vscode-terminal-dropBackground: rgba(38, 119, 203, 0.18); + --vscode-terminal-tab\.activeBorder: #005fb8; + --vscode-testing-iconFailed: #f14c4c; + --vscode-testing-iconErrored: #f14c4c; + --vscode-testing-iconPassed: #73c991; + --vscode-testing-runAction: #73c991; + --vscode-testing-iconQueued: #cca700; + --vscode-testing-iconUnset: #848484; + --vscode-testing-iconSkipped: #848484; + --vscode-testing-peekBorder: #e51400; + --vscode-testing-peekHeaderBackground: rgba(229, 20, 0, 0.1); + --vscode-testing-message\.error\.decorationForeground: #e51400; + --vscode-testing-message\.error\.lineBackground: rgba(255, 0, 0, 0.2); + --vscode-testing-message\.info\.decorationForeground: rgba(59, 59, 59, 0.5); + --vscode-welcomePage-tileBackground: #f3f3f3; + --vscode-welcomePage-tileHoverBackground: #e6e6e6; + --vscode-welcomePage-tileBorder: rgba(0, 0, 0, 0.1); + --vscode-welcomePage-progress\.background: #ffffff; + --vscode-welcomePage-progress\.foreground: #005fb8; + --vscode-walkthrough-stepTitle\.foreground: #000000; + --vscode-walkThrough-embeddedEditorBackground: #f4f4f4; + --vscode-debugExceptionWidget-border: #a31515; + --vscode-debugExceptionWidget-background: #f1dfde; + --vscode-ports-iconRunningProcessForeground: #369432; + --vscode-statusBar-debuggingBackground: #fd716c; + --vscode-statusBar-debuggingForeground: #000000; + --vscode-statusBar-debuggingBorder: rgba(0, 0, 0, 0.1); + --vscode-statusBar-offlineBackground: #6c1717; + --vscode-statusBar-offlineForeground: #3b3b3b; + --vscode-statusBar-offlineBorder: rgba(0, 0, 0, 0.1); + --vscode-editor-inlineValuesForeground: rgba(0, 0, 0, 0.5); + --vscode-editor-inlineValuesBackground: rgba(255, 200, 0, 0.2); + --vscode-editorGutter-modifiedBackground: #005fb8; + --vscode-editorGutter-addedBackground: #2ea043; + --vscode-editorGutter-deletedBackground: #f85149; + --vscode-minimapGutter-modifiedBackground: #005fb8; + --vscode-minimapGutter-addedBackground: #2ea043; + --vscode-minimapGutter-deletedBackground: #f85149; + --vscode-editorOverviewRuler-modifiedForeground: rgba(0, 95, 184, 0.6); + --vscode-editorOverviewRuler-addedForeground: rgba(46, 160, 67, 0.6); + --vscode-editorOverviewRuler-deletedForeground: rgba(248, 81, 73, 0.6); + --vscode-debugIcon-breakpointForeground: #e51400; + --vscode-debugIcon-breakpointDisabledForeground: #848484; + --vscode-debugIcon-breakpointUnverifiedForeground: #848484; + --vscode-debugIcon-breakpointCurrentStackframeForeground: #be8700; + --vscode-debugIcon-breakpointStackframeForeground: #89d185; + --vscode-notebook-cellBorderColor: #e8e8e8; + --vscode-notebook-focusedEditorBorder: #005fb8; + --vscode-notebookStatusSuccessIcon-foreground: #388a34; + --vscode-notebookEditorOverviewRuler-runningCellForeground: #388a34; + --vscode-notebookStatusErrorIcon-foreground: #f85149; + --vscode-notebookStatusRunningIcon-foreground: #3b3b3b; + --vscode-notebook-cellToolbarSeparator: rgba(128, 128, 128, 0.35); + --vscode-notebook-selectedCellBackground: rgba(200, 221, 241, 0.31); + --vscode-notebook-selectedCellBorder: #e8e8e8; + --vscode-notebook-focusedCellBorder: #005fb8; + --vscode-notebook-inactiveFocusedCellBorder: #e8e8e8; + --vscode-notebook-cellStatusBarItemHoverBackground: rgba(0, 0, 0, 0.08); + --vscode-notebook-cellInsertionIndicator: #005fb8; + --vscode-notebookScrollbarSlider-background: rgba(110, 118, 129, 0.2); + --vscode-notebookScrollbarSlider-hoverBackground: rgba(110, 118, 129, 0.27); + --vscode-notebookScrollbarSlider-activeBackground: rgba(110, 118, 129, 0.53); + --vscode-notebook-symbolHighlightBackground: rgba(253, 255, 0, 0.2); + --vscode-notebook-cellEditorBackground: #f8f8f8; + --vscode-notebook-editorBackground: #ffffff; + --vscode-keybindingTable-headerBackground: rgba(59, 59, 59, 0.04); + --vscode-keybindingTable-rowsBackground: rgba(59, 59, 59, 0.04); + --vscode-scm-providerBorder: #c8c8c8; + --vscode-searchEditor-textInputBorder: #cecece; + --vscode-debugTokenExpression-name: #9b46b0; + --vscode-debugTokenExpression-value: rgba(108, 108, 108, 0.8); + --vscode-debugTokenExpression-string: #a31515; + --vscode-debugTokenExpression-boolean: #0000ff; + --vscode-debugTokenExpression-number: #098658; + --vscode-debugTokenExpression-error: #e51400; + --vscode-debugView-exceptionLabelForeground: #ffffff; + --vscode-debugView-exceptionLabelBackground: #a31515; + --vscode-debugView-stateLabelForeground: #3b3b3b; + --vscode-debugView-stateLabelBackground: rgba(136, 136, 136, 0.27); + --vscode-debugView-valueChangedHighlight: #569cd6; + --vscode-debugConsole-infoForeground: #1a85ff; + --vscode-debugConsole-warningForeground: #bf8803; + --vscode-debugConsole-errorForeground: #f85149; + --vscode-debugConsole-sourceForeground: #3b3b3b; + --vscode-debugConsoleInputIcon-foreground: #3b3b3b; + --vscode-debugIcon-pauseForeground: #007acc; + --vscode-debugIcon-stopForeground: #a1260d; + --vscode-debugIcon-disconnectForeground: #a1260d; + --vscode-debugIcon-restartForeground: #388a34; + --vscode-debugIcon-stepOverForeground: #007acc; + --vscode-debugIcon-stepIntoForeground: #007acc; + --vscode-debugIcon-stepOutForeground: #007acc; + --vscode-debugIcon-continueForeground: #007acc; + --vscode-debugIcon-stepBackForeground: #007acc; + --vscode-extensionButton-background: #005fb8; + --vscode-extensionButton-foreground: #ffffff; + --vscode-extensionButton-hoverBackground: rgba(0, 95, 184, 0.9); + --vscode-extensionButton-separator: rgba(255, 255, 255, 0.4); + --vscode-extensionButton-prominentBackground: #005fb8; + --vscode-extensionButton-prominentForeground: #ffffff; + --vscode-extensionButton-prominentHoverBackground: rgba(0, 95, 184, 0.9); + --vscode-extensionIcon-starForeground: #df6100; + --vscode-extensionIcon-verifiedForeground: #005fb8; + --vscode-extensionIcon-preReleaseForeground: #1d9271; + --vscode-extensionIcon-sponsorForeground: #b51e78; + --vscode-terminal-ansiBlack: #000000; + --vscode-terminal-ansiRed: #cd3131; + --vscode-terminal-ansiGreen: #00bc00; + --vscode-terminal-ansiYellow: #949800; + --vscode-terminal-ansiBlue: #0451a5; + --vscode-terminal-ansiMagenta: #bc05bc; + --vscode-terminal-ansiCyan: #0598bc; + --vscode-terminal-ansiWhite: #555555; + --vscode-terminal-ansiBrightBlack: #666666; + --vscode-terminal-ansiBrightRed: #cd3131; + --vscode-terminal-ansiBrightGreen: #14ce14; + --vscode-terminal-ansiBrightYellow: #b5ba00; + --vscode-terminal-ansiBrightBlue: #0451a5; + --vscode-terminal-ansiBrightMagenta: #bc05bc; + --vscode-terminal-ansiBrightCyan: #0598bc; + --vscode-terminal-ansiBrightWhite: #a5a5a5; + --vscode-interactive-activeCodeBorder: #1a85ff; + --vscode-interactive-inactiveCodeBorder: #e4e6f1; +} diff --git a/js/packages/quary-extension-ui/components.json b/js/packages/quary-extension-ui/components.json new file mode 100644 index 00000000..1aaa3a6f --- /dev/null +++ b/js/packages/quary-extension-ui/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/index.css", + "baseColor": "slate", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} diff --git a/js/packages/quary-extension-ui/index.html b/js/packages/quary-extension-ui/index.html new file mode 100644 index 00000000..e4b78eae --- /dev/null +++ b/js/packages/quary-extension-ui/index.html @@ -0,0 +1,13 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <link rel="icon" type="image/svg+xml" href="/vite.svg" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>Vite + React + TS + + +
+ + + diff --git a/js/packages/quary-extension-ui/package.json b/js/packages/quary-extension-ui/package.json new file mode 100644 index 00000000..b9c7e62a --- /dev/null +++ b/js/packages/quary-extension-ui/package.json @@ -0,0 +1,77 @@ +{ + "name": "quary-extension-ui", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "watch": "vite", + "dev": "vite build --watch", + "build": "tsc && vite build", + "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview", + "storybook": "storybook dev -p 6006", + "build-storybook": "storybook build", + "test": "vitest", + "coverage": "vitest run --coverage" + }, + "dependencies": { + "@dagrejs/dagre": "^1.1.2", + "@finos/perspective": "^2.10.1", + "@finos/perspective-viewer": "^2.10.1", + "@finos/perspective-viewer-d3fc": "^2.10.1", + "@finos/perspective-viewer-datagrid": "^2.10.1", + "@githubocto/tailwind-vscode": "^1.0.5", + "@heroicons/react": "^2.1.3", + "@radix-ui/react-checkbox": "^1.0.4", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-label": "^2.0.2", + "@radix-ui/react-popover": "^1.0.7", + "@radix-ui/react-select": "^2.0.0", + "@radix-ui/react-separator": "^1.0.3", + "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-tabs": "^1.0.4", + "@radix-ui/react-tooltip": "^1.0.7", + "@storybook/addon-actions": "^8.1.5", + "@types/react-syntax-highlighter": "^15.5.13", + "@vscode/webview-ui-toolkit": "^1.4.0", + "autoprefixer": "^10.4.19", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "cmdk": "^0.2.1", + "fuse.js": "^7.0.0", + "postcss": "^8.4.38", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-syntax-highlighter": "^15.5.0", + "reactflow": "^11.11.3", + "sql-formatter": "^15.3.1", + "tailwind-merge": "^2.3.0", + "tailwindcss": "^3.4.3", + "tailwindcss-animate": "^1.0.7", + "vscode-webview": "1.0.1-beta.1", + "zod": "^3.23.8" + }, + "devDependencies": { + "@quary/eslint-config-shared": "workspace:*", + "@storybook/addon-a11y": "^8.1.5", + "@storybook/addon-docs": "^8.1.5", + "@storybook/addon-essentials": "^8.1.5", + "@storybook/react": "^8.1.5", + "@storybook/react-vite": "^8.1.5", + "@types/dagre": "^0.7.52", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@types/vscode-webview": "^1.57.5", + "@typescript-eslint/eslint-plugin": "^7.12.0", + "@typescript-eslint/parser": "^7.12.0", + "@vitejs/plugin-react-swc": "^3.7.0", + "eslint": "^8.57.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.7", + "storybook": "^8.1.5", + "typescript": "^5.4.5", + "vite": "^5.2.12", + "vitest": "^1.6.0" + } +} diff --git a/js/packages/quary-extension-ui/postcss.config.js b/js/packages/quary-extension-ui/postcss.config.js new file mode 100644 index 00000000..2e7af2b7 --- /dev/null +++ b/js/packages/quary-extension-ui/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/js/packages/quary-extension-ui/src/App.tsx b/js/packages/quary-extension-ui/src/App.tsx new file mode 100644 index 00000000..771d19d0 --- /dev/null +++ b/js/packages/quary-extension-ui/src/App.tsx @@ -0,0 +1,118 @@ +import { useCallBackFrontEnd } from '@shared/callBacks' +import { TablesView } from '@/views/TablesView' +import { TestReportView } from '@/views/TestReportView' +import { FullProjectView } from '@/views/FullProjectView' +import { FullSchemaView } from '@/views/FullSchemaView' +import { ResultsView } from '@/views/ResultsView' +import { DatabaseConfigView } from '@/views/DatabaseConfigView' +import { ProjectFileView } from '@/views/ProjectFileView' +import { LoadingView } from '@/views/LoadingView' +import { vscode } from '@/utils/VSCodeAPIWrapper' +import { DocumentationView } from '@/views/DocumentationView' +import { OnboardingView } from '@/views/OnboardingView' +import { useGlobalState } from '@/hooks/useGlobalState' +import '@/index.css' +import { ErrorView } from '@/views/ErrorView' +import { ExecuteSQLView } from '@/views/ExecuteSQL' +import { ImportSourcesView } from '@/views/ImportSourcesView' +import { ChartEditorView } from '@/views/ChartEditorView.tsx' + +function App() { + const [view] = useGlobalState() + const { importSources } = useCallBackFrontEnd( + ['importSources'], + vscode.postMessage, + ) + + switch (view.type) { + case 'loading': + return + case 'error': + return + case 'tests': { + const { tests, runner } = view + return + } + case 'onboarding': { + const { states } = view + return + } + case 'schema': { + const { fullSchema, language } = view + return + } + case 'queryResults': { + const { results, originalSql, limit, language } = view + return ( + + ) + } + case 'project': { + const { project, seedQueries } = view + return + } + case 'tables': { + const { tables, views } = view + return ( +
+ +
+ ) + } + case 'databaseConfigShow': { + return + } + case 'databaseShowProjectFile': { + return + } + case 'importSources': { + return ( + + importSources({ sources, folderPath }) + } + /> + ) + } + case 'docsView': { + const { + results, + tags, + description, + modelName, + limit, + dag, + table, + isModelInSchema, + } = view + return ( + + ) + } + case 'executeSQL': { + return + } + case 'chartEditor': { + return + } + default: + return
Invalid view type {JSON.stringify(view)}
+ } +} + +export default App diff --git a/js/packages/quary-extension-ui/src/components/AddTestDialog.stories.tsx b/js/packages/quary-extension-ui/src/components/AddTestDialog.stories.tsx new file mode 100644 index 00000000..3cfdd3ca --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/AddTestDialog.stories.tsx @@ -0,0 +1,17 @@ +import { Meta, StoryObj } from '@storybook/react' +import { AddTestDialog } from './AddTestDialog' + +const meta: Meta = { + component: AddTestDialog, + argTypes: { + addColumnTest: { action: 'clicked' }, + }, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = { + args: {}, +} diff --git a/js/packages/quary-extension-ui/src/components/AddTestDialog.tsx b/js/packages/quary-extension-ui/src/components/AddTestDialog.tsx new file mode 100644 index 00000000..515ebca7 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/AddTestDialog.tsx @@ -0,0 +1,237 @@ +import { useState } from 'react' +import { + PlusCircledIcon, + CaretSortIcon, + CheckIcon, +} from '@radix-ui/react-icons' +import { ColumnTest } from '@quary/proto/quary/service/v1/project_file' +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' +import { + Dialog, + DialogClose, + DialogContent, + DialogFooter, + DialogTrigger, +} from '@/components/ui/dialog' +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, +} from '@/components/ui/command' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover' +import { cn } from '@/lib/utils' + +// TODO: get available tests from rust/proto +const POSSIBLE_TESTS = [ + { + type: 'unique', + description: 'Asserts the column contains only unique values', + }, + { + type: 'not_null', + description: 'Asserts the column does not contain any null values', + }, + { + type: 'gt', + description: 'Asserts the column is greater than the specified value', + details: [ + { + name: 'Value', + value: 'value', + placeholder: 'Enter a value for comparison', + inputType: 'text', + }, + ], + }, + { + type: 'gte', + description: + 'Asserts the column is greater than or equal to the specified value', + details: [ + { + name: 'Value', + value: 'value', + placeholder: 'Enter a value for comparison', + inputType: 'text', + }, + ], + }, + { + type: 'lt', + description: 'Asserts the column is less than the specified value', + details: [ + { + name: 'Value', + value: 'value', + placeholder: 'Enter a value for comparison', + inputType: 'text', + }, + ], + }, + { + type: 'lte', + description: + 'Asserts the column is less than or equal to the specified value', + details: [ + { + name: 'Value', + value: 'value', + placeholder: 'Enter a value for comparison', + inputType: 'text', + }, + ], + }, + { + type: 'relationship', + description: 'Defines a relationship between the column and another', + details: [ + { + name: 'Model', + value: 'model', + placeholder: 'Enter the model name', + inputType: 'text', + }, + { + name: 'Column', + value: 'column', + placeholder: 'Enter the column name', + inputType: 'text', + }, + ], + }, + { + type: 'accepted_values', + description: 'Asserts the column is in a particular set of accepted values', + details: [ + { + name: 'Values', + value: 'values', + placeholder: 'Comma seperated values i.e. cat,dog,bird', + inputType: 'text', + }, + ], + }, +] + +export const AddTestDialog: React.FC<{ + addColumnTest: (columnTest: ColumnTest) => void +}> = ({ addColumnTest }) => { + const [selectedTest, setSelectedTest] = useState(POSSIBLE_TESTS[0]) + const [testDetails, setTestDetails] = useState({}) + const [testSelectOpen, setTestSelectOpen] = useState(false) + + const handleTestDetailsChange = (inputName: string, value: string) => { + setTestDetails({ ...testDetails, [inputName]: value }) + } + + return ( + + + +
+ + Add +
+
+
+ + + + + + + + + + No tests found. + + {POSSIBLE_TESTS.map((test) => ( + { + setTestDetails({}) + const selected = POSSIBLE_TESTS.find( + ({ type }) => value === type, + ) + if (selected) { + setSelectedTest(selected) + } + setTestSelectOpen(false) + }} + > +
+ {test.type} + <> +

+ {test.description} +

+ +
+ + +
+ ))} +
+
+
+
+ {selectedTest.details && + selectedTest.details.map((input) => ( + <> + + + handleTestDetailsChange(input.value, e.target.value) + } + /> + + ))} + + + + + +
+
+ ) +} diff --git a/js/packages/quary-extension-ui/src/components/ChartEditor.stories.tsx b/js/packages/quary-extension-ui/src/components/ChartEditor.stories.tsx new file mode 100644 index 00000000..63ef1966 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ChartEditor.stories.tsx @@ -0,0 +1,79 @@ +import { Meta, StoryObj } from '@storybook/react' +import { ErrorCodes } from '@shared/result' +import { sampleQueryResult } from '../lib/sampleData' +import { ChartEditor } from './ChartEditor' + +const meta: Meta = { + component: ChartEditor, +} + +export default meta + +type Story = StoryObj + +const title = 'model_a_chart' +const rawSql = { + $case: 'rawSql', + rawSql: 'SELECT * FROM table', +} +const assetReference = { + $case: 'reference', + reference: 'model_a', +} +const success = { + type: 'success', + queryResult: sampleQueryResult, +} +const loading = { + type: 'loading', +} + +export const SuccessRawSql: Story = { + args: { + title, + chartFile: { + source: rawSql, + config: {}, + }, + chartResults: success, + }, +} + +export const ErrorRawSql: Story = { + args: { + ...SuccessRawSql.args, + chartResults: { + type: 'error', + error: { + code: ErrorCodes.INVALID_ARGUMENT, + message: 'error', + }, + }, + }, +} + +export const NotLoadedRawSql: Story = { + args: { + ...SuccessRawSql.args, + chartResults: { + type: 'not loaded', + }, + }, +} + +export const SuccessAssetReference: Story = { + args: { + ...SuccessRawSql.args, + chartFile: { + source: assetReference, + config: {}, + }, + }, +} + +export const LoadingAssetReference: Story = { + args: { + ...SuccessAssetReference.args, + chartResults: loading, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/ChartEditor.tsx b/js/packages/quary-extension-ui/src/components/ChartEditor.tsx new file mode 100644 index 00000000..be78f5c1 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ChartEditor.tsx @@ -0,0 +1,48 @@ +import React from 'react' +import type { ChartEditorData } from '@shared/globalViewState' +import { ChartFile } from '@quary/proto/quary/service/v1/chart_file' +import { useCallBackFrontEnd } from '@shared/callBacks' +import { LoadingView } from '../views/LoadingView' +import { ErrorView } from '../views/ErrorView' +import { Perspective } from './Perspective' +import { vscode } from '@/utils/VSCodeAPIWrapper' + +interface Props { + title: string + chartResults: ChartEditorData['results'] + chartFile: ChartFile +} + +export const ChartEditor: React.FC = ({ + title, + chartResults, + chartFile, +}) => { + const { chartViewMakeChartEdit } = useCallBackFrontEnd( + ['chartViewMakeChartEdit'], + vscode.postMessage, + ) + switch (chartResults.type) { + case 'loading': { + return + } + case 'error': { + return + } + case 'not loaded': { + return
Not yet loaded data
+ } + case 'success': { + return ( + { + chartViewMakeChartEdit(JSON.parse(JSON.stringify(config))) + }} + /> + ) + } + } +} diff --git a/js/packages/quary-extension-ui/src/components/ChartEditorHeader.stories.tsx b/js/packages/quary-extension-ui/src/components/ChartEditorHeader.stories.tsx new file mode 100644 index 00000000..e0f45252 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ChartEditorHeader.stories.tsx @@ -0,0 +1,66 @@ +import { Meta, StoryObj } from '@storybook/react' +import { ChartEditorHeader } from './ChartEditorHeader' + +const meta: Meta = { + component: ChartEditorHeader, +} + +export default meta + +type Story = StoryObj + +const assets = ['model_a', 'model_b', 'model_c'] + +export const RawSQL: Story = { + args: { + chartFileSource: { + $case: 'rawSql', + rawSql: 'SELECT * FROM table', + }, + assets, + disabled: false, + }, +} + +export const DisabledRawSQL: Story = { + args: { + ...RawSQL.args, + disabled: true, + }, +} + +export const TemplatedSQL: Story = { + args: { + chartFileSource: { + $case: 'preTemplatedSql', + preTemplatedSql: 'SELECT * FROM q.table', + }, + assets, + disabled: false, + }, +} + +export const DisabledTemplatedSQL: Story = { + args: { + ...TemplatedSQL.args, + disabled: true, + }, +} + +export const AssetReference: Story = { + args: { + chartFileSource: { + $case: 'reference', + reference: 'model_a', + }, + assets, + disabled: false, + }, +} + +export const DisabledAssetReference: Story = { + args: { + ...AssetReference.args, + disabled: true, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/ChartEditorHeader.tsx b/js/packages/quary-extension-ui/src/components/ChartEditorHeader.tsx new file mode 100644 index 00000000..0a321437 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ChartEditorHeader.tsx @@ -0,0 +1,303 @@ +import React, { useState } from 'react' +import { PencilSquareIcon, PlayIcon, PlusIcon } from '@heroicons/react/20/solid' +import { useCallBackFrontEnd } from '@shared/callBacks.ts' +import { z } from 'zod' +import { ChartFile } from '@quary/proto/quary/service/v1/chart_file' +import { vscode } from '@/utils/VSCodeAPIWrapper.ts' + +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectTrigger, + SelectValue, +} from '@/components/ui/select' +import { + TooltipProvider, + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input.tsx' + +interface Props { + chartFileSource: ChartFile['source'] + assets: string[] + disabled: boolean +} + +export const ChartEditorHeader: React.FC = ({ + assets, + disabled, + chartFileSource, +}) => { + const { + chartViewMakeSourceEdit, + chartViewCreateModel, + chartViewRunQuery, + chartViewOpenTextEditor, + } = useCallBackFrontEnd( + [ + 'chartViewMakeSourceEdit', + 'chartViewCreateModel', + 'chartViewRunQuery', + 'chartViewOpenTextEditor', + ], + vscode.postMessage, + ) + + // intermediary source state for the header component + const [stagedChartFileSource, setStagedChartFileSource] = + useState(chartFileSource) + + const onChangeSource = (source: ChartFile['source']) => { + // update the staged source + setStagedChartFileSource(source) + // emit a change to the file (makeEditSource) + chartViewMakeSourceEdit(source) + } + + const formSourceValue = mapChartFileSourceToForm(stagedChartFileSource) + + return ( +
+ + + } + onClick={() => { + chartViewRunQuery(null) + }} + disabled={ + disabled || + // disable the run button if no asset is selected + (formSourceValue.type === 'reference' && !formSourceValue.reference) + } + tooltip="Run Query" + /> + } + onClick={() => chartViewOpenTextEditor(null)} + disabled={disabled} + tooltip="Edit Yaml" + /> +
+ ) +} + +interface SubFormProps { + formSourceValue: FormSourceValue + disabled: boolean + onChangeSource: (source: ChartFile['source']) => void + assets: string[] + // create a model from the sql should open file + chartViewCreateModel: (sql: string) => void +} + +const SubForm: React.FC = ({ + formSourceValue, + disabled, + onChangeSource, + assets, + chartViewCreateModel, +}) => { + switch (formSourceValue.type) { + case 'rawSql': + return ( + + onChangeSource({ $case: 'rawSql', rawSql: e.target.value }) + } + /> + ) + case 'preTemplatedSql': + return ( + <> + + onChangeSource({ + $case: 'preTemplatedSql', + preTemplatedSql: e.target.value, + }) + } + /> + + + + + + +

Create Model

+
+
+
+ + ) + case 'reference': + return ( +
+ +
+ ) + default: + return null + } +} + +const mapChartFileSourceToForm = ( + source: ChartFile['source'], +): FormSourceValue => { + if (!source) { + return { + type: 'rawSql', + rawSql: '', + } + } + switch (source.$case) { + case 'rawSql': + return { + type: 'rawSql', + rawSql: source.rawSql, + } + case 'preTemplatedSql': + return { + type: 'preTemplatedSql', + preTemplatedSql: source.preTemplatedSql, + } + case 'reference': + return { + type: 'reference', + reference: source.reference.name, + } + } +} + +const FormSchema = z.union([ + z.object({ + type: z.literal('rawSql'), + rawSql: z.string({}), + }), + z.object({ + type: z.literal('preTemplatedSql'), + preTemplatedSql: z.string({}), + }), + z.object({ + type: z.literal('reference'), + reference: z.string({}), + }), +]) + +interface TooltipButtonProps { + icon: React.ReactNode + onClick: () => void + disabled: boolean + tooltip: string +} + +const TooltipButton: React.FC = ({ + icon, + onClick, + disabled, + tooltip, +}) => ( + + + + + + +

{tooltip}

+
+
+
+) + +type FormSourceValue = z.infer diff --git a/js/packages/quary-extension-ui/src/components/CodeBlock.stories.tsx b/js/packages/quary-extension-ui/src/components/CodeBlock.stories.tsx new file mode 100644 index 00000000..5484c251 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/CodeBlock.stories.tsx @@ -0,0 +1,20 @@ +import { Meta, StoryObj } from '@storybook/react' +import { CodeBlock } from './CodeBlock' + +const meta: Meta = { + component: CodeBlock, +} + +export default meta + +type Story = StoryObj + +export const Main: Story = { + args: { + code: `SELECT * FROM users WHERE id = 1;`, + language: { + type: 'sql', + variant: 'bigquery', + }, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/CodeBlock.tsx b/js/packages/quary-extension-ui/src/components/CodeBlock.tsx new file mode 100644 index 00000000..96bdc71b --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/CodeBlock.tsx @@ -0,0 +1,62 @@ +import React from 'react' +import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter' +import sql from 'react-syntax-highlighter/dist/esm/languages/prism/sql' +import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml' +import vs from 'react-syntax-highlighter/dist/esm/styles/prism/vs' +import { ClipboardDocumentIcon } from '@heroicons/react/20/solid' +import { format } from 'sql-formatter' +import { SqlLanguage } from '@shared/config' +import { Button } from '@/components/ui/button' +import { copyToClipboard } from '@/utils/clipboard' + +interface Props { + code: string + language: + | { + type: 'sql' + variant: SqlLanguage + } + | { + type: 'yaml' + } + turnOffCopy?: boolean +} + +SyntaxHighlighter.registerLanguage('sql', sql) +SyntaxHighlighter.registerLanguage('yaml', yaml) + +export const CodeBlock: React.FC = ({ code, language, turnOffCopy }) => { + let out: string + switch (language.type) { + case 'sql': { + out = format(code.trim(), { + language: language.variant === 'duckdb' ? 'sql' : language.variant, + }) + break + } + case 'yaml': { + out = code + break + } + default: { + throw new Error(`Unknown language type: ${language}`) + } + } + return ( +
+
+ + {out} + +
+ {turnOffCopy === true ? null : ( +
+ +
+ )} +
+ ) +} diff --git a/js/packages/quary-extension-ui/src/components/Dag.css b/js/packages/quary-extension-ui/src/components/Dag.css new file mode 100644 index 00000000..7b4c8e13 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Dag.css @@ -0,0 +1,11 @@ +.react-flow__controls-button { + border: none; +} + +.react-flow__controls-button svg { + fill: var(--vscode-editor-foreground); +} + +.react-flow__panel.react-flow__attribution { + display: none; +} diff --git a/js/packages/quary-extension-ui/src/components/Dag.stories.tsx b/js/packages/quary-extension-ui/src/components/Dag.stories.tsx new file mode 100644 index 00000000..dff96023 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Dag.stories.tsx @@ -0,0 +1,143 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Dag } from './Dag' + +const meta: Meta = { + component: Dag, +} + +export default meta + +type Story = StoryObj + +export const Main: Story = { + args: { + dag: { + models: [ + { + name: 'orders', + modelOrSeedOrSource: 3, + filePath: '/path/to/orders.sql', + }, + { + name: 'customers', + modelOrSeedOrSource: 3, + filePath: '/path/to/customers.sql', + }, + { + name: 'products', + modelOrSeedOrSource: 3, + filePath: '/path/to/products.sql', + }, + { + name: 'inventory', + modelOrSeedOrSource: 3, + filePath: '/path/to/inventory.sql', + }, + { + name: 'shipping', + modelOrSeedOrSource: 3, + filePath: '/path/to/shipping.sql', + }, + { + name: 'order_enrichment', + modelOrSeedOrSource: 1, + filePath: '/path/to/order_enrichment.sql', + }, + { + name: 'customer_segmentation', + modelOrSeedOrSource: 1, + filePath: '/path/to/customer_segmentation.sql', + }, + { + name: 'product_analysis', + modelOrSeedOrSource: 1, + filePath: '/path/to/product_analysis.sql', + }, + { + name: 'inventory_analysis', + modelOrSeedOrSource: 1, + filePath: '/path/to/inventory_analysis.sql', + }, + { + name: 'shipping_analysis', + modelOrSeedOrSource: 1, + filePath: '/path/to/shipping_analysis.sql', + }, + { + name: 'sales_forecasting', + modelOrSeedOrSource: 1, + filePath: '/path/to/sales_forecasting.sql', + }, + { + name: 'logistics_optimization', + modelOrSeedOrSource: 1, + filePath: '/path/to/logistics_optimization.sql', + }, + { + name: 'market_trends', + modelOrSeedOrSource: 1, + filePath: '/path/to/market_trends.sql', + }, + { + name: 'combined_insights', + modelOrSeedOrSource: 1, + filePath: '/path/to/combined_insights.sql', + }, + { + name: 'finance_insights', + modelOrSeedOrSource: 1, + filePath: '/path/to/finance_insights.sql', + }, + { + name: 'operational_insights', + modelOrSeedOrSource: 1, + filePath: '/path/to/operational_insights.sql', + }, + { + name: 'strategic_decisions', + modelOrSeedOrSource: 1, + filePath: '/path/to/strategic_decisions.sql', + }, + ], + dag: { + nodes: [ + { id: 'orders', isCached: false }, + { id: 'customers', isCached: false }, + { id: 'products', isCached: false }, + { id: 'inventory', isCached: false }, + { id: 'shipping', isCached: false }, + { id: 'order_enrichment', isCached: false }, + { id: 'customer_segmentation', isCached: false }, + { id: 'product_analysis', isCached: false }, + { id: 'inventory_analysis', isCached: false }, + { id: 'shipping_analysis', isCached: false }, + { id: 'sales_forecasting', isCached: false }, + { id: 'logistics_optimization', isCached: false }, + { id: 'market_trends', isCached: false }, + { id: 'combined_insights', isCached: true }, + { id: 'finance_insights', isCached: true }, + { id: 'operational_insights', isCached: true }, + { id: 'strategic_decisions', isCached: false }, + ], + edges: [ + { from: 'orders', to: 'order_enrichment' }, + { from: 'customers', to: 'customer_segmentation' }, + { from: 'products', to: 'product_analysis' }, + { from: 'inventory', to: 'inventory_analysis' }, + { from: 'shipping', to: 'shipping_analysis' }, + { from: 'order_enrichment', to: 'sales_forecasting' }, + { from: 'customer_segmentation', to: 'market_trends' }, + { from: 'product_analysis', to: 'market_trends' }, + { from: 'inventory_analysis', to: 'logistics_optimization' }, + { from: 'shipping_analysis', to: 'logistics_optimization' }, + { from: 'sales_forecasting', to: 'combined_insights' }, + { from: 'market_trends', to: 'combined_insights' }, + { from: 'logistics_optimization', to: 'operational_insights' }, + { from: 'combined_insights', to: 'finance_insights' }, + { from: 'operational_insights', to: 'strategic_decisions' }, + { from: 'finance_insights', to: 'strategic_decisions' }, + ], + }, + }, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/Dag.test.tsx b/js/packages/quary-extension-ui/src/components/Dag.test.tsx new file mode 100644 index 00000000..92bb5885 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Dag.test.tsx @@ -0,0 +1,173 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { expect, it, describe } from 'vitest' +import { isErr } from '@shared/result' +import { DagEdge, DagNode, findTargetNode, applyLayout } from '@/components/Dag' + +describe('findTargetNode', () => { + it('should solve a simple example with one node', () => { + const nodes: DagNode[] = [ + { + id: '1', + label: '1', + }, + ] + const edges: DagEdge[] = [] + + const result = findTargetNode(nodes, edges) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual(nodes[0]) + }) + + it('should solve a simple example with two nodes', () => { + const nodes: DagNode[] = [ + { + id: '1', + label: '1', + }, + { + id: '2', + label: '2', + }, + ] + const edges: DagEdge[] = [ + { + source: nodes[0].id, + target: nodes[1].id, + }, + ] + + const result = findTargetNode(nodes, edges) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual(nodes[1]) + }) + + it('should solve a simple example with three nodes', () => { + const nodes: DagNode[] = [ + { + id: '1', + label: '1', + }, + { + id: '2', + label: '2', + }, + { + id: '3', + label: '3', + }, + ] + const edges: DagEdge[] = [ + { + source: nodes[0].id, + target: nodes[2].id, + }, + { + source: nodes[1].id, + target: nodes[2].id, + }, + ] + + const result = findTargetNode(nodes, edges) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual(nodes[2]) + }) + + it('should resolve a more complex tree', () => { + const nodes: DagNode[] = [ + { id: 'a', label: 'a' }, + { id: 'b', label: 'b' }, + { id: 'c', label: 'c' }, + { id: 'd', label: 'd' }, + ] + const edges: DagEdge[] = [ + { source: 'a', target: 'b' }, + { source: 'c', target: 'b' }, + { source: 'b', target: 'd' }, + ] + + const result = findTargetNode(nodes, edges) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual({ id: 'd', label: 'd' }) + }) +}) + +describe('dagreGraphLayout', () => { + it('should solve a simple example with one node', () => { + const nodes: DagNode[] = [ + { + id: '1', + label: '1', + }, + ] + const edges: DagEdge[] = [] + + const target = findTargetNode(nodes, edges) + if (isErr(target)) { + throw new Error('target not found') + } + + const result = applyLayout(nodes, edges, target.value) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual([ + { + ...result.value[0], + id: '1', + }, + ]) + }) + + it('should solve a simple example with two nodes', () => { + const nodes: DagNode[] = [ + { + id: '1', + label: '1', + }, + { + id: '2', + label: '2', + }, + ] + const edges: DagEdge[] = [ + { + source: nodes[0].id, + target: nodes[1].id, + }, + ] + + const target = findTargetNode(nodes, edges) + if (isErr(target)) { + throw new Error('target not found') + } + + const result = applyLayout(nodes, edges, target.value) + if (isErr(result)) { + throw new Error('target not found') + } + + expect(result.value).toEqual([ + { + ...result.value[0], + id: '1', + }, + { + ...result.value[1], + id: '2', + }, + ]) + }) +}) diff --git a/js/packages/quary-extension-ui/src/components/Dag.tsx b/js/packages/quary-extension-ui/src/components/Dag.tsx new file mode 100644 index 00000000..35562ff1 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Dag.tsx @@ -0,0 +1,304 @@ +/* eslint-disable react-refresh/only-export-components */ +import { useMemo } from 'react' +import { + Controls, + MarkerType, + ReactFlow, + Background, + BackgroundVariant, +} from 'reactflow' +import dagre from '@dagrejs/dagre' +import 'reactflow/dist/style.css' +import './Dag.css' +import { Dag as DagType } from '@shared/globalViewState' +import { Err, isErr, Ok, ResultE } from '@shared/result' +import { Warning } from './Warning' +import { DagNode, DagNodeDataType } from './DagNode' +import { cn } from '@/lib/utils' + +const NODE_SPACING = 200 +const LAYER_SPACING = 20 + +interface Props { + dag: DagType + onNodeDoubleClick?: (node: DagNodeDataType) => void + className?: string + optionalDagNodeOverride?: React.FC> + overrideFlowEdgeStroke?: string + isFullProjectDag?: boolean +} + +export type DagLocalType = { + nodes: { + modelName: string + presentCacheView?: boolean + modelOrSeedOrSource?: number + filePath?: string + }[] + edges: { from: string; to: string }[] +} + +const transformProjectDag = ({ dag, models }: DagType): DagLocalType => ({ + nodes: dag.nodes.map((node) => { + // TODO: error handling for when node.id is not found or return additional metadata in rust + const matchingModel = models.find((model) => model.name === node.id) + return { + modelName: node.id, + presentCacheView: node.isCached, + modelOrSeedOrSource: matchingModel?.assetType, // TODO: make non-optional + filePath: matchingModel?.filePath, // TODO: make non-optional + } + }), + edges: dag.edges, +}) + +export const Dag: React.FC = ({ + dag: untransformedDag, + onNodeDoubleClick, + className, + optionalDagNodeOverride, + overrideFlowEdgeStroke, + isFullProjectDag = false, +}) => { + const dag = useMemo( + () => transformProjectDag(untransformedDag), + [untransformedDag], + ) + + const { flowNodes, flowEdges, error } = useMemo(() => { + const { nodes, edges } = mapDagTypeToDagModel(dag) + + const targetNodeResult = isFullProjectDag + ? findFullProjectTargetNodes(nodes, edges) + : findTargetNode(nodes, edges) + + if (isErr(targetNodeResult)) { + return { error: targetNodeResult.error } + } + + const organisedNodesResult = applyLayout( + nodes, + edges, + targetNodeResult.value.id, + ) + if (isErr(organisedNodesResult)) { + return { error: organisedNodesResult.error } + } + + const flowEdges = edges.map(({ source, target }) => ({ + id: `${source}-${target}`, + source, + target, + animated: true, + style: { + stroke: overrideFlowEdgeStroke ?? 'var(--vscode-editor-foreground)', + }, + markerEnd: { + type: MarkerType.ArrowClosed, + }, + })) + + return { flowNodes: organisedNodesResult.value, flowEdges, error: null } + }, [dag, overrideFlowEdgeStroke, isFullProjectDag]) + + if (error) { + return + } + + const nodeTypes = optionalDagNodeOverride + ? { quaryNode: optionalDagNodeOverride } + : { quaryNode: DagNode } + + return ( +
+ { + const nodeData = node.data as DagNodeDataType + onNodeDoubleClick?.(nodeData) + }} + > + + + +
+ ) +} + +export const applyLayout = ( + nodes: DagNode[], + edges: DagEdge[], + targetNodeId: string, +): ResultE< + { + id: string + type: string + data: DagNodeDataType + position: Position + }[], + string +> => { + try { + const dagreGraph = new dagre.graphlib.Graph() + dagreGraph.setDefaultEdgeLabel(() => ({})) + dagreGraph.setGraph({ + rankdir: 'LR', + align: 'UL', + marginx: NODE_SPACING, + marginy: LAYER_SPACING, + }) + + nodes.forEach((node) => { + const nodeWidth = Math.max(NODE_SPACING, node.label.length * 10) + const nodeHeight = LAYER_SPACING + dagreGraph.setNode(node.id, { + width: nodeWidth, + height: nodeHeight, + }) + }) + + edges.forEach((edge) => { + dagreGraph.setEdge(edge.source, edge.target) + }) + + dagre.layout(dagreGraph) + + const flowNodes = nodes.map( + ({ id, label, backGroundLabel, type, filePath }) => ({ + id, + type: 'quaryNode', + data: { + highlight: id === targetNodeId, + label, + backGroundLabel, + type, + filePath, + }, + position: { + x: dagreGraph.node(id).x, + y: dagreGraph.node(id).y, + }, + }), + ) + return Ok(flowNodes) + } catch (e) { + if (e instanceof Error) { + return Err(e.message) + } + return Err('Unknown error') + } +} + +export const findFullProjectTargetNodes = ( + nodes: DagNode[], + edges: DagEdge[], +): ResultE => { + if (nodes.length === 0) { + return Err('Expected at least one node') + } + const targets = edges + .map(({ target }) => target) + .reduce((acc, el) => acc.add(el), new Set()) + const sources = edges + .map(({ source }) => source) + .reduce((acc, el) => acc.add(el), new Set()) + + const unconnectedNodes = nodes.filter( + (n) => !targets.has(n.id) && !sources.has(n.id), + ) + + const nodesThatAreTargetsAndNotSources = nodes.filter( + (n) => targets.has(n.id) && !sources.has(n.id), + ) + + const targetNode = nodesThatAreTargetsAndNotSources[0] || unconnectedNodes[0] + + if (!targetNode) { + return Err('No suitable target node found') + } + + return Ok(targetNode) +} + +export const findTargetNode = ( + nodes: DagNode[], + edges: DagEdge[], +): ResultE => { + if (nodes.length === 0) { + return Err('Expected at least one node') + } + if (nodes.length === 1 && edges.length === 0) { + return Ok(nodes[0]) + } + const targets = edges + .map(({ target }) => target) + .reduce((acc, el) => acc.add(el), new Set()) + const sources = edges + .map(({ source }) => source) + .reduce((acc, el) => acc.add(el), new Set()) + + const nodesThatAreTargetsAndNotSources = nodes.filter( + (n) => targets.has(n.id) && !sources.has(n.id), + ) + if (nodesThatAreTargetsAndNotSources.length !== 1) { + return Err( + `Expected one node that is just a target, got ${ + nodesThatAreTargetsAndNotSources.length + }, nodes ${nodesThatAreTargetsAndNotSources.map((n) => n.id)}`, + ) + } + // Assuming there's only one root node, return the first one found + return Ok(nodesThatAreTargetsAndNotSources[0]) +} + +const mapDagTypeToDagModel = (dag: DagLocalType): DagModel => { + const { nodes, edges } = dag + return { + nodes: nodes.map( + ({ modelName, presentCacheView, modelOrSeedOrSource, filePath }) => ({ + id: modelName, + label: modelName, + backGroundLabel: presentCacheView!, + type: modelOrSeedOrSource, + filePath, + }), + ), + edges: edges.map(({ from, to }) => ({ source: from, target: to })), + } +} + +export type Position = { + x: number + y: number +} + +export interface DagModel { + nodes: DagNode[] + edges: DagEdge[] +} + +export type DagEdge = { + source: string + target: string +} + +export interface DagNode { + id: string + label: string + backGroundLabel: boolean + type?: number + filePath?: string +} diff --git a/js/packages/quary-extension-ui/src/components/DagNode.tsx b/js/packages/quary-extension-ui/src/components/DagNode.tsx new file mode 100644 index 00000000..7a92e27e --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/DagNode.tsx @@ -0,0 +1,128 @@ +import React from 'react' +import { Handle, Position } from 'reactflow' +import { twMerge } from 'tailwind-merge' +import { + CircleStackIcon as DatabaseIcon, + CubeIcon as ModelIcon, + QuestionMarkCircleIcon as UnknownIcon, + TableCellsIcon as SeedIcon, + CameraIcon as SnapshotIcon, +} from '@heroicons/react/20/solid' +import { ListAssetsResponse_Asset_AssetType } from '@quary/proto/quary/service/v1/wasm_rust_rpc_calls' + +export type DagNodeDataType = { + label: string + highlight: boolean + backGroundLabel?: boolean + type?: number + filePath?: string +} + +interface Props { + data: DagNodeDataType +} + +export const DagNode: React.FC> = ({ data }) => { + const nodeBaseStyle = + 'flex items-center justify-center shadow-lg rounded-lg overflow-hidden min-w-fit' + + const nodeHighlightStyle = data.highlight + ? 'bg-vscode-editorInfo-foreground text-white' + : 'bg-white text-gray-800' + + const nodeClasses = twMerge(nodeBaseStyle, nodeHighlightStyle) + + return ( + <> + + +
+ + {data.backGroundLabel && ( +
+ cached +
+ )} + +
+
+ {data.label} +
+
+ + +
+ + ) +} + +const DagNodeTypeLabel = ({ type }: { type: number }) => { + const protoType = ListAssetsResponse_Asset_AssetType + + const componentTypes: { + [key: number]: { + component: React.FC + label: string + style: string + } + } = { + [protoType.ASSET_TYPE_SEED]: { + component: SeedIcon, + label: 'SEED', + style: 'bg-vscode-terminal-ansiGreen', + }, + [protoType.ASSET_TYPE_SOURCE]: { + component: DatabaseIcon, + label: 'SRC', + style: 'bg-vscode-terminal-ansiBrightBlack', + }, + [protoType.ASSET_TYPE_SNAPSHOT]: { + component: SnapshotIcon, + label: 'SNP', + style: 'bg-vscode-editorInfo-foreground', + }, + [protoType.ASSET_TYPE_MODEL]: { + component: ModelIcon, + label: 'MDL', + style: 'bg-vscode-editorInfo-foreground', + }, + } + + const { + component: IconComponent = UnknownIcon, + label = '', + style = 'bg-vscode-editorInfo-foreground', + } = componentTypes[type] || {} + + const labelClasses = twMerge( + 'text-vscode-button-foreground px-2 py-3 text-xs flex items-center justify-center flex-col', + style, + ) + + return ( +
+ + {label} +
+ ) +} diff --git a/js/packages/quary-extension-ui/src/components/DataTable.stories.tsx b/js/packages/quary-extension-ui/src/components/DataTable.stories.tsx new file mode 100644 index 00000000..83831506 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/DataTable.stories.tsx @@ -0,0 +1,54 @@ +import { Meta, StoryObj } from '@storybook/react' +import { + QueryResult, + QueryResultColumn, +} from '@quary/proto/quary/service/v1/query_result' +import { DataTable } from './DataTable' + +const meta: Meta = { + component: DataTable, +} + +export default meta + +type Story = StoryObj + +const headersRowsToQueryResult = ({ + headers, + rows, +}: { + headers: string[] + rows: string[][] +}): QueryResult => { + const columns: QueryResultColumn[] = headers.map((header, i) => ({ + name: header, + values: rows.map((row) => row[i]), + type: 'Example Type', + })) + + return { + columns, + } +} + +export const Main: Story = { + args: { + result: headersRowsToQueryResult({ + headers: ['Currency', 'Date', 'Sales Amount', 'Product Name', 'Region'], + rows: [ + ['USD', '2024-01-05', '$1500', 'Widget A', 'USA'], + ['EUR', '2024-01-04', 'โ‚ฌ1200', 'Widget B', 'Germany'], + ['GBP', '2024-01-03', 'ยฃ800', 'Widget C', 'UK'], + ], + }), + }, +} + +export const Empty: Story = { + args: { + result: headersRowsToQueryResult({ + headers: ['Currency', 'Date', 'Sales Amount', 'Product Name', 'Region'], + rows: [], + }), + }, +} diff --git a/js/packages/quary-extension-ui/src/components/DataTable.tsx b/js/packages/quary-extension-ui/src/components/DataTable.tsx new file mode 100644 index 00000000..954f52e9 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/DataTable.tsx @@ -0,0 +1,37 @@ +import * as React from 'react' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' +import { queryResultToColumnsValues } from '@shared/shared' +import { Table, TableHeaderWithSubheader } from './Table' + +interface Props { + result: QueryResult + limit: number | undefined +} + +export const DataTable: React.FC = ({ result, limit }) => { + const { columns, values } = queryResultToColumnsValues(result) + return ( +
+ ( + + ))} + rows={values} + /> +
+ {limit ? ( +

+ Note: A limit of {limit} was applied. + {limit > values.length + ? ` All ${values.length} results are displayed.` + : ` Showing ${values.length} of potentially more available results.`} +

+ ) : null} +
+ + ) +} diff --git a/js/packages/quary-extension-ui/src/components/Logo.tsx b/js/packages/quary-extension-ui/src/components/Logo.tsx new file mode 100644 index 00000000..3ae04de9 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Logo.tsx @@ -0,0 +1,41 @@ +interface Props { + className?: string +} + +export const Logo: React.FC = ({ className }) => ( + + + + + + + + + + + + + + +) diff --git a/js/packages/quary-extension-ui/src/components/ModelDetails.stories.tsx b/js/packages/quary-extension-ui/src/components/ModelDetails.stories.tsx new file mode 100644 index 00000000..b7d16a72 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ModelDetails.stories.tsx @@ -0,0 +1,402 @@ +import { Meta, StoryObj } from '@storybook/react' +import { ModelDetails } from './ModelDetails' + +const meta: Meta = { + component: ModelDetails, +} + +export default meta + +type Story = StoryObj + +const argTypes = { + addColumn: { action: 'addColumn' }, + addColumnTest: { action: 'addColumnTest' }, + removeColumnTest: { action: 'removeColumnTest' }, + addDescription: { action: 'addDescription' }, +} + +const args = { + table: { + tableType: { + $case: 'present', + present: { + rows: [ + { + row: { + $case: 'presentInSqlAndDefinitions', + presentInSqlAndDefinitions: { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInSqlAndDefinitions', + presentInSqlAndDefinitions: { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'presentAndInferredIdentical', + presentAndInferredIdentical: + "This is just a present description that's also inferred", + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInSqlAndDefinitions', + presentInSqlAndDefinitions: { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'presentWithDifferentInference', + presentWithDifferentInference: { + present: "This is the description that's present", + inferred: "This is the description that's inferred", + }, + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInSqlAndDefinitions', + presentInSqlAndDefinitions: { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'inferred', + inferred: 'This is just an inferred description', + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInSqlAndDefinitions', + presentInSqlAndDefinitions: { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'notPresent', + notPresent: {}, + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInDefinitionsButNotRecognisableInSql', + presentInDefinitionsButNotRecognisableInSql: { + title: 'Present in definition but not recognisable in SQL', + tests: [], + description: { + description: { + $case: 'notPresent', + notPresent: {}, + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInDefinitionsButNotRecognisableInSql', + presentInDefinitionsButNotRecognisableInSql: { + title: 'Present in definition but not recognisable in SQL', + tests: [], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + }, + }, + { + row: { + $case: 'presentInDefinitionsButNotRecognisableInSql', + presentInDefinitionsButNotRecognisableInSql: { + title: 'Present in definition but not recognisable in SQL', + tests: [ + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: { + text: 'Present and not Inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: { + text: 'Present and not Inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: { + text: 'Present and not Inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: { + text: 'Present and not Inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'presentAndInferred', + presentAndInferred: { + text: 'Present and Inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'notPresentButInferred', + notPresentButInferred: { + text: 'Not present but inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + ], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + }, + }, + { + row: { + $case: 'missingInDefinitions', + missingInDefinitions: { + title: + 'Present in definition but not recognisable in SQL with super long title that should wrap.', + tests: [ + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: { + text: 'Present and not inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'presentAndInferred', + presentAndInferred: { + text: 'Present and inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + { + test: { + $case: 'notPresentButInferred', + notPresentButInferred: { + text: 'Not present but inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + ], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + }, + }, + ], + }, + }, + }, +} + +export const PresentInDefinitions: Story = { + argTypes, + args, +} + +export const NotPresent: Story = { + argTypes, + args: { + table: { + tableType: { + $case: 'notPresent', + notPresent: { + rows: [ + { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'presentAndInferredIdentical', + presentAndInferredIdentical: + "This is just a present description that's also inferred", + }, + }, + }, + { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'presentWithDifferentInference', + presentWithDifferentInference: { + present: "This is the description that's present", + inferred: "This is the description that's inferred", + }, + }, + }, + }, + { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'inferred', + inferred: 'This is just an inferred description', + }, + }, + }, + { + title: 'Present in SQL and definitions', + tests: [], + description: { + description: { + $case: 'notPresent', + notPresent: {}, + }, + }, + }, + { + title: 'Present in definition but not recognisable in SQL', + tests: [], + description: { + description: { + $case: 'notPresent', + notPresent: {}, + }, + }, + }, + { + title: 'Present in definition but not recognisable in SQL', + tests: [], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + { + title: 'Present in definition but not recognisable in SQL', + tests: [ + { + test: { + $case: 'presentAndNotInferred', + presentAndNotInferred: 'Present and not inferred', + }, + }, + { + test: { + $case: 'presentAndInferred', + presentAndInferred: 'Present and inferred', + }, + }, + { + test: { + $case: 'notPresentButInferred', + notPresentButInferred: { + text: 'Not present but inferred', + columnTest: { + type: 'not_null', + }, + }, + }, + }, + ], + description: { + description: { + $case: 'present', + present: 'This is just a present description', + }, + }, + }, + ], + }, + }, + }, + }, +} + +export const CallbacksNotPresent: Story = { + args, +} diff --git a/js/packages/quary-extension-ui/src/components/ModelDetails.tsx b/js/packages/quary-extension-ui/src/components/ModelDetails.tsx new file mode 100644 index 00000000..a767650e --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ModelDetails.tsx @@ -0,0 +1,537 @@ +/* eslint-disable react/jsx-key */ +import { useState } from 'react' +import { + InfoCircledIcon, + PlusCircledIcon, + Pencil2Icon, + CrossCircledIcon, + CheckCircledIcon, +} from '@radix-ui/react-icons' +import { ColumnTest } from '@quary/proto/quary/service/v1/project_file' +import { + RowDescription, + RowTest, + Table, +} from '@quary/proto/quary/service/v1/table' +import { Table as TableComponent } from './Table' +import { AddTestDialog } from './AddTestDialog' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from '@/components/ui/tooltip' +import { Badge } from '@/components/ui/badge' + +interface Props { + table: Table + addColumn?: (column: string) => void + addDescription?: (column: string, description: string) => void + addColumnTest?: (column: string, columnTest: ColumnTest) => void + removeColumnTest?: (column: string, columnTest: ColumnTest) => void +} + +export const ModelDetails: React.FC = ({ + table, + addColumn, + addColumnTest, + addDescription, + removeColumnTest, +}) => { + const tableType = table.tableType + if (!tableType) { + throw Error(`No table type provided in ${JSON.stringify(table)}`) + } + switch (tableType.$case) { + case 'present': { + const table = tableType.present + const rows = table.rows.map((row) => { + const rowType = row.row! + switch (rowType.$case) { + case 'presentInSqlAndDefinitions': { + const { title, tests, description } = + rowType.presentInSqlAndDefinitions + const addColumnTestForCallback = addColumnTest + ? (columnTest: ColumnTest) => { + addColumnTest(title, columnTest) + } + : undefined + const removeColumnTestForCallback = removeColumnTest + ? (columnTest: ColumnTest) => { + removeColumnTest(title, columnTest) + } + : undefined + const addDescriptionForCallback = addDescription + ? (description: string) => { + addDescription(title, description) + } + : undefined + return RowWrapper({ + title: , + tests, + description, + addColumnTest: addColumnTestForCallback, + removeColumnTest: removeColumnTestForCallback, + addDescription: addDescriptionForCallback, + }) + } + case 'presentInDefinitionsButNotRecognisableInSql': { + const { title, tests, description } = + rowType.presentInDefinitionsButNotRecognisableInSql + const addColumnTestForCallback = addColumnTest + ? (columnTest: ColumnTest) => { + addColumnTest(title, columnTest) + } + : undefined + const removeColumnTestForCallback = removeColumnTest + ? (columnTest: ColumnTest) => { + removeColumnTest(title, columnTest) + } + : undefined + const addDescriptionForCallback = addDescription + ? (description: string) => { + addDescription(title, description) + } + : undefined + return RowWrapper({ + title:

{title}

, + tests, + description, + addColumnTest: addColumnTestForCallback, + removeColumnTest: removeColumnTestForCallback, + addDescription: addDescriptionForCallback, + }) + } + case 'missingInDefinitions': { + const { title, tests, description } = rowType.missingInDefinitions + const addColumnTestForCallback = addColumnTest + ? (columnTest: ColumnTest) => { + addColumnTest(title, columnTest) + } + : undefined + const removeColumnTestForCallback = removeColumnTest + ? (columnTest: ColumnTest) => { + removeColumnTest(title, columnTest) + } + : undefined + const addDescriptionForCallback = addDescription + ? (description: string) => { + addDescription(title, description) + } + : undefined + const addColumnForCallback = addColumn + ? () => addColumn(title) + : undefined + return RowWrapper({ + title: ( + + ), + tests, + description, + addColumnTest: addColumnTestForCallback, + removeColumnTest: removeColumnTestForCallback, + addDescription: addDescriptionForCallback, + }) + } + default: + throw new Error('Unknown row type') + } + }) + return ( + + ) + } + case 'notPresent': { + const table = tableType.notPresent + const rows = table.rows.map(({ title, description, tests }) => { + const addColumnTestForCallback = addColumnTest + ? (columnTest: ColumnTest) => { + addColumnTest(title, columnTest) + } + : undefined + const removeColumnTestForCallback = removeColumnTest + ? (columnTest: ColumnTest) => { + removeColumnTest(title, columnTest) + } + : undefined + const addDescriptionForCallback = addDescription + ? (description: string) => { + addDescription(title, description) + } + : undefined + const addColumnForCallback = addColumn + ? () => addColumn(title) + : undefined + return RowWrapper({ + title: ( + + ), + tests, + description, + addDescription: addDescriptionForCallback, + addColumnTest: addColumnTestForCallback, + removeColumnTest: removeColumnTestForCallback, + }) + }) + return ( + + ) + } + default: + throw new Error('Unknown table type') + } +} + +const InferredTitle: React.FC<{ title: string; addColumn?: () => void }> = ({ + title, + addColumn, +}) => ( +
+

{title}๏ธ

+ + + + {}} variant="secondary"> +
+ {addColumn ? : null} + Inferred +
+
+
+ +

Add inferred column to model

+
+
+
+
+) + +const InferredAndPresentTitle: React.FC<{ title: string }> = ({ title }) => ( +
+

{title}๏ธ

+
+) + +const RowWrapper = ({ + title, + tests, + description, + addColumnTest, + removeColumnTest, + addDescription, +}: { + title: React.ReactNode + tests: RowTest[] + description?: RowDescription + addColumnTest?: (columnTest: ColumnTest) => void + removeColumnTest?: (columnTest: ColumnTest) => void + addDescription?: (description: string) => void +}) => [ + title, + , + , +] + +const TestBadge = ({ + rowTest, + addColumnTest, + removeColumnTest, +}: { + rowTest: RowTest + addColumnTest?: (columnTest: ColumnTest) => void + removeColumnTest?: (columnTest: ColumnTest) => void +}) => { + const test = rowTest.test! + switch (test.$case) { + case 'presentAndNotInferred': { + const { text, columnTest } = test.presentAndNotInferred + if (!columnTest) { + throw Error( + `No column test for callback provided in ${JSON.stringify(test)}`, + ) + } + return ( + + {text} + {removeColumnTest ? ( + { + removeColumnTest(columnTest) + }} + className="h-3 w-3 hover:cursor-pointer" + /> + ) : null} + + ) + } + case 'presentAndInferred': { + const { text, columnTest } = test.presentAndInferred + if (!columnTest) { + throw Error( + `No column test for callback provided in ${JSON.stringify(test)}`, + ) + } + return ( + + + + +
+ + {text} + {removeColumnTest ? ( + { + removeColumnTest(columnTest) + }} + className="h-3 w-3 hover:cursor-pointer" + /> + ) : null} +
+
+
+ +

Inferred and in documnetstion

+
+
+
+ ) + } + case 'notPresentButInferred': { + const { text, columnTest } = test.notPresentButInferred + if (!columnTest) { + throw Error( + `No column test for callback provided in ${JSON.stringify(test)}`, + ) + } + return ( + + + + addColumnTest(columnTest) : undefined + } + variant="outline" + > + {!addColumnTest ? ( + + ) : null} +
+ {addColumnTest ? ( + + ) : null} + {text} +
+
+
+ + {addColumnTest ? ( +

Add inferred test to model

+ ) : ( +

Test is inferred

+ )} +
+
+
+ ) + } + default: + throw new Error(`Unknown table test type: ${test}`) + } +} + +const TestWrapper: React.FC<{ + tests: RowTest[] + addColumnTest?: (columnTest: ColumnTest) => void + removeColumnTest?: (columnTest: ColumnTest) => void +}> = ({ tests, addColumnTest, removeColumnTest }) => ( +
+
+ {tests.map((tableTest) => ( + + ))} + {addColumnTest ? : null} +
+
+) + +const DescriptionWrapper: React.FC<{ + description?: RowDescription + addDescription?: (description: string) => void +}> = ({ description, addDescription }) => { + const d = description?.description + if (!d) { + throw Error(`No description provided in ${JSON.stringify(description)}`) + } + switch (d.$case) { + case 'present': { + return ( + + ) + } + case 'presentAndInferredIdentical': { + return ( + + ) + } + case 'presentWithDifferentInference': { + return ( + + ) + } + case 'inferred': { + return ( + addDescription(d.inferred) : undefined + } + /> + ) + } + case 'notPresent': { + return + } + default: { + throw new Error(`Unknown description type: ${d}`) + } + } +} + +const DescriptionCell: React.FC<{ + descriptionText?: string + addDescription?: (description: string) => void +}> = ({ descriptionText, addDescription }) => { + const [editDescriptionMode, setEditDescriptionMode] = useState(false) + const [stagedDescriptionText, setStagedDescriptionText] = useState< + string | undefined + >(descriptionText) + + return ( +
+ {editDescriptionMode ? ( +
+ { + setStagedDescriptionText( + (e.target as HTMLTextAreaElement).value as string, + ) + }} + placeholder="Enter a description for this column." + /> +
+ { + setStagedDescriptionText(descriptionText) + setEditDescriptionMode(false) + }} + /> + + { + if (addDescription) { + addDescription(stagedDescriptionText || '') + } + setEditDescriptionMode(false) + }} + /> +
+
+ ) : ( + <> + {descriptionText ? ( +

+ {descriptionText} + {addDescription ? ( + + ) : null} +

+ ) : ( +
+ setEditDescriptionMode(true) + : undefined + } + > + No Description + {addDescription ? : null} + +
+ )} + + )} +
+ ) +} + +const InferredDescription: React.FC<{ + title: string + addDescription?: () => void +}> = ({ title, addDescription }) => ( +
+

{title}๏ธ

+ {addDescription ? ( + + + + +
+ + Inferred +
+
+
+ +

Add inferred description to model

+
+
+
+ ) : ( + Inferred + )} +
+) diff --git a/js/packages/quary-extension-ui/src/components/PageTitle.tsx b/js/packages/quary-extension-ui/src/components/PageTitle.tsx new file mode 100644 index 00000000..48592d08 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/PageTitle.tsx @@ -0,0 +1,7 @@ +interface Props { + children: React.ReactNode +} + +export const PageTitle: React.FC = ({ children }) => ( +

{children}

+) diff --git a/js/packages/quary-extension-ui/src/components/Perspective.stories.tsx b/js/packages/quary-extension-ui/src/components/Perspective.stories.tsx new file mode 100644 index 00000000..edd25296 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Perspective.stories.tsx @@ -0,0 +1,68 @@ +import { Meta, StoryObj } from '@storybook/react' +import { action } from '@storybook/addon-actions' +import { sampleQueryResult } from '../lib/sampleData' +import { Perspective } from './Perspective' + +const meta: Meta = { + component: Perspective, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = { + args: { + results: sampleQueryResult, + }, +} + +export const WithUpdateConfigListener: Story = { + args: { + results: sampleQueryResult, + updateConfigListener: (chartDefinition) => { + action('updateConfigListener')(chartDefinition) + }, + }, +} + +export const WithOpenWithSettings: Story = { + args: { + ...Primary.args, + openWithSettings: true, + }, +} + +export const WithTitle: Story = { + args: { + ...Primary.args, + title: 'My Chart', + }, +} + +export const WithExistingSettings: Story = { + args: { + ...Primary.args, + openWithSettings: true, + existingSettings: { + version: '2.10.0', + plugin: 'Datagrid', + plugin_config: { + columns: {}, + editable: false, + scroll_lock: false, + }, + columns_config: {}, + settings: true, + theme: 'Pro Light', + title: 'My Chart', + group_by: [], + split_by: [], + columns: ['currency', 'value', 'date_opened', 'date_closed'], + filter: [], + sort: [['date_opened', 'desc']], + expressions: {}, + aggregates: {}, + }, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/Perspective.tsx b/js/packages/quary-extension-ui/src/components/Perspective.tsx new file mode 100644 index 00000000..34baa8a3 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Perspective.tsx @@ -0,0 +1,97 @@ +import { useEffect, useRef } from 'react' +import perspective from '@finos/perspective' +import '@finos/perspective-viewer' +import '@finos/perspective-viewer-datagrid' +import '@finos/perspective-viewer-d3fc' +import '@finos/perspective-viewer/dist/css/pro.css' +// eslint-disable-next-line no-duplicate-imports +import type { HTMLPerspectiveViewerElement } from '@finos/perspective-viewer' +import { QueryResult } from '@quary/proto/quary/service/v1/query_result' +import { dropNullValuesInJSONLike, JSONValue } from '@shared/jsonValue.ts' + +interface Props { + title?: string + results: QueryResult + updateConfigListener?: (chartDefinition: JSONValue) => void + openWithSettings?: boolean + existingSettings?: JSONValue +} + +export const Perspective: React.FC = ({ + results, + updateConfigListener, + openWithSettings, + title, + existingSettings, +}) => { + const viewerRef = useRef(null) + + useEffect(() => { + const loadPerspective = async () => { + const table = await perspective.worker().table( + results.columns.reduce( + (acc, row) => { + acc[row.name] = row.values + return acc + }, + {} as Record, + ), + ) + + const el = document.querySelector('perspective-viewer') + + if (el) { + await el.load(table) + if (existingSettings) { + el.restore({ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + ...existingSettings, + title, + settings: openWithSettings ?? false, + }) + } else { + el.restore({ + title, + settings: openWithSettings ?? false, + }) + } + } + + if (el && updateConfigListener) { + el.addEventListener('perspective-config-update', async () => { + const config = await el.save('json') + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error + const betterConfig = dropNullValuesInJSONLike(config) + updateConfigListener(betterConfig) + }) + } + } + + loadPerspective() + }, [ + results.columns, + existingSettings, + openWithSettings, + title, + updateConfigListener, + ]) + + return ( +
+ +
+ ) +} diff --git a/js/packages/quary-extension-ui/src/components/ProgressRing.stories.tsx b/js/packages/quary-extension-ui/src/components/ProgressRing.stories.tsx new file mode 100644 index 00000000..7100c50a --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ProgressRing.stories.tsx @@ -0,0 +1,14 @@ +import { Meta, StoryObj } from '@storybook/react' +import { ProgressRing } from './ProgressRing' + +const meta: Meta = { + component: ProgressRing, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = { + args: {}, +} diff --git a/js/packages/quary-extension-ui/src/components/ProgressRing.tsx b/js/packages/quary-extension-ui/src/components/ProgressRing.tsx new file mode 100644 index 00000000..988c0440 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ProgressRing.tsx @@ -0,0 +1,19 @@ +import { cn } from '@/lib/utils' + +interface Props { + className?: string +} + +export const ProgressRing: React.FC = ({ className }) => ( + <> +
+ Loading... +
+ +) diff --git a/js/packages/quary-extension-ui/src/components/SectionTitle.tsx b/js/packages/quary-extension-ui/src/components/SectionTitle.tsx new file mode 100644 index 00000000..8c618afa --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/SectionTitle.tsx @@ -0,0 +1,7 @@ +interface Props { + children: string +} + +export const SectionTitle: React.FC = ({ children }) => ( +

{children}

+) diff --git a/js/packages/quary-extension-ui/src/components/Table.tsx b/js/packages/quary-extension-ui/src/components/Table.tsx new file mode 100644 index 00000000..fd7fb966 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Table.tsx @@ -0,0 +1,58 @@ +import React from 'react' +import { + Table as TableComponent, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table' + +interface Props { + headers: Array + rows: Array> +} + +export const Table: React.FC = ({ headers, rows }) => ( + + + + {headers.map((header, index) => ( + {header} + ))} + + + + {rows.length ? ( + rows.map((row, rowIndex) => ( + + {row.map((cell, cellIndex) => ( + {cell} + ))} + + )) + ) : ( + + + No results. + + + )} + + +) + +/** + * TableHeaderWithSubheader component which is used to have a header and subheader in a table as the column headers. + */ +export const TableHeaderWithSubheader: React.FC<{ + header: string + subHeader?: string | undefined +}> = ({ header, subHeader }) => ( +
+ {header} + {subHeader ? ( + {subHeader} + ) : null} +
+) diff --git a/js/packages/quary-extension-ui/src/components/Tag.stories.tsx b/js/packages/quary-extension-ui/src/components/Tag.stories.tsx new file mode 100644 index 00000000..ed786797 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Tag.stories.tsx @@ -0,0 +1,28 @@ +import { Meta, StoryObj } from '@storybook/react' +import { PlusIcon } from '@heroicons/react/20/solid' +import { Tag } from './Tag' + +const meta: Meta = { + component: Tag, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = { + args: { + label: 'not_null', + }, +} + +export const WithIcon: Story = { + args: { + label: 'not_null', + leftIcon: ( +
+ +
+ ), + }, +} diff --git a/js/packages/quary-extension-ui/src/components/Tag.tsx b/js/packages/quary-extension-ui/src/components/Tag.tsx new file mode 100644 index 00000000..aa6427c7 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Tag.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import { twMerge } from 'tailwind-merge' + +interface Props { + label: string + className?: string + leftIcon?: React.ReactNode +} + +export const Tag: React.FC = ({ label, className, leftIcon }) => ( + + {leftIcon &&
{leftIcon}
} + {label} +
+) diff --git a/js/packages/quary-extension-ui/src/components/Warning.stories.tsx b/js/packages/quary-extension-ui/src/components/Warning.stories.tsx new file mode 100644 index 00000000..5ac7218e --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Warning.stories.tsx @@ -0,0 +1,28 @@ +import { Meta, StoryObj } from '@storybook/react' +import { Warning } from './Warning' + +const meta: Meta = { + component: Warning, +} + +export default meta + +type Story = StoryObj + +export const Main: Story = { + args: { + title: 'Attention needed', + children: + 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid pariatur, ipsum similique veniam quo totam eius aperiam dolorum.', + }, +} + +export const LongError: Story = { + args: { + title: 'Attention needed', + children: `Error reading .schema file: Failed to await js function: JsValue(EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/Users/louisjordan/Desktop/analysis/quary_jaffle_shop/models/staging/schema.yaml' + EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/Users/louisjordan/Desktop/analysis/quary_jaffle_shop/models/staging/schema.yaml' + at Function.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:149:6084) + at Object.readFile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:149:4463))`, + }, +} diff --git a/js/packages/quary-extension-ui/src/components/Warning.tsx b/js/packages/quary-extension-ui/src/components/Warning.tsx new file mode 100644 index 00000000..c054c8af --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/Warning.tsx @@ -0,0 +1,28 @@ +import React from 'react' +import { ExclamationTriangleIcon } from '@heroicons/react/20/solid' + +interface Props { + title: string +} + +export const Warning: React.FC> = ({ + children, + title, +}) => ( +
+
+
+
+
+

{title}

+
+ {children} +
+
+
+
+) diff --git a/js/packages/quary-extension-ui/src/components/ui/badge.tsx b/js/packages/quary-extension-ui/src/components/ui/badge.tsx new file mode 100644 index 00000000..2f9accc4 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const badgeVariants = cva( + 'inline-flex whitespace-nowrap items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', + { + variants: { + variant: { + default: + 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80', + secondary: + 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', + destructive: + 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80', + outline: 'text-foreground', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge } diff --git a/js/packages/quary-extension-ui/src/components/ui/button.stories.tsx b/js/packages/quary-extension-ui/src/components/ui/button.stories.tsx new file mode 100644 index 00000000..9a58c8bb --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/button.stories.tsx @@ -0,0 +1,38 @@ +import React from 'react' +import { Meta, StoryObj } from '@storybook/react' +import { ChevronRightIcon } from '@heroicons/react/20/solid' +import { Button } from './button' + +const meta: Meta = { + component: Button, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = { + args: { children: 'Button', variant: 'default' }, +} +export const Secondary: Story = { + args: { children: 'Secondary', variant: 'secondary' }, +} +export const Destructive: Story = { + args: { children: 'Destructive', variant: 'destructive' }, +} +export const Outline: Story = { + args: { children: 'Outline', variant: 'outline' }, +} +export const Ghost: Story = { + args: { children: 'ghost', variant: 'ghost' }, +} +export const Link: Story = { + args: { children: 'Link', variant: 'link' }, +} +export const Icon: Story = { + args: { + children: , + variant: 'outline', + size: 'icon', + }, +} diff --git a/js/packages/quary-extension-ui/src/components/ui/button.tsx b/js/packages/quary-extension-ui/src/components/ui/button.tsx new file mode 100644 index 00000000..428e8e51 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/button.tsx @@ -0,0 +1,57 @@ +import * as React from 'react' +import { Slot } from '@radix-ui/react-slot' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const buttonVariants = cva( + 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: + 'bg-vscode-button-background text-primary-foreground hover:bg-vscode-button-hoverBackground', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-vscode-editor-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-vscode-button-secondaryBackground text-vscode-button-secondaryForeground', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + }, +) + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : 'button' + return ( + + ) + }, +) +Button.displayName = 'Button' + +export { Button } diff --git a/js/packages/quary-extension-ui/src/components/ui/card.stories.tsx b/js/packages/quary-extension-ui/src/components/ui/card.stories.tsx new file mode 100644 index 00000000..991ea414 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/card.stories.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import { Meta, StoryObj } from '@storybook/react' +import { + Card, + CardHeader, + CardTitle, + CardDescription, + CardContent, + CardFooter, +} from './card' + +const meta: Meta = { + component: Card, +} + +export default meta + +type Story = StoryObj + +export const Default: Story = { + render: () => ( + + + Card Title + This is a card description. + + +

Card content goes here.

+
+ +

Card footer content.

+
+
+ ), +} diff --git a/js/packages/quary-extension-ui/src/components/ui/card.tsx b/js/packages/quary-extension-ui/src/components/ui/card.tsx new file mode 100644 index 00000000..f2f4d81c --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/card.tsx @@ -0,0 +1,77 @@ +/* eslint-disable jsx-a11y/heading-has-content */ +import * as React from 'react' + +import { cn } from '@/lib/utils' + +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +Card.displayName = 'Card' + +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardHeader.displayName = 'CardHeader' + +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardTitle.displayName = 'CardTitle' + +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardDescription.displayName = 'CardDescription' + +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardContent.displayName = 'CardContent' + +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardFooter.displayName = 'CardFooter' + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/js/packages/quary-extension-ui/src/components/ui/checkbox.tsx b/js/packages/quary-extension-ui/src/components/ui/checkbox.tsx new file mode 100644 index 00000000..4ec31c31 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/checkbox.tsx @@ -0,0 +1,28 @@ +import * as React from 'react' +import * as CheckboxPrimitive from '@radix-ui/react-checkbox' +import { CheckIcon } from '@radix-ui/react-icons' + +import { cn } from '@/lib/utils' + +const Checkbox = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + + +)) +Checkbox.displayName = CheckboxPrimitive.Root.displayName + +export { Checkbox } diff --git a/js/packages/quary-extension-ui/src/components/ui/command.tsx b/js/packages/quary-extension-ui/src/components/ui/command.tsx new file mode 100644 index 00000000..9b3d01f2 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/command.tsx @@ -0,0 +1,150 @@ +import * as React from 'react' +import { type DialogProps } from '@radix-ui/react-dialog' +import { MagnifyingGlassIcon } from '@radix-ui/react-icons' +import { Command as CommandPrimitive } from 'cmdk' + +import { cn } from '@/lib/utils' +import { Dialog, DialogContent } from '@/components/ui/dialog' + +const Command = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Command.displayName = CommandPrimitive.displayName + +interface CommandDialogProps extends DialogProps {} + +const CommandDialog = ({ children, ...props }: CommandDialogProps) => ( + + + + {children} + + + +) + +const CommandInput = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( +
+ + +
+)) + +CommandInput.displayName = CommandPrimitive.Input.displayName + +const CommandList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandList.displayName = CommandPrimitive.List.displayName + +const CommandEmpty = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>((props, ref) => ( + +)) + +CommandEmpty.displayName = CommandPrimitive.Empty.displayName + +const CommandGroup = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandGroup.displayName = CommandPrimitive.Group.displayName + +const CommandSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +CommandSeparator.displayName = CommandPrimitive.Separator.displayName + +const CommandItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandItem.displayName = CommandPrimitive.Item.displayName + +const CommandShortcut = ({ + className, + ...props +}: React.HTMLAttributes) => ( + +) + +CommandShortcut.displayName = 'CommandShortcut' + +export { + Command, + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, + CommandShortcut, + CommandSeparator, +} diff --git a/js/packages/quary-extension-ui/src/components/ui/dialog.tsx b/js/packages/quary-extension-ui/src/components/ui/dialog.tsx new file mode 100644 index 00000000..35360b89 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/dialog.tsx @@ -0,0 +1,120 @@ +import * as React from 'react' +import * as DialogPrimitive from '@radix-ui/react-dialog' +import { Cross2Icon } from '@radix-ui/react-icons' + +import { cn } from '@/lib/utils' + +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName + +const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = 'DialogHeader' + +const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = 'DialogFooter' + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogTrigger, + DialogClose, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +} diff --git a/js/packages/quary-extension-ui/src/components/ui/input.tsx b/js/packages/quary-extension-ui/src/components/ui/input.tsx new file mode 100644 index 00000000..ed617b53 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/input.tsx @@ -0,0 +1,23 @@ +import * as React from 'react' + +import { cn } from '@/lib/utils' + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => ( + + ), +) +Input.displayName = 'Input' + +export { Input } diff --git a/js/packages/quary-extension-ui/src/components/ui/label.tsx b/js/packages/quary-extension-ui/src/components/ui/label.tsx new file mode 100644 index 00000000..586e08e9 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/label.tsx @@ -0,0 +1,24 @@ +import * as React from 'react' +import * as LabelPrimitive from '@radix-ui/react-label' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const labelVariants = cva( + 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70', +) + +const Label = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, ...props }, ref) => ( + +)) +Label.displayName = LabelPrimitive.Root.displayName + +export { Label } diff --git a/js/packages/quary-extension-ui/src/components/ui/popover.tsx b/js/packages/quary-extension-ui/src/components/ui/popover.tsx new file mode 100644 index 00000000..7d99c437 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/popover.tsx @@ -0,0 +1,31 @@ +import * as React from 'react' +import * as PopoverPrimitive from '@radix-ui/react-popover' + +import { cn } from '@/lib/utils' + +const Popover = PopoverPrimitive.Root + +const PopoverTrigger = PopoverPrimitive.Trigger + +const PopoverAnchor = PopoverPrimitive.Anchor + +const PopoverContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( + + + +)) +PopoverContent.displayName = PopoverPrimitive.Content.displayName + +export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } diff --git a/js/packages/quary-extension-ui/src/components/ui/select.tsx b/js/packages/quary-extension-ui/src/components/ui/select.tsx new file mode 100644 index 00000000..15f76db2 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/select.tsx @@ -0,0 +1,162 @@ +import * as React from 'react' +import { + CaretSortIcon, + CheckIcon, + ChevronDownIcon, + ChevronUpIcon, +} from '@radix-ui/react-icons' +import * as SelectPrimitive from '@radix-ui/react-select' + +import { cn } from '@/lib/utils' + +const Select = SelectPrimitive.Root + +const SelectGroup = SelectPrimitive.Group + +const SelectValue = SelectPrimitive.Value + +const SelectTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + span]:line-clamp-1', + className, + )} + {...props} + > + {children} + + + + +)) +SelectTrigger.displayName = SelectPrimitive.Trigger.displayName + +const SelectScrollUpButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName + +const SelectScrollDownButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollDownButton.displayName = + SelectPrimitive.ScrollDownButton.displayName + +const SelectContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, position = 'popper', ...props }, ref) => ( + + + + + {children} + + + + +)) +SelectContent.displayName = SelectPrimitive.Content.displayName + +const SelectLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectLabel.displayName = SelectPrimitive.Label.displayName + +const SelectItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + + + + {children} + +)) +SelectItem.displayName = SelectPrimitive.Item.displayName + +const SelectSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectSeparator.displayName = SelectPrimitive.Separator.displayName + +export { + Select, + SelectGroup, + SelectValue, + SelectTrigger, + SelectContent, + SelectLabel, + SelectItem, + SelectSeparator, + SelectScrollUpButton, + SelectScrollDownButton, +} diff --git a/js/packages/quary-extension-ui/src/components/ui/separator.tsx b/js/packages/quary-extension-ui/src/components/ui/separator.tsx new file mode 100644 index 00000000..85aa67db --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/separator.tsx @@ -0,0 +1,29 @@ +import * as React from 'react' +import * as SeparatorPrimitive from '@radix-ui/react-separator' + +import { cn } from '@/lib/utils' + +const Separator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>( + ( + { className, orientation = 'horizontal', decorative = true, ...props }, + ref, + ) => ( + + ), +) +Separator.displayName = SeparatorPrimitive.Root.displayName + +export { Separator } diff --git a/js/packages/quary-extension-ui/src/components/ui/table.tsx b/js/packages/quary-extension-ui/src/components/ui/table.tsx new file mode 100644 index 00000000..a1c8a436 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/table.tsx @@ -0,0 +1,120 @@ +import * as React from 'react' + +import { cn } from '@/lib/utils' + +const Table = React.forwardRef< + HTMLTableElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+

+ +)) +Table.displayName = 'Table' + +const TableHeader = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableHeader.displayName = 'TableHeader' + +const TableBody = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableBody.displayName = 'TableBody' + +const TableFooter = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + tr]:last:border-b-0', + className, + )} + {...props} + /> +)) +TableFooter.displayName = 'TableFooter' + +const TableRow = React.forwardRef< + HTMLTableRowElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableRow.displayName = 'TableRow' + +const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes +>(({ className, ...props }, ref) => ( +
[role=checkbox]]:translate-y-[2px]', + className, + )} + {...props} + /> +)) +TableHead.displayName = 'TableHead' + +const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes +>(({ className, ...props }, ref) => ( + [role=checkbox]]:translate-y-[2px]', + className, + )} + {...props} + /> +)) +TableCell.displayName = 'TableCell' + +const TableCaption = React.forwardRef< + HTMLTableCaptionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +TableCaption.displayName = 'TableCaption' + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +} diff --git a/js/packages/quary-extension-ui/src/components/ui/tabs.tsx b/js/packages/quary-extension-ui/src/components/ui/tabs.tsx new file mode 100644 index 00000000..c642043b --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/tabs.tsx @@ -0,0 +1,53 @@ +import * as React from 'react' +import * as TabsPrimitive from '@radix-ui/react-tabs' + +import { cn } from '@/lib/utils' + +const Tabs = TabsPrimitive.Root + +const TabsList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsList.displayName = TabsPrimitive.List.displayName + +const TabsTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName + +const TabsContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +TabsContent.displayName = TabsPrimitive.Content.displayName + +export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/js/packages/quary-extension-ui/src/components/ui/textarea.tsx b/js/packages/quary-extension-ui/src/components/ui/textarea.tsx new file mode 100644 index 00000000..135c03f3 --- /dev/null +++ b/js/packages/quary-extension-ui/src/components/ui/textarea.tsx @@ -0,0 +1,22 @@ +import * as React from 'react' + +import { cn } from '@/lib/utils' + +export interface TextareaProps + extends React.TextareaHTMLAttributes {} + +const Textarea = React.forwardRef( + ({ className, ...props }, ref) => ( +