From d38856dd45875043d4f33222820b9972fd141fb5 Mon Sep 17 00:00:00 2001 From: Qiheng He Date: Sun, 18 Oct 2026 09:00:20 +0800 Subject: [PATCH] Provides examples of using `dynamic-datasource` in Rust, TypeScript, and Python web projects. --- .devcontainer/Dockerfile | 30 + .devcontainer/devcontainer-lock.json | 24 + .devcontainer/devcontainer.json | 36 + .github/workflows/ci.yml | 163 +- .gitignore | 7 + CONTRIBUTING.md | 69 +- README.md | 14 + config/license/header-styles.xml | 33 + docs/graalvm-native-image.md | 38 +- docs/upstream-todo.md | 7 + polyglot/Dockerfile | 120 + polyglot/Dockerfile.dockerignore | 29 + polyglot/README.md | 277 ++ polyglot/build-libdynamicds.sh | 44 + polyglot/compose.yaml | 132 + polyglot/dynamic-datasource-ffi/pom.xml | 111 + .../samples/ffi/DataSourceConfig.java | 135 + .../samples/ffi/DynamicDataSourceFacade.java | 305 ++ .../com/baomidou/samples/ffi/ErrorCode.java | 38 + .../baomidou/samples/ffi/FacadeException.java | 31 + .../java/com/baomidou/samples/ffi/Json.java | 45 + .../samples/ffi/NativeEntryPoints.java | 130 + .../samples/ffi/StatementExecutor.java | 143 + .../samples/ffi/TransactionSessions.java | 205 ++ .../AbstractDynamicDataSourceFacadeTest.java | 327 +++ .../samples/ffi/DataSourceConfigTest.java | 80 + .../ffi/H2DynamicDataSourceFacadeTest.java | 44 + ...PostgreSqlDynamicDataSourceFacadeTest.java | 74 + .../src/test/resources/config/h2.json | 65 + .../src/test/resources/config/postgresql.json | 65 + .../test/resources/db/order/data-account.sql | 18 + .../test/resources/db/order/data-product.sql | 18 + .../resources/db/order/schema-account.sql | 24 + .../test/resources/db/order/schema-order.sql | 27 + .../resources/db/order/schema-product.sql | 25 + .../db/postgresql/init-databases.sql | 25 + .../test/resources/db/user/data-master.sql | 18 + .../test/resources/db/user/data-slave_1.sql | 18 + .../test/resources/db/user/data-slave_2.sql | 18 + .../src/test/resources/db/user/schema.sql | 24 + .../test/resources/simplelogger.properties | 20 + polyglot/pom.xml | 174 ++ .../python-fastapi-sample/.python-version | 17 + .../python-fastapi-sample/app/__init__.py | 16 + polyglot/python-fastapi-sample/app/config.py | 43 + .../python-fastapi-sample/app/database.py | 30 + .../app/dynamic_datasource.py | 204 ++ polyglot/python-fastapi-sample/app/errors.py | 53 + polyglot/python-fastapi-sample/app/main.py | 61 + .../app/routers/__init__.py | 16 + .../app/routers/accounts.py | 47 + .../app/routers/datasources.py | 65 + .../app/routers/orders.py | 113 + .../app/routers/products.py | 50 + .../app/routers/users.py | 53 + polyglot/python-fastapi-sample/config/h2.json | 65 + .../config/postgresql.json | 65 + .../db/order/data-account.sql | 18 + .../db/order/data-product.sql | 18 + .../db/order/schema-account.sql | 24 + .../db/order/schema-order.sql | 27 + .../db/order/schema-product.sql | 25 + .../db/postgresql/init-databases.sql | 25 + .../db/user/data-master.sql | 18 + .../db/user/data-slave_1.sql | 18 + .../db/user/data-slave_2.sql | 18 + .../python-fastapi-sample/db/user/schema.sql | 24 + polyglot/python-fastapi-sample/hatch_build.py | 37 + polyglot/python-fastapi-sample/pyproject.toml | 68 + .../python-fastapi-sample/tests/test_api.py | 150 + polyglot/python-fastapi-sample/uv.lock | 781 +++++ polyglot/rust-axum-sample/Cargo.lock | 2431 ++++++++++++++++ polyglot/rust-axum-sample/Cargo.toml | 34 + polyglot/rust-axum-sample/build.rs | 73 + polyglot/rust-axum-sample/config/h2.json | 65 + .../rust-axum-sample/config/postgresql.json | 65 + .../db/order/data-account.sql | 18 + .../db/order/data-product.sql | 18 + .../db/order/schema-account.sql | 24 + .../db/order/schema-order.sql | 27 + .../db/order/schema-product.sql | 25 + .../db/postgresql/init-databases.sql | 25 + .../rust-axum-sample/db/user/data-master.sql | 18 + .../rust-axum-sample/db/user/data-slave_1.sql | 18 + .../rust-axum-sample/db/user/data-slave_2.sql | 18 + polyglot/rust-axum-sample/db/user/schema.sql | 24 + polyglot/rust-axum-sample/src/config.rs | 39 + .../src/dynamic_datasource.rs | 262 ++ polyglot/rust-axum-sample/src/error.rs | 72 + polyglot/rust-axum-sample/src/lib.rs | 22 + polyglot/rust-axum-sample/src/main.rs | 53 + polyglot/rust-axum-sample/src/routes.rs | 47 + .../rust-axum-sample/src/routes/accounts.rs | 80 + .../src/routes/datasources.rs | 72 + .../rust-axum-sample/src/routes/orders.rs | 161 ++ .../rust-axum-sample/src/routes/products.rs | 80 + polyglot/rust-axum-sample/src/routes/users.rs | 98 + polyglot/rust-axum-sample/tests/api.rs | 248 ++ .../typescript-hono-sample/.prettierignore | 17 + .../typescript-hono-sample/config/h2.json | 65 + .../config/postgresql.json | 65 + .../db/order/data-account.sql | 18 + .../db/order/data-product.sql | 18 + .../db/order/schema-account.sql | 24 + .../db/order/schema-order.sql | 27 + .../db/order/schema-product.sql | 25 + .../db/postgresql/init-databases.sql | 25 + .../db/user/data-master.sql | 18 + .../db/user/data-slave_1.sql | 18 + .../db/user/data-slave_2.sql | 18 + .../typescript-hono-sample/db/user/schema.sql | 24 + .../typescript-hono-sample/package-lock.json | 2534 +++++++++++++++++ polyglot/typescript-hono-sample/package.json | 35 + .../scripts/build-libdynamicds.ts | 26 + polyglot/typescript-hono-sample/src/app.ts | 39 + polyglot/typescript-hono-sample/src/config.ts | 37 + .../src/dynamic-datasource.ts | 248 ++ polyglot/typescript-hono-sample/src/errors.ts | 63 + polyglot/typescript-hono-sample/src/native.ts | 81 + .../src/routes/accounts.ts | 58 + .../src/routes/datasources.ts | 54 + .../src/routes/orders.ts | 113 + .../src/routes/products.ts | 63 + .../src/routes/users.ts | 51 + polyglot/typescript-hono-sample/src/server.ts | 31 + polyglot/typescript-hono-sample/src/worker.ts | 45 + .../typescript-hono-sample/test/api.test.ts | 170 ++ polyglot/typescript-hono-sample/tsconfig.json | 15 + pom.xml | 25 + 129 files changed, 13527 insertions(+), 19 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer-lock.json create mode 100644 .devcontainer/devcontainer.json create mode 100644 config/license/header-styles.xml create mode 100644 polyglot/Dockerfile create mode 100644 polyglot/Dockerfile.dockerignore create mode 100644 polyglot/README.md create mode 100755 polyglot/build-libdynamicds.sh create mode 100644 polyglot/compose.yaml create mode 100644 polyglot/dynamic-datasource-ffi/pom.xml create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DataSourceConfig.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DynamicDataSourceFacade.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/ErrorCode.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/FacadeException.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/Json.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/NativeEntryPoints.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/StatementExecutor.java create mode 100644 polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/TransactionSessions.java create mode 100644 polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/AbstractDynamicDataSourceFacadeTest.java create mode 100644 polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/DataSourceConfigTest.java create mode 100644 polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/H2DynamicDataSourceFacadeTest.java create mode 100644 polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/PostgreSqlDynamicDataSourceFacadeTest.java create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/config/h2.json create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/config/postgresql.json create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-account.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-product.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-account.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-order.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-product.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/postgresql/init-databases.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-master.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_1.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_2.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/db/user/schema.sql create mode 100644 polyglot/dynamic-datasource-ffi/src/test/resources/simplelogger.properties create mode 100644 polyglot/pom.xml create mode 100644 polyglot/python-fastapi-sample/.python-version create mode 100644 polyglot/python-fastapi-sample/app/__init__.py create mode 100644 polyglot/python-fastapi-sample/app/config.py create mode 100644 polyglot/python-fastapi-sample/app/database.py create mode 100644 polyglot/python-fastapi-sample/app/dynamic_datasource.py create mode 100644 polyglot/python-fastapi-sample/app/errors.py create mode 100644 polyglot/python-fastapi-sample/app/main.py create mode 100644 polyglot/python-fastapi-sample/app/routers/__init__.py create mode 100644 polyglot/python-fastapi-sample/app/routers/accounts.py create mode 100644 polyglot/python-fastapi-sample/app/routers/datasources.py create mode 100644 polyglot/python-fastapi-sample/app/routers/orders.py create mode 100644 polyglot/python-fastapi-sample/app/routers/products.py create mode 100644 polyglot/python-fastapi-sample/app/routers/users.py create mode 100644 polyglot/python-fastapi-sample/config/h2.json create mode 100644 polyglot/python-fastapi-sample/config/postgresql.json create mode 100644 polyglot/python-fastapi-sample/db/order/data-account.sql create mode 100644 polyglot/python-fastapi-sample/db/order/data-product.sql create mode 100644 polyglot/python-fastapi-sample/db/order/schema-account.sql create mode 100644 polyglot/python-fastapi-sample/db/order/schema-order.sql create mode 100644 polyglot/python-fastapi-sample/db/order/schema-product.sql create mode 100644 polyglot/python-fastapi-sample/db/postgresql/init-databases.sql create mode 100644 polyglot/python-fastapi-sample/db/user/data-master.sql create mode 100644 polyglot/python-fastapi-sample/db/user/data-slave_1.sql create mode 100644 polyglot/python-fastapi-sample/db/user/data-slave_2.sql create mode 100644 polyglot/python-fastapi-sample/db/user/schema.sql create mode 100644 polyglot/python-fastapi-sample/hatch_build.py create mode 100644 polyglot/python-fastapi-sample/pyproject.toml create mode 100644 polyglot/python-fastapi-sample/tests/test_api.py create mode 100644 polyglot/python-fastapi-sample/uv.lock create mode 100644 polyglot/rust-axum-sample/Cargo.lock create mode 100644 polyglot/rust-axum-sample/Cargo.toml create mode 100644 polyglot/rust-axum-sample/build.rs create mode 100644 polyglot/rust-axum-sample/config/h2.json create mode 100644 polyglot/rust-axum-sample/config/postgresql.json create mode 100644 polyglot/rust-axum-sample/db/order/data-account.sql create mode 100644 polyglot/rust-axum-sample/db/order/data-product.sql create mode 100644 polyglot/rust-axum-sample/db/order/schema-account.sql create mode 100644 polyglot/rust-axum-sample/db/order/schema-order.sql create mode 100644 polyglot/rust-axum-sample/db/order/schema-product.sql create mode 100644 polyglot/rust-axum-sample/db/postgresql/init-databases.sql create mode 100644 polyglot/rust-axum-sample/db/user/data-master.sql create mode 100644 polyglot/rust-axum-sample/db/user/data-slave_1.sql create mode 100644 polyglot/rust-axum-sample/db/user/data-slave_2.sql create mode 100644 polyglot/rust-axum-sample/db/user/schema.sql create mode 100644 polyglot/rust-axum-sample/src/config.rs create mode 100644 polyglot/rust-axum-sample/src/dynamic_datasource.rs create mode 100644 polyglot/rust-axum-sample/src/error.rs create mode 100644 polyglot/rust-axum-sample/src/lib.rs create mode 100644 polyglot/rust-axum-sample/src/main.rs create mode 100644 polyglot/rust-axum-sample/src/routes.rs create mode 100644 polyglot/rust-axum-sample/src/routes/accounts.rs create mode 100644 polyglot/rust-axum-sample/src/routes/datasources.rs create mode 100644 polyglot/rust-axum-sample/src/routes/orders.rs create mode 100644 polyglot/rust-axum-sample/src/routes/products.rs create mode 100644 polyglot/rust-axum-sample/src/routes/users.rs create mode 100644 polyglot/rust-axum-sample/tests/api.rs create mode 100644 polyglot/typescript-hono-sample/.prettierignore create mode 100644 polyglot/typescript-hono-sample/config/h2.json create mode 100644 polyglot/typescript-hono-sample/config/postgresql.json create mode 100644 polyglot/typescript-hono-sample/db/order/data-account.sql create mode 100644 polyglot/typescript-hono-sample/db/order/data-product.sql create mode 100644 polyglot/typescript-hono-sample/db/order/schema-account.sql create mode 100644 polyglot/typescript-hono-sample/db/order/schema-order.sql create mode 100644 polyglot/typescript-hono-sample/db/order/schema-product.sql create mode 100644 polyglot/typescript-hono-sample/db/postgresql/init-databases.sql create mode 100644 polyglot/typescript-hono-sample/db/user/data-master.sql create mode 100644 polyglot/typescript-hono-sample/db/user/data-slave_1.sql create mode 100644 polyglot/typescript-hono-sample/db/user/data-slave_2.sql create mode 100644 polyglot/typescript-hono-sample/db/user/schema.sql create mode 100644 polyglot/typescript-hono-sample/package-lock.json create mode 100644 polyglot/typescript-hono-sample/package.json create mode 100644 polyglot/typescript-hono-sample/scripts/build-libdynamicds.ts create mode 100644 polyglot/typescript-hono-sample/src/app.ts create mode 100644 polyglot/typescript-hono-sample/src/config.ts create mode 100644 polyglot/typescript-hono-sample/src/dynamic-datasource.ts create mode 100644 polyglot/typescript-hono-sample/src/errors.ts create mode 100644 polyglot/typescript-hono-sample/src/native.ts create mode 100644 polyglot/typescript-hono-sample/src/routes/accounts.ts create mode 100644 polyglot/typescript-hono-sample/src/routes/datasources.ts create mode 100644 polyglot/typescript-hono-sample/src/routes/orders.ts create mode 100644 polyglot/typescript-hono-sample/src/routes/products.ts create mode 100644 polyglot/typescript-hono-sample/src/routes/users.ts create mode 100644 polyglot/typescript-hono-sample/src/server.ts create mode 100644 polyglot/typescript-hono-sample/src/worker.ts create mode 100644 polyglot/typescript-hono-sample/test/api.test.ts create mode 100644 polyglot/typescript-hono-sample/tsconfig.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..99276cbe --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,30 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04 + +# native-image 链接 libdynamicds 时需要 gcc 与 zlib 的头文件 +RUN apt-get update \ + && apt-get install -y --no-install-recommends build-essential zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# 与 polyglot/Dockerfile 相同的 uv;Python 由 uv 按各项目的 .python-version 下载 +COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /uvx /usr/local/bin/ + +# uv 的虚拟环境放在工作区之外(见 devcontainer.json 的 UV_PROJECT_ENVIRONMENT):虚拟环境里的 python +# 是指向解释器安装路径的符号链接,容器与宿主机共用工作区里的 .venv 时,一方创建的另一方用不了。 +# 目录对所有用户可写,因为 remoteUser 可能是 root,也可能是 uid 被改成与宿主机一致的 vscode。 +RUN install -d -m 1777 /opt/venvs diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 00000000..1b36eca4 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,24 @@ +{ + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:4": { + "version": "4.1.3", + "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:fae40f3c8be5a7c3b0db344c1d30341bc2c91ba38d1d5b14cd2ad72e6d65d084", + "integrity": "sha256:fae40f3c8be5a7c3b0db344c1d30341bc2c91ba38d1d5b14cd2ad72e6d65d084" + }, + "ghcr.io/devcontainers/features/java:1": { + "version": "1.8.3", + "resolved": "ghcr.io/devcontainers/features/java@sha256:61a839211feda1e2a1f10646648a948e733e4d98d770f3a4b6698a3c5fc92abe", + "integrity": "sha256:61a839211feda1e2a1f10646648a948e733e4d98d770f3a4b6698a3c5fc92abe" + }, + "ghcr.io/devcontainers/features/node:2": { + "version": "2.1.1", + "resolved": "ghcr.io/devcontainers/features/node@sha256:2a19d3b0b3879437637cfd292eb29fee0afcfbe6364e33db9afc4f80c5c1f956", + "integrity": "sha256:2a19d3b0b3879437637cfd292eb29fee0afcfbe6364e33db9afc4f80c5c1f956" + }, + "ghcr.io/devcontainers/features/rust:1": { + "version": "1.6.0", + "resolved": "ghcr.io/devcontainers/features/rust@sha256:846c949f52c9dea98d4f90a11957cbf152fb3f6e8a70ddd7cb83014a7d1d0c98", + "integrity": "sha256:846c949f52c9dea98d4f90a11957cbf152fb3f6e8a70ddd7cb83014a7d1d0c98" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..3c04bf69 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +{ + "name": "dynamic-datasource-samples", + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "25", + "jdkDistro": "graalce" + }, + "ghcr.io/devcontainers/features/rust:1": { + "version": "1.99" + }, + "ghcr.io/devcontainers/features/node:2": { + "version": "26" + }, + "ghcr.io/devcontainers/features/docker-in-docker:4": {} + }, + "remoteUser": "${localEnv:DEVCONTAINER_USER:vscode}", + "containerEnv": { + "UV_PROJECT_ENVIRONMENT": "/opt/venvs/python-fastapi-sample" + }, + "forwardPorts": [8081, 8082, 8083], + "customizations": { + "vscode": { + "settings": { + "python.defaultInterpreterPath": "/opt/venvs/python-fastapi-sample/bin/python" + }, + "extensions": [ + "ms-python.python", + "charliermarsh.ruff", + "esbenp.prettier-vscode" + ] + } + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88d4a122..0aa7669a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,7 @@ jobs: java-version: ${{ matrix.java-version }} cache: 'maven' - name: Build all test with Maven - run: | - ./mvnw -T1C -e clean test + run: ./mvnw -T1C -e clean test test-minimum-hotspot-jdk-ci: if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' name: Test CI - JDK ${{ matrix.java-version }} on ${{ matrix.os }} @@ -45,8 +44,7 @@ jobs: java-version: ${{ matrix.java-version }} cache: 'maven' - name: Build spring-boot-2 samples with Maven - run: | - ./mvnw -am -pl spring-boot-2/shardingsphere-jdbc-4.x-spring-sample,spring-boot-2/shardingsphere-jdbc-5.x-spring-sample -T1C -B -e clean test + run: ./mvnw -am -pl spring-boot-2/shardingsphere-jdbc-4.x-spring-sample,spring-boot-2/shardingsphere-jdbc-5.x-spring-sample -T1C -B -e clean test test-native-ci: if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' name: Native Test CI - GraalVM ${{ matrix.module }} on ubuntu-latest @@ -89,8 +87,121 @@ jobs: # 并要求 Seata Server 可达,且其应用上下文在 AOT 类型预判定阶段存在 null Advisor # 问题,故暂不纳入。 - name: Native test with Maven + run: ./mvnw -B -e -PnativeTest clean test -pl "${{ matrix.module }}" + # polyglot/:三个 web 示例通过各自语言的 FFI 调用 dynamic-datasource 的 GraalVM native 共享库 libdynamicds.so。 + # 与本地开发一样,各示例的构建(build.rs、hatch_build.py、npm 的 pretest)会先用 GraalVM 构建共享库; + # 测试先用 H2,再用各自语言的 Testcontainers 启动 PostgreSQL。dynamic-datasource-ffi 的 JVM 单测已由 Test CI 覆盖, + # 格式检查与 lint 在 Lint & Format CI 中完成。 + polyglot-rust-ci: + if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' + name: Polyglot CI - rust-axum-sample + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + DD_LOG_LEVEL: warn + defaults: + run: + working-directory: polyglot/rust-axum-sample + steps: + - uses: actions/checkout@v7 + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: '25.3.4.1' + distribution: 'graalvm-community' + cache: 'maven' + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + workspaces: polyglot/rust-axum-sample + - name: Test with H2 and PostgreSQL + run: cargo test --locked + polyglot-python-ci: + if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' + name: Polyglot CI - python-fastapi-sample + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + DD_LOG_LEVEL: warn + defaults: + run: + working-directory: polyglot/python-fastapi-sample + steps: + - uses: actions/checkout@v7 + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: '25.3.4.1' + distribution: 'graalvm-community' + cache: 'maven' + # setup-uv 从 v8 起不再发布 v8、v9 这样的浮动大版本 tag,只能写完整版本号 + - name: Setup uv + uses: astral-sh/setup-uv@v10.3.0 + with: + enable-cache: true + cache-dependency-glob: polyglot/python-fastapi-sample/uv.lock + - name: Test with H2 and PostgreSQL + run: uv run --locked pytest -q + polyglot-typescript-ci: + if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' + name: Polyglot CI - typescript-hono-sample + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + DD_LOG_LEVEL: warn + defaults: + run: + working-directory: polyglot/typescript-hono-sample + steps: + - uses: actions/checkout@v7 + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: '25.3.4.1' + distribution: 'graalvm-community' + cache: 'maven' + # node:ffi 从 Node.js 26.9 起默认开启 + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: '26' + cache: 'npm' + cache-dependency-path: polyglot/typescript-hono-sample/package-lock.json + - name: Test with H2 and PostgreSQL run: | - ./mvnw -B -e -PnativeTest clean test -pl "${{ matrix.module }}" + npm ci --no-audit --no-fund + npm test + # .devcontainer/:给本机没有 GraalVM、Rust、uv、Node.js 的贡献者用的开发容器。 + # 在容器里执行 CONTRIBUTING.md 为 polyglot/ 写的验证命令,确保容器能构建,文档里的验证方式在容器里确实可用。 + # 容器自带 Docker 引擎(docker-in-docker),Testcontainers 用的是它,而不是 runner 的 Docker。 + # 用默认的 vscode 用户:action 会把它的 uid 改成与 runner 用户一致,rootless Docker 才需要 DEVCONTAINER_USER=root。 + devcontainer-ci: + if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' + name: Dev Container CI + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v7 + - name: Verify in Dev Container + uses: devcontainers/ci@v0.3 + with: + # push 的默认值是 filter,没有 imageName 时 push 事件上会报 imageName is required;不推送镜像就写 never + push: never + # runCmd 用 `bash -c` 执行,不带 -e,需要自己 set -e + runCmd: | + set -ex + export DD_LOG_LEVEL=warn + java -version + native-image --version + rustc --version + uv --version + node --version + docker version + ./mvnw -B -e -pl polyglot/dynamic-datasource-ffi test + (cd polyglot/rust-axum-sample && cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test) + (cd polyglot/python-fastapi-sample && uv run ruff format --check . && uv run ruff check . && uv run pytest) + (cd polyglot/typescript-hono-sample && npm ci && npm run format:check && npm run typecheck && npm test) lint-format-ci: if: github.repository == 'dynamic-datasource/dynamic-datasource-samples' name: Lint & Format CI @@ -102,12 +213,50 @@ jobs: uses: actions/setup-java@v6 with: distribution: 'temurin' - # Checkstyle 14 与 google-java-format 1.30+ 都要求 JDK 21+。 - java-version: '21' + # Checkstyle 14 与 google-java-format 1.30+ 都要求 JDK 21+;polyglot/ 只在 JDK 25+ 上参与构建, + # 用 25 才能把它也检查到。 + java-version: '25' cache: 'maven' - name: Check format with Spotless run: ./mvnw -B -e spotless:check + # 同时检查 polyglot/ 下除 JSON、Markdown、lock 文件外所有文件的 license 头(见 polyglot/pom.xml) - name: Check license header with License Maven Plugin run: ./mvnw -B -e license:check - name: Check lint with Checkstyle run: ./mvnw -B -e checkstyle:check + # polyglot/ 的三个语言示例:格式检查与 lint 都用不到 libdynamicds(cargo clippy 只做检查,不链接), + # 这里也没有 GraalVM,各示例的构建只打印警告,不会构建共享库 + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + - uses: Swatinem/rust-cache@v2 + with: + workspaces: polyglot/rust-axum-sample + - name: Check format and lint of rust-axum-sample + working-directory: polyglot/rust-axum-sample + run: | + cargo fmt --check + cargo clippy --all-targets --locked -- -D warnings + - name: Setup uv + uses: astral-sh/setup-uv@v10.3.0 + with: + enable-cache: true + cache-dependency-glob: polyglot/python-fastapi-sample/uv.lock + - name: Check format and lint of python-fastapi-sample + working-directory: polyglot/python-fastapi-sample + run: | + uv run --locked ruff format --check . + uv run --locked ruff check . + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: '26' + cache: 'npm' + cache-dependency-path: polyglot/typescript-hono-sample/package-lock.json + - name: Check format and types of typescript-hono-sample + working-directory: polyglot/typescript-hono-sample + run: | + npm ci --no-audit --no-fund + npm run format:check + npm run typecheck diff --git a/.gitignore b/.gitignore index 1ca1599b..376f312d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,12 @@ target /nbdist/ /.nb-gradle/ +### polyglot/ 的 Python 与 Node.js 示例(Rust 的产物在 target 下,已在上面忽略) ### +.venv/ +__pycache__/ +.pytest_cache/ +.ruff_cache/ +node_modules/ + ### We don't want to check in any binaries in Git ### **/.mvn/wrapper/maven-wrapper.jar \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4d396c29..d476ff02 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,8 @@ 我们鼓励通过 `version-fox/vfox` 切换到 `25.3.4.1-graalce` 来验证。 针对 `JetBrains/intellij-community` 等 IDE,`spring-boot-2` 下模块的语言级别应设置为 JDK 8, -`spring-boot-3` 与 `spring-boot-4` 下模块的语言级别应设置为 JDK 17。 下文讨论不同情况下可能的测试流程, +`spring-boot-3` 与 `spring-boot-4` 下模块的语言级别应设置为 JDK 17,`polyglot/dynamic-datasource-ffi` 应设置为 JDK 25。 +下文讨论不同情况下可能的测试流程, ## Ubuntu 26.04 @@ -35,6 +36,32 @@ cd ./dynamic-datasource-samples/ ./mvnw -T1C -e clean test ``` +## Dev Container + +本机没有 GraalVM、Rust、uv 或 Node.js 时,可以使用 [`.devcontainer/`](./.devcontainer/devcontainer.json) 描述的开发容器。 +它基于 Ubuntu 24.04,装有 GraalVM CE 25(含 `native-image`)、Rust(含 rustfmt 与 clippy)、uv 与 Node.js 26, +另有一个容器内独立的 Docker 引擎,Testcontainers 直接使用它,不需要设置 `DOCKER_HOST`。本机只需要 Docker,再任选一种方式打开, + +- VS Code:安装 Dev Containers 扩展后执行 `Dev Containers: Reopen in Container` +- IntelliJ IDEA:打开 `.devcontainer/devcontainer.json`,点击左侧 gutter 中的图标,选择 `Create Dev Container and Mount Sources…` +- GitHub Codespaces:在仓库页面的 `Code` → `Codespaces` 中创建 +- 命令行:使用 `@devcontainers/cli`, + + ```shell + npx @devcontainers/cli up --workspace-folder . + npx @devcontainers/cli exec --workspace-folder . ./mvnw -T1C -e clean test + ``` + +第一次创建容器要下载各个工具链,需要几分钟。进入容器后,上面的 `./mvnw -T1C -e clean test` 与下文 `polyglot/` 示例的命令 +都可以直接执行。容器里 uv 的虚拟环境在 `/opt/venvs/` 下,与本机在工作区里创建的 `.venv` 互不影响。 +CI 的 `Dev Container CI` 任务会在这个容器里执行 `polyglot/` 的验证命令,修改 `.devcontainer/` 后可以靠它确认容器仍然可用。 + +宿主机使用 rootless Docker 时,容器里默认的 `vscode` 用户没有工作区的写权限,需要先在启动 IDE 或 devcontainer CLI 的环境里 +`export DEVCONTAINER_USER=root`。rootless Docker 下容器里的 root 对应宿主机的当前用户,新建的文件仍然归当前用户所有。 + +`devcontainer.json` 里不写注释,需要说明的配置记在这里:`extensions` 只列了 Python、Ruff 与 Prettier, +Java、Rust、Node.js 与 Docker 的 VS Code 扩展由对应的 Feature 一并安装。 + ## 单元测试说明 - 纯 H2 的模块(`mybatisplus3-sample`、`beetlsql-sample`、`jdbc-template-sample`、`name-pattern-sample`、 @@ -64,9 +91,40 @@ cd ./dynamic-datasource-samples/ native image 的构建与测试、Native Test CI 的模块矩阵、Reachability Metadata 写法与上游 issue 跟进见 [docs/graalvm-native-image.md](./docs/graalvm-native-image.md)。 +## Rust / TypeScript / Python 示例(`polyglot/`) + +`polyglot/dynamic-datasource-ffi` 是普通的 Maven 模块,按 Java 25 编译。根 pom 的 `polyglot` profile 按 JDK 版本自动激活: +在 JDK 25+ 上执行上面的 `./mvnw -T1C -e clean test` 会包含它的 JVM 单测(H2 与 Testcontainers 的 PostgreSQL), +JDK 17、21 上则跳过整个 `polyglot/`;Lint & Format 也因此在 JDK 25 上执行。三个语言示例另有各自的工具链:CI 的 +`Lint & Format CI` 检查它们的 license 头、格式与 lint;`Polyglot CI` 的三个 job 与本地一样,由各示例的构建先用 +GraalVM 构建共享库(见 `polyglot/build-libdynamicds.sh`),再跑集成测试(先用 H2,再用各自语言的 Testcontainers +启动的 PostgreSQL)。本地验证二选一: + +- 本机装有 GraalVM 25、Docker 与对应语言的工具链(Rust 1.88+、uv、Node.js 26.9+),或者在上文的 Dev Container 里时, + 在仓库根目录执行;共享库会在第一次构建时自动构建,之后只在 Java 源码或 pom 变化时重新构建(rootless Docker 下, + Rust 与 Python 的测试还需要 `export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock`): + + ```shell + (cd polyglot/rust-axum-sample && cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test) + (cd polyglot/python-fastapi-sample && uv run ruff format --check . && uv run ruff check . && uv run pytest) + (cd polyglot/typescript-hono-sample && npm ci && npm run format:check && npm run typecheck && npm test) + ``` + +- 只有 Docker 时,下面的命令在镜像构建时做格式检查与 lint,再在容器里跑同样的测试 + (rootless Docker 要加上 `DOCKER_SOCKET=$XDG_RUNTIME_DIR/docker.sock`): + + ```shell + docker compose -f polyglot/compose.yaml run --build --rm rust-test + docker compose -f polyglot/compose.yaml run --build --rm python-test + docker compose -f polyglot/compose.yaml run --build --rm typescript-test + ``` + +修改 HTTP 接口时三个示例要同步修改,并保持 [polyglot/README.md](./polyglot/README.md) 中的约定一致。 +数据源配置与 SQL 脚本在三个示例与 `dynamic-datasource-ffi/src/test/resources` 下各有一份,想让改动对所有示例生效时要逐份修改。 + ## 代码风格(Lint & Format) -CI 的 `Lint & Format CI` 任务在 JDK 21 下执行格式与静态检查,本地提交前请在**仓库根目录**执行: +CI 的 `Lint & Format CI` 任务在 JDK 25 下执行格式与静态检查,本地提交前请在**仓库根目录**执行: ```shell # 格式化 Java 代码 @@ -75,6 +133,9 @@ CI 的 `Lint & Format CI` 任务在 JDK 21 下执行格式与静态检查,本 ./mvnw spotless:check # 静态检查 ./mvnw checkstyle:check +# 补齐 / 校验 license 头(Java 源码,以及 .devcontainer/、config/license/、polyglot/ 下除 JSON、Markdown、lock 文件外的所有文件) +./mvnw license:format +./mvnw license:check ``` - 格式化使用 [Spotless](https://github.com/diffplug/spotless) + `google-java-format` 的 AOSP 风格(4 空格缩进), @@ -82,8 +143,8 @@ CI 的 `Lint & Format CI` 任务在 JDK 21 下执行格式与静态检查,本 - 静态检查使用 [Checkstyle](https://checkstyle.org/) 的 `google_checks.xml`。 与格式化冲突(缩进、导入顺序等)或示例项目不适用的规则在 [`config/checkstyle/suppressions.xml`](./config/checkstyle/suppressions.xml) 中有意抑制, 新增抑制项请附带原因注释。 -- 两个工具都要求 JDK 21+ 运行(`google-java-format` 1.30+ 与 Checkstyle 14 的要求), - 其余构建(如 JDK 8/17 下的 `clean test`)不受影响。 +- 两个工具都要求 JDK 21+ 运行(`google-java-format` 1.30+ 与 Checkstyle 14 的要求),在 JDK 25+ 上运行才会检查到 + `polyglot/`;其余构建(如 JDK 8/17 下的 `clean test`)不受影响。 ## 已发布构件的验收(`Verify released artifact`) diff --git a/README.md b/README.md index 1309a437..665aa8e4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ - `spring-boot-3`(`springboot3-sample`)与 `spring-boot-4` 下的子模块分别运行在 Spring Boot 3.5.x / 4.1.x, 需要在 [OpenJDK 17, OpenJDK 27] 的 JDK 范围及其下游发行版下执行单元测试 +另有 `polyglot` 文件夹,存放在 Rust / TypeScript / Python 的 web 项目中使用 dynamic-datasource 的示例。 +其中的 Java 模块为 GraalVM 25 的 native image 而写,按 Java 25 编译,只在 [OpenJDK 25, OpenJDK 27] 的 JDK 范围下参与构建。 + 所有单元测试与代码风格检查(Lint & Format)在 Github Actions 完成验证。你可能希望参考 [位于 Github Actions 的 CI 文件](./.github/workflows/ci.yml)。 ## Spring Boot 4(`spring-boot-4/`) @@ -40,6 +43,17 @@ - shardingsphere-jdbc-5.x-spring-sample:集成 ShardingSphere JDBC Spring Boot Starter 5.2.1 使用示例,不再维护, 参考 https://github.com/apache/shardingsphere/issues/22469 +## Rust / TypeScript / Python(`polyglot/`) + +dynamic-datasource 被构建成 GraalVM native 共享库,三个 web 示例通过各自语言的 FFI 在进程内调用它,运行时不需要 JVM。 +数据源路由与分组负载均衡、按请求头切换、动态增删数据源、多数据源本地事务分别对应上面的 jdbc-template-sample、 +spel-sample、add-remove-datasource-sample 与 tx-local-sample,H2 与 PostgreSQL 都可以运行。构建、运行、C ABI 与 +线程模型见 [模块 README](./polyglot/README.md): + +- rust-axum-sample:在 Rust + axum 中使用的示例 +- python-fastapi-sample:在 Python + FastAPI 中使用的示例 +- typescript-hono-sample:在 TypeScript + Hono 中使用的示例(Node.js 26.9+ 内置的 `node:ffi`) + # Contributing 我们欢迎社区的贡献,详情请见 [CONTRIBUTING.md](./CONTRIBUTING.md)。 diff --git a/config/license/header-styles.xml b/config/license/header-styles.xml new file mode 100644 index 00000000..534a7ae6 --- /dev/null +++ b/config/license/header-styles.xml @@ -0,0 +1,33 @@ + + + + + + # + # + #EOL + ^#\s*(syntax|escape|check)\s*=.*$ + #.*$ + #.*$ + false + false + false + + diff --git a/docs/graalvm-native-image.md b/docs/graalvm-native-image.md index 47fdcd57..e1c9bb22 100644 --- a/docs/graalvm-native-image.md +++ b/docs/graalvm-native-image.md @@ -29,14 +29,19 @@ AOT 值序列化不支持)与 `tx-seata-sample`(Seata AOT 期要求 Server `RuntimeHintsRegistrar`;只有 AOT 扫描结果驱动的逻辑才留在 Java 中 (如 MyBatis 模板的 `MyBatisBeanFactoryInitializationAotProcessor`): -```text -src/main/resources/META-INF/native-image/ -├── com.baomidou// # 样例自身的资源与类(不带版本号) -├── com.baomidou/dynamic-datasource-creator/4.6.0/ # dynamic-datasource -├── com.baomidou/mybatis-plus/3.5.17/ # MyBatis-Plus -├── org.mybatis/mybatis/3.5.19/ # MyBatis -├── org.mybatis/mybatis-spring/4.1.0/ # MyBatis-Spring -└── com.mysql/mysql-connector-j/9.7.0/ # 其它依赖 +```mermaid +%%{init: {"flowchart": {"wrappingWidth": 400}}}%% +flowchart LR + root["src/main/resources/META-INF/native-image/"] + root --> baomidou["com.baomidou/"] + root --> mybatis["org.mybatis/"] + root --> mysql["com.mysql/"] + baomidou --> sample["#lt;sample-artifact#gt;/
样例自身的资源与类,不带版本号"] + baomidou --> creator["dynamic-datasource-creator/4.6.0/"] + baomidou --> plus["mybatis-plus/3.5.17/"] + mybatis --> core["mybatis/3.5.19/"] + mybatis --> spring["mybatis-spring/4.1.0/"] + mysql --> connector["mysql-connector-j/9.7.0/
其它依赖同理"] ``` 两条硬规则:每个条目都带 `condition.typeReached`,键序为 `condition` → `type`/`glob` → @@ -88,6 +93,23 @@ src/main/resources/META-INF/native-image/ - 每个条目用 `reason`(字符串数组)记录用途,符合 reachability-metadata-schema-v1.2.0, 当前 GraalVM 构建报 Unknown attribute 警告但忽略之、实测无影响,见 quarkusio/quarkus#49660。 +## 共享库(`polyglot/dynamic-datasource-ffi`) + +`polyglot/dynamic-datasource-ffi` 不是 Spring Boot 应用,`native` profile 由 `polyglot/pom.xml` 单独定义: +`sharedLibrary` 构建 `libdynamicds.so`(native-image 的 shared 模式),另加 `-march=compatibility` 与 quick build; +没有 Spring AOT,也没有 `nativeTest`。Rust / Python / TypeScript 三个示例的构建经由 `polyglot/build-libdynamicds.sh` +按需构建共享库,再由它们的集成测试验证(CI 的 `Polyglot CI`)。 + +- C 入口集中在 `NativeEntryPoints`:isolate 与线程管理用 `@CEntryPoint(builtin = ...)` 重命名为 `dd_*`, + 业务函数统一为 `char* dd_xxx(graal_isolatethread_t*, const char*)`,参数加 `@CConst` 以生成 `const char*`。 +- 元数据只依赖 `dynamic-datasource-native-metadata`(boot4 starter 也以 runtime 范围传递依赖它)与 GRM 中 + HikariCP、H2、pgjdbc、Jackson 3 的条目,模块里没有手写的 `reachability-metadata.json`;JSON 只用 Jackson 的树模型, + 不需要为 POJO 登记反射。 +- 输出目录会多出 `libawt*.so`、`libfontmanager.so` 等 JDK 库:H2 jar 自带的 `reflect-config.json` 里以 + `org.h2.tools.Server` 为条件的 `java.awt.Desktop` 条目在加入 pgjdbc 后生效,把 AWT 拉进了可达性分析。 + 它们在运行时用不上,只需分发 `libdynamicds.so` 与头文件;用 `--exclude-config` 排除 H2 自带的配置可以去掉这些文件, + 但共享库只会小 2 MiB 左右,示例没有这样做。 + ## 上游 issue 跟进(TODO) 依赖上游修复的待办统一记录在 [upstream-todo.md](./upstream-todo.md),新增条目请写在那里。 diff --git a/docs/upstream-todo.md b/docs/upstream-todo.md index ca16e3f6..da831c37 100644 --- a/docs/upstream-todo.md +++ b/docs/upstream-todo.md @@ -68,6 +68,13 @@ 目前暂未提 issue(提到 GRM 会让机器人为 65 个未收录的传递依赖各开一个 issue,故暂缓)。 修复后精简 `shardingsphere-jdbc-5.x-core-sample` 的 `org.apache.shardingsphere` 目录并跑 nativeTest 验证;其中条件为 `YamlEngine` 等的 4 条可能已与自带元数据重复,届时一并验证。 +- TODO https://github.com/baomidou/dynamic-datasource/issues/821 :dynamic-datasource 的 Hikari、BeeCp、Dbcp2、 + C3p0、OracleUcp 五个 creator 用无参构造(`@NoArgsConstructor`)创建时全局配置为 null,`ConfigMergeCreator#create` + 合并配置时随即 NPE;JVM 下同样出现,与 native image 无关。修复后 `polyglot/dynamic-datasource-ffi` 的 + `DynamicDataSourceFacade` 可以改用无参构造,并同步删掉 `polyglot/README.md` 中的对应说明。 +- TODO Node.js 的 `node:ffi` 进入稳定(文档中的 Stability 2)后,去掉 `polyglot/typescript-hono-sample` 在 + `package.json` 与 `polyglot/Dockerfile` 里的 `--disable-warning=ExperimentalWarning`,并更新 `polyglot/README.md` + 中的说明。 - TODO BeetlSQL 的 native 问题(`sqlManager` 的 `MySqlStyle` 不支持 AOT 值序列化), 跟进地址 https://gitee.com/xiandafu/beetlsql/issues ,目前暂无已知 issue; 问题修复后把 `beetlsql-sample` 纳入 native CI,并用 nativeTest 复核其元数据。 diff --git a/polyglot/Dockerfile b/polyglot/Dockerfile new file mode 100644 index 00000000..25c552eb --- /dev/null +++ b/polyglot/Dockerfile @@ -0,0 +1,120 @@ +# syntax=docker/dockerfile:1 +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# 构建上下文是仓库根目录,例如 `docker build -f polyglot/Dockerfile --target rust-test .`。 +# +# - libdynamicds:用 GraalVM 构建共享库,三个示例共用这一阶段;示例镜像用 DYNAMIC_DATASOURCE_LIB_DIR(Rust)/ +# DYNAMIC_DATASOURCE_LIB(Python、TypeScript)指向它,各示例的构建因此不再自己构建共享库; +# - rust / python / typescript:运行镜像; +# - rust-test / python-test / typescript-test:构建时做格式检查、lint 与编译;测试用 Testcontainers 启动 PostgreSQL, +# 需要 Docker,所以在容器运行时执行(见 compose.yaml 的 test profile)。 + +FROM ghcr.io/graalvm/native-image-community:25i3-ol9 AS libdynamicds +WORKDIR /src +COPY mvnw pom.xml ./ +COPY .mvn/wrapper/maven-wrapper.properties .mvn/wrapper/ +COPY polyglot/pom.xml polyglot/ +COPY polyglot/dynamic-datasource-ffi polyglot/dynamic-datasource-ffi +# 只构建这一个模块:-f 指向它的 pom,父 pom 按 relativePath 解析,其余模块不参与 +RUN --mount=type=cache,target=/root/.m2 \ + ./mvnw -B -e -Pnative -DskipTests -f polyglot/dynamic-datasource-ffi/pom.xml package \ + && mkdir /out \ + && cp polyglot/dynamic-datasource-ffi/target/libdynamicds.so polyglot/dynamic-datasource-ffi/target/*.h /out/ + +# ---------------------------------------------------------------------------------------------------- Rust + +FROM rust:1.99-slim-trixie AS rust-build +# 官方镜像是 minimal profile,不带 rustfmt 与 clippy;下载偶尔失败,重试几次 +RUN for i in 1 2 3; do rustup component add rustfmt clippy && exit 0; sleep 5; done; exit 1 +COPY --from=libdynamicds /out/libdynamicds.so /usr/local/lib/ +ENV DYNAMIC_DATASOURCE_LIB_DIR=/usr/local/lib +WORKDIR /app/polyglot/rust-axum-sample +# 先只拉依赖:Cargo.toml、Cargo.lock 不变时这一层直接命中缓存,之后的构建与容器里的测试都不再联网 +COPY polyglot/rust-axum-sample/Cargo.toml polyglot/rust-axum-sample/Cargo.lock ./ +RUN mkdir src && touch src/lib.rs && cargo fetch --locked && rm -r src +ENV CARGO_NET_OFFLINE=true +COPY polyglot/rust-axum-sample ./ +RUN cargo build --release --locked && cp target/release/rust-axum-sample /usr/local/bin/ + +FROM rust-build AS rust-test +ENV DD_LOG_LEVEL=warn +RUN cargo fmt --check \ + && cargo clippy --all-targets --locked -- -D warnings \ + && cargo test --locked --no-run +CMD ["cargo", "test", "--locked"] + +FROM debian:trixie-slim AS rust +COPY --from=libdynamicds /out/libdynamicds.so /usr/local/lib/ +# 运行镜像里只有二进制:示例自带的 config/ 与 db/ 另外复制,再用 SAMPLE_DIR 指过去 +COPY polyglot/rust-axum-sample/config /app/config +COPY polyglot/rust-axum-sample/db /app/db +COPY --from=rust-build /usr/local/bin/rust-axum-sample /usr/local/bin/ +ENV SAMPLE_DIR=/app PORT=8081 +EXPOSE 8081 +USER nobody +CMD ["rust-axum-sample"] + +# ---------------------------------------------------------------------------------------------------- Python + +FROM python:3.14-slim-trixie AS python-base +COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /usr/local/bin/uv +COPY --from=libdynamicds /out/libdynamicds.so /usr/local/lib/ +ENV DYNAMIC_DATASOURCE_LIB=/usr/local/lib/libdynamicds.so \ + PYTHONUNBUFFERED=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=never +WORKDIR /app/polyglot/python-fastapi-sample +COPY polyglot/python-fastapi-sample/pyproject.toml polyglot/python-fastapi-sample/uv.lock polyglot/python-fastapi-sample/.python-version ./ + +FROM python-base AS python-test +# 只装依赖:测试经由 pythonpath 直接导入 app,本项目不必安装 +RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked --no-install-project +COPY polyglot/python-fastapi-sample ./ +# 环境已经就绪,之后的 uv run 不再同步,容器里跑测试时也不需要联网 +ENV DD_LOG_LEVEL=warn UV_NO_SYNC=1 +RUN uv run ruff format --check . && uv run ruff check . +CMD ["uv", "run", "pytest", "-q"] + +FROM python-base AS python +RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked --no-dev --no-install-project +COPY polyglot/python-fastapi-sample ./ +ENV PATH=/app/polyglot/python-fastapi-sample/.venv/bin:$PATH PORT=8082 +EXPOSE 8082 +USER nobody +CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port \"$PORT\""] + +# ---------------------------------------------------------------------------------------------------- TypeScript + +FROM node:26-trixie-slim AS typescript-base +COPY --from=libdynamicds /out/libdynamicds.so /usr/local/lib/ +ENV DYNAMIC_DATASOURCE_LIB=/usr/local/lib/libdynamicds.so +WORKDIR /app/polyglot/typescript-hono-sample +COPY polyglot/typescript-hono-sample/package.json polyglot/typescript-hono-sample/package-lock.json ./ + +FROM typescript-base AS typescript-test +RUN --mount=type=cache,target=/root/.npm npm ci --no-audit --no-fund +COPY polyglot/typescript-hono-sample ./ +ENV DD_LOG_LEVEL=warn +RUN npm run format:check && npm run typecheck +CMD ["npm", "test"] + +FROM typescript-base AS typescript +RUN --mount=type=cache,target=/root/.npm npm ci --omit=dev --no-audit --no-fund +COPY polyglot/typescript-hono-sample ./ +ENV PORT=8083 +EXPOSE 8083 +USER node +CMD ["node", "--disable-warning=ExperimentalWarning", "src/server.ts"] diff --git a/polyglot/Dockerfile.dockerignore b/polyglot/Dockerfile.dockerignore new file mode 100644 index 00000000..eadad3ca --- /dev/null +++ b/polyglot/Dockerfile.dockerignore @@ -0,0 +1,29 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# 构建上下文是仓库根目录(docker build -f polyglot/Dockerfile .),BuildKit 读取与 Dockerfile 同名的 ignore 文件。 +# 只放行构建 libdynamicds 与三个示例所需的文件。 +* +!mvnw +!pom.xml +!.mvn/wrapper/maven-wrapper.properties +!polyglot +polyglot/**/target +polyglot/**/node_modules +polyglot/**/.venv +polyglot/**/__pycache__ +polyglot/**/.pytest_cache +polyglot/**/.ruff_cache diff --git a/polyglot/README.md b/polyglot/README.md new file mode 100644 index 00000000..be8110f0 --- /dev/null +++ b/polyglot/README.md @@ -0,0 +1,277 @@ +# 在 Rust / TypeScript / Python 中使用 dynamic-datasource + +dynamic-datasource 只有 Java 实现。本目录把它构建成 GraalVM native 共享库 `libdynamicds.so`, +再由 Rust、Python、TypeScript 三个 web 示例通过各自语言的 FFI 在**同一进程内**调用: +数据源路由、分组负载均衡、动态增删数据源与多数据源本地事务都由 dynamic-datasource 完成,运行时不需要 JVM。 + +```mermaid +%%{init: {"flowchart": {"wrappingWidth": 400}}}%% +flowchart TB + subgraph process["axum / FastAPI / Hono 进程"] + handler["web handler"] --> binding["语言绑定(JSON 进 / JSON 出)"] + binding -- "dd_execute(isolate_thread, request_json)" --> routing + subgraph lib["libdynamicds.so(GraalVM isolate,无 JVM)"] + routing["DynamicRoutingDataSource"] --> hikari["HikariCP"] + hikari --> h2[("H2 内存库")] + end + end + hikari --> postgresql[("PostgreSQL")] +``` + +| 目录 | 说明 | +| --- | --- | +| `dynamic-datasource-ffi` | Java 门面与 C 入口,按 Java 25 编译;`-Pnative` 产出 `libdynamicds.so` 与 `libdynamicds.h` | +| `build-libdynamicds.sh` | 共享库不存在或比 Java 源码、pom 旧时用 GraalVM 构建它;三个示例的构建都调用它 | +| `rust-axum-sample` | Rust 1.88+、axum 0.8、tokio | +| `python-fastapi-sample` | Python 3.11+、FastAPI、ctypes,用 uv 管理 | +| `typescript-hono-sample` | Node.js 26.9+、Hono、内置的 `node:ffi` | +| `Dockerfile`、`compose.yaml` | 本机没有 GraalVM、Rust、Python 或 Node 时的构建、运行与测试方式 | + +每个示例的根目录下都有自己的 `config/` 与 `db/`,`dynamic-datasource-ffi` 的单测则放在 `src/test/resources/` 下: +`config/` 是两套数据源配置,`h2.json`(默认,H2 内存库)与 `postgresql.json`;`db/` 是建表与初始数据脚本, +H2 与 PostgreSQL 通用,另有 `db/postgresql/init-databases.sql` 为每个数据源建库。这几份内容目前相同,可以各自修改。 + +三个示例提供完全相同的 HTTP 接口与测试场景,与仓库里 Java 示例的对应关系: + +| 能力 | 对应的 Java 示例 | +| --- | --- | +| 多数据源 + 分组负载均衡(`slave` → `slave_1` / `slave_2`) | `jdbc-template-sample` 的 `@DS("slave")` | +| 按请求头切换数据源 | `spel-sample` 的 `@DS("#header.xxx")` | +| 运行时增删数据源 | `add-remove-datasource-sample` | +| 多数据源本地事务 | `tx-local-sample` 的 `@DSTransactional` | + +## 快速开始 + +### 用 Docker + +在仓库根目录执行,三个示例分别监听 8081(Rust)、8082(Python)、8083(TypeScript),各自连一个 PostgreSQL: + +```shell +docker compose -f polyglot/compose.yaml up --build +# 改用 H2 内存库 +DD_PROFILE=h2 docker compose -f polyglot/compose.yaml up --build +# 只跑测试:镜像构建时做格式检查、lint 与编译,容器运行时跑测试(见下文「测试与检查」)。 +# 测试容器经由宿主的 Docker 启动 PostgreSQL,rootless Docker 要加上 DOCKER_SOCKET=$XDG_RUNTIME_DIR/docker.sock +docker compose -f polyglot/compose.yaml run --build --rm rust-test +docker compose -f polyglot/compose.yaml run --build --rm python-test +docker compose -f polyglot/compose.yaml run --build --rm typescript-test +``` + +示例启动时都会按建表脚本重建表,所以每个示例独占一个 PostgreSQL;测试用的 PostgreSQL 由 Testcontainers 另行启动, +与运行中的服务互不影响。只想构建某一个镜像时,可以直接 +`docker build -f polyglot/Dockerfile --target .`。 + +### 在本机运行 + +需要 GraalVM 25(与 [CONTRIBUTING.md](../CONTRIBUTING.md) 一样推荐 `vfox use java@25.3.4.1-graalce`),并让 `JAVA_HOME` +或 `GRAALVM_HOME` 指向它。进入任意一个示例目录直接运行即可:示例的构建会先调用 `build-libdynamicds.sh`,把共享库构建到 +`dynamic-datasource-ffi/target/`(第一次需要几分钟),之后只在 Java 源码或 pom 变化时重新构建。 +本机没有 GraalVM 或各语言的工具链时,可以在仓库的 [Dev Container](../CONTRIBUTING.md#dev-container) 里执行下面的命令。 + +```shell +# Rust:build.rs 构建共享库,并把它所在的目录写进 rpath,不必设置 LD_LIBRARY_PATH +cd polyglot/rust-axum-sample && cargo run +# Python:uv 安装本项目时由 hatch_build.py 构建共享库 +cd polyglot/python-fastapi-sample && uv run uvicorn app.main:app --port 8082 +# TypeScript:npm 的 prestart / pretest 构建共享库;Node.js 直接运行 .ts,不需要编译 +cd polyglot/typescript-hono-sample && npm ci && npm start +``` + +已经有构建好的 `libdynamicds.so` 时,可以用 `DYNAMIC_DATASOURCE_LIB_DIR`(Rust)/ `DYNAMIC_DATASOURCE_LIB`(Python、 +TypeScript)指向它,示例的构建就不再构建共享库,也不需要 GraalVM。 + +服务默认连 H2。要连 PostgreSQL,先起一个用 `db/postgresql/init-databases.sql` 建好库的 PostgreSQL,再设置 +`DD_PROFILE=postgresql`: + +```shell +docker run -d --name dd-postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 \ + -v "$PWD/polyglot/rust-axum-sample/db/postgresql/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql:ro" \ + postgres:18.6-trixie +cd polyglot/rust-axum-sample && DD_PROFILE=postgresql cargo run +``` + +## 测试与检查 + +三个示例的集成测试是同一组场景(读写分离、分组负载均衡、strict 模式、运行时增删数据源、两种事务、并发请求), +各跑两遍:先用 H2,再用各自语言的 Testcontainers 启动 `postgres:18.6-trixie`,initdb 阶段执行 +`db/postgresql/init-databases.sql`,与 `dynamic-datasource-ffi` 的 JVM 单测一致。所以跑测试只需要 Docker, +不必事先准备数据库,也不看 `DD_PROFILE` 与 `POSTGRES_*`。 + +| 示例 | 测试 | 格式检查与 lint | +| --- | --- | --- | +| `rust-axum-sample` | `cargo test` | `cargo fmt --check`、`cargo clippy --all-targets -- -D warnings` | +| `python-fastapi-sample` | `uv run pytest` | `uv run ruff format --check .`、`uv run ruff check .` | +| `typescript-hono-sample` | `npm test` | `npm run format:check`、`npm run typecheck` | + +- rootless Docker 下,Node.js 的 Testcontainers 能自己找到 `$XDG_RUNTIME_DIR/docker.sock`,Rust 与 Python 的 + 需要先 `export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock`。 +- compose 的 test profile 在容器里跑测试:测试容器挂载宿主的 Docker socket,用 host 网络,并经由 + `TESTCONTAINERS_HOST_OVERRIDE=127.0.0.1` 访问 PostgreSQL 的映射端口。rootless Docker 下,容器里连 bridge 网关上的 + 映射端口时 TCP 握手能成功,但收不到数据,所以不能用网关地址。Rust 的 testcontainers 不认这个变量,由测试代码自己读取。 +- 本目录下的每个文件都带 license 头:源码、`Cargo.toml`、`pyproject.toml`、pom、Dockerfile、compose、SQL 脚本等, + 只有不能写注释的 JSON、Markdown 与工具生成的 lock 文件除外。在仓库根目录用 `./mvnw license:check` 检查、 + `./mvnw license:format` 补齐;新增一种插件不认识的文件类型时检查会直接失败,需要在 `pom.xml` 里登记它的注释风格。 +- CI 里,`Lint & Format CI` 做 license 头、格式检查与 lint,不需要 GraalVM 与共享库(`cargo clippy` 只做检查,不链接); + `Polyglot CI` 的三个 job 与本地一样,由各示例的构建先构建共享库,再跑测试。 + +## 代码结构 + +三个示例按各自框架推荐的方式拆分文件:FastAPI 见 +[Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/),Hono 见 +[Best Practices](https://hono.dev/docs/guides/best-practices#building-a-larger-application);axum 没有官方约定, +用的是 Rust 模块与文件一一对应的常见写法。这几个生态习惯按资源组织代码,而不是像 Java 那样按 controller / service / +mapper 分层(Hono 文档还明确不建议写 Rails 式的 Controller),所以资源相关的业务逻辑与它的路由放在同一个模块里, +例如扣库存的函数在 products 模块。 + +| 职责 | `rust-axum-sample/src` | `python-fastapi-sample/app` | `typescript-hono-sample/src` | Java 中的对应 | +| --- | --- | --- | --- | --- | +| 进程入口 | `main.rs` | `main.py` | `server.ts` | `LocalTxApplication` | +| 组装各资源的路由 | `routes.rs` | `main.py` 的 `create_app` | `app.ts` | 由 Spring 完成 | +| 配置 | `config.rs` | `config.py` | `config.ts` | `application.yml` | +| 错误响应 | `error.rs` | `errors.py` | `errors.ts` | tx-local-sample 的 `GlobalExceptionHandler` | +| `/users` | `routes/users.rs` | `routers/users.py` | `routes/users.ts` | jdbc-template-sample、spel-sample | +| `/datasources` | `routes/datasources.rs` | `routers/datasources.py` | `routes/datasources.ts` | add-remove-datasource-sample | +| `/orders` | `routes/orders.rs` | `routers/orders.py` | `routes/orders.ts` | `OrderController`、`OrderService` | +| `/products`、扣库存 | `routes/products.rs` | `routers/products.py` | `routes/products.ts` | `ProductService` | +| `/accounts`、扣余额 | `routes/accounts.rs` | `routers/accounts.py` | `routes/accounts.ts` | `AccountService` | +| libdynamicds 的封装 | `dynamic_datasource.rs` | `dynamic_datasource.py`,共用的实例在 `database.py` | `dynamic-datasource.ts`、`native.ts`、`worker.ts` | — | + +## HTTP 接口 + +字段名统一使用 snake_case。错误响应为 `{"code","message"}`,三个示例的状态码与 `code` 一致。 + +| 方法 | 路径 | 说明 | +| --- | --- | --- | +| GET | `/users` | 默认读 `slave` 组;请求头 `X-Datasource` 可指定任意数据源或分组;响应头 `X-Datasource-Served` 回显实际命中的数据源 | +| POST | `/users` | `{"name","age"}`,写 primary(`master`),返回自增 `id` | +| GET | `/datasources` | 当前的数据源与分组:`{"datasources":[...],"groups":{"slave":[...]}}` | +| POST | `/datasources` | `{"name","url","username","password","driver_class_name"}`;名称带下划线时自动入组(`slave_3` → `slave`),建表脚本由服务端指定 | +| DELETE | `/datasources/{name}` | 删除数据源并关闭它的连接池;primary 不能删除 | +| POST | `/orders` | `{"user_id","product_id","amount"}`,用会话式事务下单,流程与 `tx-local-sample` 逐行对应 | +| POST | `/orders/batch` | 同上,改用一次调用完成的批量事务 | +| GET | `/orders`、`/products/{id}`、`/accounts/{id}` | 查看订单、库存与余额 | + +| 状态码 | `code` | +| --- | --- | +| 400 | `BAD_REQUEST`(请求不合法,或删除 primary) | +| 404 | `DATASOURCE_NOT_FOUND`(strict 模式下找不到数据源)、`PRODUCT_NOT_FOUND`、`ACCOUNT_NOT_FOUND` | +| 409 | `INSUFFICIENT_STOCK`、`INSUFFICIENT_BALANCE`、`UPDATE_COUNT_MISMATCH`、`CONSTRAINT_VIOLATION` | +| 500 | 其他 | + +```shell +curl -i localhost:8081/users # X-Datasource-Served 在 slave_1 与 slave_2 之间轮换 +curl -i -H 'X-Datasource: master' localhost:8081/users +curl -H 'Content-Type: application/json' -d '{"name":"李四","age":20}' localhost:8081/users +# H2 下的连接信息;compose 的 PostgreSQL 变体里改成 jdbc:postgresql://rust-postgres:5432/ds_slave_3,用户名与密码都是 postgres +curl -H 'Content-Type: application/json' localhost:8081/datasources \ + -d '{"name":"slave_3","url":"jdbc:h2:mem:ds_slave_3;DB_CLOSE_DELAY=-1","username":"sa","password":"","driver_class_name":"org.h2.Driver"}' +curl -X DELETE localhost:8081/datasources/slave_3 +curl -H 'Content-Type: application/json' -d '{"user_id":1,"product_id":1,"amount":1}' localhost:8081/orders +curl -H 'Content-Type: application/json' -d '{"user_id":1,"product_id":1,"amount":6}' localhost:8081/orders/batch # 409 余额不足 +``` + +初始数据与 `tx-local-sample` 相同:商品单价 10、库存 20,账户余额 50。`master`、`slave_1`、`slave_2` 是三个独立的库, +各自的初始用户带上了库名,这样负载均衡在响应里看得见;真实环境中 slave 是 master 的只读副本。 + +## 数据源配置 + +示例自带的 `config/.json`(默认 `h2`)的字段与 `spring.datasource.dynamic.*` 同名(camelCase),由 `dd_open` 组装成 +`DynamicRoutingDataSource`,相当于 Spring Boot starter 的自动配置: + +| 字段 | 说明 | +| --- | --- | +| `primary`、`strict` | 同 `spring.datasource.dynamic.primary` / `strict`,默认 `master` / `false` | +| `strategy` | 分组的负载均衡策略:`loadbalance`(默认,轮询)或 `random` | +| `lazy` | 全局懒加载,同 `spring.datasource.dynamic.lazy` | +| `txIdleTimeoutSeconds` | 会话式事务的空闲超时,默认 30 | +| `datasource.` | `url`、`username`、`password`、`driverClassName`、`lazy`、`init.schema`、`init.data`、`init.continueOnError`,以及 `hikari.maxPoolSize` / `minIdle` / `connectionTimeout` | +| `variables` | 占位符的取值,由宿主程序在调用 `dd_open` 前填入 | + +字符串值里的 `${NAME}` / `${NAME:default}` 占位符依次取 `variables`、环境变量、默认值。三个示例都把 SQL 脚本目录放进 +`variables.DB_DIR`;`postgresql.json` 里的 `${POSTGRES_HOST:localhost}` 等在运行服务时来自环境变量,测试则把 +Testcontainers 给出的地址放进 `variables`。共享库内置 H2 与 PostgreSQL 驱动。 + +## libdynamicds 的 C ABI + +构建时生成的 `libdynamicds.h` 声明了下列函数。业务函数的签名统一为 +`char* dd_xxx(graal_isolatethread_t* thread, const char* request)`:请求与返回值都是 NUL 结尾的 UTF-8 JSON, +返回值必须交给 `dd_free` 释放。 + +| 函数 | 说明 | +| --- | --- | +| `dd_create_isolate()` | 创建 isolate,调用线程随之 attach;进程内只需调用一次 | +| `dd_get_isolate(thread)` | 取 isolate 句柄,交给其他线程 attach | +| `dd_attach_thread(isolate)` / `dd_detach_thread(thread)` | 当前 OS 线程 attach(幂等)/ 线程退出前 detach | +| `dd_open` / `dd_close` | 按上面的配置组装 `DynamicRoutingDataSource` / 回滚未结束的会话式事务并关闭所有连接池;关闭后可以再次打开 | +| `dd_execute` | `{"ds","sql","params","generatedKeys","expectUpdateCount"}` → `{"datasource","rows"}` 或 `{"datasource","updateCount","generatedKeys"}` | +| `dd_transaction` | `{"statements":[...]}`,一次调用内的本地事务,语义同 `@DSTransactional` | +| `dd_add_datasource` / `dd_remove_datasource` / `dd_list_datasources` | 对应 `DefaultDataSourceCreator#createDataSource` + `addDataSource`、`removeDataSource`;都返回当前的数据源与分组 | +| `dd_tx_begin` / `dd_tx_execute` / `dd_tx_commit` / `dd_tx_rollback` | 会话式事务,`dd_tx_execute` 的请求在 `dd_execute` 的基础上多一个 `txId` | +| `dd_free(thread, pointer)` | 释放业务函数返回的字符串 | + +- `ds` 省略时走 primary;`datasource` 是**实际命中**的数据源,对分组请求就是被负载均衡选中的成员。 +- `generatedKeys` 指定要返回的自增列;`expectUpdateCount` 与实际更新行数不符时报错(在事务里则整体回滚)。 +- 返回值统一为 `{"ok":true,"data":...}` 或 `{"ok":false,"error":{"code","type","message","sqlState"}}`, + 入口内捕获全部异常,绝不让 Java 异常穿过 C 边界。 + +| `error.code` | 含义 | +| --- | --- | +| `BAD_REQUEST` | 请求 JSON 不合法、缺少必填字段、占位符无法解析,或删除 primary | +| `NOT_OPEN` / `ALREADY_OPEN` | 还没有 `dd_open` / 重复 `dd_open` | +| `DATASOURCE_NOT_FOUND` | strict 模式下找不到数据源或分组 | +| `UPDATE_COUNT_MISMATCH` | `expectUpdateCount` 不满足 | +| `TRANSACTION_NOT_FOUND` | 会话式事务不存在、已结束或因空闲超时被回滚 | +| `CONSTRAINT_VIOLATION` | 违反数据库约束(SQLState 23xxx) | +| `SQL_ERROR` / `INTERNAL` | 其他 SQL 错误 / 其他错误 | + +## 线程模型 + +GraalVM 要求调用入口的 OS 线程已经 attach 到 isolate;dynamic-datasource 放在 ThreadLocal 里的状态 +(`DynamicDataSourceContextHolder`、本地事务)则天然按 attach 后的 Java 线程隔离。三个示例的约定相同: +启动时由一个线程创建 isolate 并 `dd_open`,之后每个工作线程第一次调用时 attach 一次并缓存。 + +| 语言 | 不阻塞事件循环的方式 | attach 缓存在 | detach | +| --- | --- | --- | --- | +| Rust | `tokio::task::spawn_blocking` | `thread_local!` | blocking 线程退出时由 TLS 析构完成 | +| Python | FastAPI 同步 `def` 路由在线程池执行,ctypes 调用期间释放 GIL | `threading.local` | 线程池线程常驻,不需要 | +| TypeScript | `node:ffi` 只有同步调用,所有调用交给固定大小的 `worker_threads` 池 | 每个 worker 启动时 attach | worker 退出前 | + +## 两种事务 + +- **会话式事务**(`POST /orders`):`dd_tx_begin` 之后可以跨多次调用执行语句,宿主程序在中途读库存、判断余额, + 与 `tx-local-sample` 的 service 代码逐行对应。三个示例都把它包装成 `transactional`(相当于 `@DSTransactional`: + 正常返回时提交,抛出异常时回滚)。宿主程序的调用可能落在不同线程上,所以 Java 侧为每个事务分配一个专用线程, + 空闲超过 `txIdleTimeoutSeconds` 的事务会被自动回滚,以免忘记收尾时一直占着连接。 +- **批量事务**(`POST /orders/batch`):一次 `dd_transaction` 调用执行一批语句,适合不需要在中途做判断的场景。 + 示例用 `CHECK (stock >= 0)`、`CHECK (balance >= 0)` 约束兜底库存与余额,按约束名还原成与会话式事务相同的错误码; + 单价作为扣库存语句的条件,配合 `expectUpdateCount` 实现乐观锁。 + +## 环境变量 + +| 变量 | 说明 | +| --- | --- | +| `DD_PROFILE` | 服务启动时选择 `config/.json`,默认 `h2`;测试不看它 | +| `DD_LOG_LEVEL` | Java 侧(slf4j-simple,输出到 stderr)的日志级别,默认 `info` | +| `POSTGRES_HOST` / `POSTGRES_PORT` / `POSTGRES_USER` / `POSTGRES_PASSWORD` | 服务的 PostgreSQL 变体的连接信息,默认 `localhost` / `5432` / `postgres` / `postgres`;测试改用 Testcontainers 给出的值 | +| `SAMPLE_DIR` | 示例自带的 `config/` 与 `db/` 所在的目录,默认是示例的根目录;Rust 的运行镜像里只有二进制,由 Dockerfile 设置 | +| `DYNAMIC_DATASOURCE_LIB_DIR`(Rust,构建时)/ `DYNAMIC_DATASOURCE_LIB`(Python、TypeScript) | 现成的共享库所在目录 / 共享库路径,设置后示例的构建不再构建共享库;默认构建并使用 `dynamic-datasource-ffi/target` 里的 | +| `PORT` | 监听端口,默认 8081 / 8082 / 8083 | + +## 实现要点与限制 + +- 脱离 Spring 容器手工组装 dynamic-datasource 时要注意两点(见 `DynamicDataSourceFacade`): + `HikariDataSourceCreator` 的无参构造会让全局 `HikariCpConfig` 为 null,`ConfigMergeCreator` 合并配置时随即 NPE, + 须传入 `new HikariCpConfig()`(JVM 下同样如此,与 native image 无关,见 + [baomidou/dynamic-datasource#821](https://github.com/baomidou/dynamic-datasource/issues/821));手工使用 + `TransactionalTemplate` 时 `TransactionalInfo.rollbackFor` 必须设成 `{Exception.class}`(`@DSTransactional` 的默认值), + 否则抛出异常后事务仍会提交。 +- native 元数据只依赖 dynamic-datasource 自带的 `dynamic-datasource-native-metadata` 与 GraalVM Reachability Metadata + Repository,模块里没有手写的 `reachability-metadata.json`。 +- 共享库约 56 MiB,运行时只依赖 glibc 2.34+ 与 libz;构建输出目录里还会出现 `libawt*.so`、`libfontmanager.so` 等 JDK 库, + 运行时用不上,只需分发 `libdynamicds.so` 与头文件(Dockerfile 的 libdynamicds 阶段只导出这两类文件)。 +- 构建参数带了 `-march=compatibility`,可以在较老的 x86-64 CPU 上加载;只在 Linux x86_64 上验证过, + macOS、Windows、arm64 与 musl(Alpine)未验证。 +- `node:ffi` 从 Node.js 26.9 起默认开启,但仍是 Stability 1(实验性),API 可能变化;每个 worker 会打印一条 + ExperimentalWarning,示例用 `--disable-warning=ExperimentalWarning` 关掉了它。 +- 进程内同一时刻只有一个已打开的 `DynamicRoutingDataSource`。`POST /datasources` 接受任意 JDBC URL, + 与 Java 版 `add-remove-datasource-sample` 一样只用于演示,生产环境必须加鉴权。 diff --git a/polyglot/build-libdynamicds.sh b/polyglot/build-libdynamicds.sh new file mode 100755 index 00000000..b5402440 --- /dev/null +++ b/polyglot/build-libdynamicds.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# 三个示例的构建(build.rs、hatch_build.py、npm 的 pretest / prestart)都调用本脚本:libdynamicds.so 不存在, +# 或比 Java 源码(src/main)与 pom 旧时,用 GraalVM 重新构建它,否则什么也不做。 +# 找不到 GraalVM 的 native-image 时只打印警告并正常退出,不需要共享库的 cargo clippy、ruff 等照常运行。 +set -eu + +polyglot=$(cd "$(dirname "$0")" && pwd) +module=$polyglot/dynamic-datasource-ffi +library=$module/target/libdynamicds.so + +if [ -f "$library" ] && [ -z "$(find "$module/src/main" "$module/pom.xml" "$polyglot/pom.xml" "$polyglot/../pom.xml" \ + -newer "$library" | head -n 1)" ]; then + exit 0 +fi + +# 与 native-maven-plugin 一样,依次在 GRAALVM_HOME、JAVA_HOME 与 PATH 里找 native-image +if [ ! -x "${GRAALVM_HOME:-}/bin/native-image" ] && [ ! -x "${JAVA_HOME:-}/bin/native-image" ] \ + && ! command -v native-image >/dev/null 2>&1; then + echo "warning: 找不到 GraalVM 的 native-image,跳过 libdynamicds 的构建。请安装 GraalVM 25,让 JAVA_HOME" \ + "或 GRAALVM_HOME 指向它;或者用 DYNAMIC_DATASOURCE_LIB_DIR(Rust)/" \ + "DYNAMIC_DATASOURCE_LIB(Python、TypeScript)指定现成的 libdynamicds.so" >&2 + exit 0 +fi + +echo "libdynamicds.so 不存在或已过期,用 GraalVM 构建,需要几分钟" >&2 +# 与 Dockerfile 一样用 -f 只构建这一个模块,不依赖根 pom 按 JDK 版本激活的 polyglot profile +cd "$polyglot/.." +exec ./mvnw -B -e -Pnative -DskipTests -f polyglot/dynamic-datasource-ffi/pom.xml package diff --git a/polyglot/compose.yaml b/polyglot/compose.yaml new file mode 100644 index 00000000..a5bba9e8 --- /dev/null +++ b/polyglot/compose.yaml @@ -0,0 +1,132 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# 三个示例各自连一个 PostgreSQL(用示例自己的 db/postgresql/init-databases.sql 为每个数据源建库), +# 本机不需要 GraalVM、Rust、Python 或 Node: +# +# docker compose -f polyglot/compose.yaml up --build # 8081 rust / 8082 python / 8083 typescript +# DD_PROFILE=h2 docker compose -f polyglot/compose.yaml up --build # 改用 H2 内存库 +# +# 每个示例启动时都会按建表脚本重建表,所以每个示例独占一个 PostgreSQL,互不干扰。 +# +# test profile 在容器里跑三个示例的测试(H2,以及 Testcontainers 经由宿主 Docker 启动的 PostgreSQL)。 +# rootless Docker 需要用 DOCKER_SOCKET 指出宿主上的 socket: +# +# docker compose -f polyglot/compose.yaml run --build --rm rust-test +# DOCKER_SOCKET=$XDG_RUNTIME_DIR/docker.sock docker compose -f polyglot/compose.yaml run --build --rm rust-test +name: dynamic-datasource-polyglot + +x-postgres: &postgres + image: postgres:18.6-trixie + environment: + POSTGRES_PASSWORD: postgres + healthcheck: + # 走 TCP:initdb 阶段的临时服务器只监听 unix socket,此时还不能算就绪 + test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "postgres"] + interval: 2s + retries: 30 + +x-build: &build + context: .. + dockerfile: polyglot/Dockerfile + +x-environment: &environment + DD_PROFILE: ${DD_PROFILE:-postgresql} + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + +x-test: &test + profiles: [test] + # 测试经由映射端口访问 Testcontainers 启动的 PostgreSQL;rootless Docker 下只有 host 网络里的 + # 127.0.0.1 能连到映射端口,rootful Docker 也同样适用 + network_mode: host + volumes: + - ${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock + environment: + DD_LOG_LEVEL: warn + TESTCONTAINERS_HOST_OVERRIDE: 127.0.0.1 + # Python 的 Testcontainers 在容器里默认改用容器 IP 或网关,这里让它与另外两种语言一样走映射端口 + TESTCONTAINERS_CONNECTION_MODE: docker_host + # Ryuk 等由 Testcontainers 启动的容器挂载的是宿主上的 socket 路径 + TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: ${DOCKER_SOCKET:-/var/run/docker.sock} + +services: + rust-postgres: + <<: *postgres + volumes: + - ./rust-axum-sample/db/postgresql/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql:ro + python-postgres: + <<: *postgres + volumes: + - ./python-fastapi-sample/db/postgresql/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql:ro + typescript-postgres: + <<: *postgres + volumes: + - ./typescript-hono-sample/db/postgresql/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql:ro + + rust: + build: + <<: *build + target: rust + environment: + <<: *environment + POSTGRES_HOST: rust-postgres + ports: ["8081:8081"] + depends_on: + rust-postgres: + condition: service_healthy + + python: + build: + <<: *build + target: python + environment: + <<: *environment + POSTGRES_HOST: python-postgres + ports: ["8082:8082"] + depends_on: + python-postgres: + condition: service_healthy + + typescript: + build: + <<: *build + target: typescript + environment: + <<: *environment + POSTGRES_HOST: typescript-postgres + ports: ["8083:8083"] + depends_on: + typescript-postgres: + condition: service_healthy + + rust-test: + <<: *test + build: + <<: *build + target: rust-test + + python-test: + <<: *test + build: + <<: *build + target: python-test + + typescript-test: + <<: *test + build: + <<: *build + target: typescript-test diff --git a/polyglot/dynamic-datasource-ffi/pom.xml b/polyglot/dynamic-datasource-ffi/pom.xml new file mode 100644 index 00000000..6629aa29 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/pom.xml @@ -0,0 +1,111 @@ + + + + + polyglot-samples + com.baomidou + 1.0.0 + + 4.0.0 + + dynamic-datasource-ffi + + + + com.baomidou + dynamic-datasource-spring + + + + org.mybatis + mybatis-spring + + + + + com.baomidou + dynamic-datasource-native-metadata + runtime + + + com.zaxxer + HikariCP + + + tools.jackson.core + jackson-databind + + + com.h2database + h2 + runtime + + + org.postgresql + postgresql + runtime + + + org.slf4j + slf4j-simple + runtime + + + org.graalvm.sdk + nativeimage + provided + + + org.junit.jupiter + junit-jupiter + test + + + org.assertj + assertj-core + test + + + org.testcontainers + testcontainers-junit-jupiter + test + + + org.testcontainers + testcontainers-postgresql + test + + + + + + + + org.graalvm.buildtools + native-maven-plugin + + libdynamicds + + + + + diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DataSourceConfig.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DataSourceConfig.java new file mode 100644 index 00000000..58b60e5e --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DataSourceConfig.java @@ -0,0 +1,135 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import static java.util.stream.Collectors.toMap; + +import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import java.time.Duration; +import java.util.LinkedHashMap; +import java.util.Map; +import org.springframework.util.PropertyPlaceholderHelper; +import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.node.ArrayNode; +import tools.jackson.databind.node.ObjectNode; +import tools.jackson.databind.node.StringNode; + +/** + * {@code dd_open} 的配置,字段与 {@code spring.datasource.dynamic.*} 同名(camelCase)。 + * + *

字符串值里的 {@code ${NAME}} / {@code ${NAME:default}} 占位符先取顶层 {@code variables}(由宿主语言传入, 例如 SQL + * 脚本目录 {@code DB_DIR}),再取环境变量,最后取默认值。 + */ +record DataSourceConfig( + String primary, + boolean strict, + boolean randomStrategy, + Boolean lazy, + Duration txIdleTimeout, + Map datasources) { + + private static final PropertyPlaceholderHelper PLACEHOLDERS = + new PropertyPlaceholderHelper("${", "}", ":", null, false); + + static DataSourceConfig parse(JsonNode root) { + if (!(root instanceof ObjectNode object)) { + throw new FacadeException(ErrorCode.BAD_REQUEST, "the configuration must be an object"); + } + var variables = + object.path("variables") + .propertyStream() + .collect(toMap(Map.Entry::getKey, e -> e.getValue().asString())); + PlaceholderResolver resolver = name -> variables.getOrDefault(name, System.getenv(name)); + // variables 是占位符的取值来源,自身不参与解析 + var cfg = resolve(object.deepCopy().without("variables"), resolver); + var datasources = new LinkedHashMap(); + cfg.path("datasource") + .properties() + .forEach(e -> datasources.put(e.getKey(), toProperty(e.getKey(), e.getValue()))); + if (datasources.isEmpty()) { + throw new FacadeException(ErrorCode.BAD_REQUEST, "'datasource' must not be empty"); + } + var randomStrategy = + switch (cfg.path("strategy").asString("loadbalance")) { + case "loadbalance" -> false; + case "random" -> true; + default -> + throw new FacadeException( + ErrorCode.BAD_REQUEST, + "'strategy' must be 'loadbalance' or 'random'"); + }; + return new DataSourceConfig( + cfg.path("primary").asString("master"), + cfg.path("strict").asBoolean(false), + randomStrategy, + cfg.optional("lazy").map(JsonNode::asBoolean).orElse(null), + Duration.ofSeconds(cfg.path("txIdleTimeoutSeconds").asLong(30)), + datasources); + } + + /** 与 {@code spring.datasource.dynamic.datasource..*} 对应,hikari 只映射常用的三项。 */ + static DataSourceProperty toProperty(String name, JsonNode node) { + var property = new DataSourceProperty(); + property.setPoolName(name); + property.setUrl(Json.required(node, "url")); + property.setUsername(Json.text(node, "username")); + property.setPassword(Json.text(node, "password")); + property.setDriverClassName(Json.text(node, "driverClassName")); + node.optional("lazy").map(JsonNode::asBoolean).ifPresent(property::setLazy); + var init = node.path("init"); + var initProperty = property.getInit(); + initProperty.setSchema(Json.text(init, "schema")); + initProperty.setData(Json.text(init, "data")); + init.optional("continueOnError") + .map(JsonNode::asBoolean) + .ifPresent(initProperty::setContinueOnError); + var hikari = node.path("hikari"); + var hikariConfig = property.getHikari(); + hikari.optional("maxPoolSize").map(JsonNode::asInt).ifPresent(hikariConfig::setMaxPoolSize); + hikari.optional("minIdle").map(JsonNode::asInt).ifPresent(hikariConfig::setMinIdle); + hikari.optional("connectionTimeout") + .map(JsonNode::asLong) + .ifPresent(hikariConfig::setConnectionTimeout); + return property; + } + + private static JsonNode resolve(JsonNode node, PlaceholderResolver resolver) { + return switch (node) { + case StringNode string -> { + try { + yield StringNode.valueOf( + PLACEHOLDERS.replacePlaceholders(string.asString(), resolver)); + } catch (IllegalArgumentException e) { + // 既没有对应的 variables / 环境变量,也没有写默认值 + throw new FacadeException(ErrorCode.BAD_REQUEST, e.getMessage()); + } + } + case ObjectNode object -> { + var copy = Json.MAPPER.createObjectNode(); + object.properties() + .forEach(e -> copy.set(e.getKey(), resolve(e.getValue(), resolver))); + yield copy; + } + case ArrayNode array -> { + var copy = Json.MAPPER.createArrayNode(); + array.forEach(item -> copy.add(resolve(item, resolver))); + yield copy; + } + default -> node; + }; + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DynamicDataSourceFacade.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DynamicDataSourceFacade.java new file mode 100644 index 00000000..69b8f313 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/DynamicDataSourceFacade.java @@ -0,0 +1,305 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator; +import com.baomidou.dynamic.datasource.creator.hikaricp.HikariCpConfig; +import com.baomidou.dynamic.datasource.creator.hikaricp.HikariDataSourceCreator; +import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; +import com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider; +import com.baomidou.dynamic.datasource.strategy.RandomDynamicDataSourceStrategy; +import com.baomidou.dynamic.datasource.tx.DsPropagation; +import com.baomidou.dynamic.datasource.tx.TransactionContext; +import com.baomidou.dynamic.datasource.tx.TransactionalExecutor; +import com.baomidou.dynamic.datasource.tx.TransactionalInfo; +import com.baomidou.dynamic.datasource.tx.TransactionalTemplate; +import java.sql.SQLException; +import java.util.List; +import java.util.Objects; +import java.util.TreeMap; +import java.util.concurrent.Callable; +import java.util.stream.Stream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.node.ObjectNode; + +/** + * dynamic-datasource 的门面,{@link NativeEntryPoints} 与 JVM 单测共用。 + * + *

每个 {@code dd_*} 操作都是一个 {@link Operation}:请求与返回值都是 JSON,失败时直接抛异常。{@link #call} 把结果包成 {@code + * {"ok":true,"data":...}},把异常包成 {@code + * {"ok":false,"error":{"code","type","message","sqlState"}}},自身从不抛异常:异常不能穿过 C 边界。 + */ +public final class DynamicDataSourceFacade { + + static { + // 赶在第一个 slf4j-simple 日志器创建之前生效,宿主语言用环境变量就能调整 Java 侧的日志级别 + var level = System.getenv("DD_LOG_LEVEL"); + if (level != null && !level.isBlank()) { + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", level); + } + } + + private static final Logger log = LoggerFactory.getLogger(DynamicDataSourceFacade.class); + + private static final TransactionalTemplate TX_TEMPLATE = new TransactionalTemplate(); + + /** 与 {@code @DSTransactional} 的默认值一致;留空的话 TransactionalTemplate 遇到异常也会提交。 */ + @SuppressWarnings("unchecked") + private static final Class[] ROLLBACK_FOR = new Class[] {Exception.class}; + + private static volatile Opened opened; + + private DynamicDataSourceFacade() {} + + /** 一个 {@code dd_*} 操作。 */ + @FunctionalInterface + public interface Operation { + JsonNode apply(JsonNode request) throws Throwable; + } + + /** 解析请求、执行操作并返回 JSON 响应。 */ + public static String call(Operation operation, String request) { + var response = Json.MAPPER.createObjectNode(); + try { + response.put("ok", true).set("data", operation.apply(Json.parse(request))); + } catch (Throwable t) { + response.put("ok", false).set("error", error(t)); + } + return Json.MAPPER.writeValueAsString(response); + } + + /** {@code dd_open}:手工组装 DynamicRoutingDataSource,相当于 Spring Boot starter 的自动配置。 */ + public static synchronized JsonNode open(JsonNode request) { + if (opened != null) { + throw new FacadeException(ErrorCode.ALREADY_OPEN, "dynamic-datasource is already open"); + } + var config = DataSourceConfig.parse(request); + var creator = new DefaultDataSourceCreator(); + // 无参构造会让全局 HikariCpConfig 为 null,ConfigMergeCreator 合并配置时随即 NPE, + // 见 https://github.com/baomidou/dynamic-datasource/issues/821 + creator.setCreators(List.of(new HikariDataSourceCreator(new HikariCpConfig()))); + if (config.lazy() != null) { + creator.setLazy(config.lazy()); + } + var provider = new YmlDynamicDataSourceProvider(creator, config.datasources()); + var routing = new DynamicRoutingDataSource(List.of(provider)); + routing.setPrimary(config.primary()); + routing.setStrict(config.strict()); + if (config.randomStrategy()) { + routing.setStrategy(RandomDynamicDataSourceStrategy.class); + } + try { + routing.afterPropertiesSet(); + } catch (RuntimeException e) { + // 宿主进程不一定随之退出,先关掉已经加入的连接池 + routing.destroy(); + throw e; + } + var sessions = new TransactionSessions(config.txIdleTimeout()); + opened = new Opened(routing, creator, config.primary(), sessions); + return describe(routing); + } + + /** {@code dd_close}:回滚未结束的会话式事务并关闭所有连接池,之后可以再次 {@code dd_open}。 */ + public static synchronized JsonNode close(JsonNode request) { + var current = opened; + opened = null; + if (current != null) { + current.sessions().close(); + current.routing().destroy(); + } + return null; + } + + /** {@code dd_execute}:在 {@code ds} 指定的数据源或分组上执行一条语句。 */ + public static JsonNode execute(JsonNode request) throws SQLException { + var current = current(); + return StatementExecutor.run(current.routing(), current.primary(), request); + } + + /** {@code dd_transaction}:在一次调用内把一批语句放进同一个本地事务,语义同 {@code @DSTransactional}。 */ + public static JsonNode transaction(JsonNode request) throws Throwable { + // 先确认已经 dd_open,再校验请求 + final var current = current(); + var statements = request.path("statements"); + if (!statements.isArray() || statements.isEmpty()) { + throw new FacadeException( + ErrorCode.BAD_REQUEST, "'statements' must be a non-empty array"); + } + var info = new TransactionalInfo(); + info.setPropagation(DsPropagation.REQUIRED); + info.setRollbackFor(ROLLBACK_FOR); + Callable batch = + () -> { + var result = Json.MAPPER.createObjectNode(); + result.put("xid", TransactionContext.getXID()); + var results = result.putArray("results"); + for (var statement : statements) { + results.add( + StatementExecutor.run( + current.routing(), current.primary(), statement)); + } + return result; + }; + return (JsonNode) TX_TEMPLATE.execute(new Transactional(info, batch)); + } + + /** {@code dd_add_datasource}:对应 add-remove-datasource-sample,名称带下划线时自动加入分组。 */ + public static JsonNode addDataSource(JsonNode request) { + var current = current(); + var name = Json.required(request, "name"); + var property = DataSourceConfig.toProperty(name, request); + current.routing().addDataSource(name, current.creator().createDataSource(property)); + return describe(current.routing()); + } + + /** {@code dd_remove_datasource}:删除数据源并关闭其连接池,primary 不能删除。 */ + public static JsonNode removeDataSource(JsonNode request) { + var current = current(); + var name = Json.required(request, "name"); + if (name.equals(current.primary())) { + throw new FacadeException( + ErrorCode.BAD_REQUEST, "the primary datasource can not be removed"); + } + if (!current.routing().getDataSources().containsKey(name)) { + throw new FacadeException( + ErrorCode.DATASOURCE_NOT_FOUND, + "dynamic-datasource could not find a datasource named %s".formatted(name)); + } + current.routing().removeDataSource(name); + return describe(current.routing()); + } + + /** {@code dd_list_datasources}:当前的数据源与分组。 */ + public static JsonNode listDataSources(JsonNode request) { + return describe(current().routing()); + } + + /** {@code dd_tx_begin}:开启会话式事务,返回 {@code {"txId"}}。 */ + public static JsonNode beginTransaction(JsonNode request) throws Exception { + return Json.MAPPER.createObjectNode().put("txId", current().sessions().begin()); + } + + /** {@code dd_tx_execute}:在会话式事务中执行一条语句,请求在 {@code dd_execute} 的基础上多一个 {@code txId}。 */ + public static JsonNode executeInTransaction(JsonNode request) throws Exception { + var current = current(); + return current.sessions() + .run( + Json.required(request, "txId"), + () -> StatementExecutor.run(current.routing(), current.primary(), request)); + } + + /** {@code dd_tx_commit}:提交会话式事务涉及的所有数据源。 */ + public static JsonNode commitTransaction(JsonNode request) throws Exception { + current().sessions().commit(Json.required(request, "txId")); + return null; + } + + /** {@code dd_tx_rollback}:回滚会话式事务涉及的所有数据源。 */ + public static JsonNode rollbackTransaction(JsonNode request) throws Exception { + current().sessions().rollback(Json.required(request, "txId")); + return null; + } + + private static Opened current() { + var current = opened; + if (current == null) { + throw new FacadeException( + ErrorCode.NOT_OPEN, "dynamic-datasource is not open, call dd_open first"); + } + return current; + } + + private static ObjectNode describe(DynamicRoutingDataSource routing) { + var result = Json.MAPPER.createObjectNode(); + var datasources = result.putArray("datasources"); + routing.getDataSources().keySet().stream().sorted().forEach(datasources::add); + var groups = result.putObject("groups"); + new TreeMap<>(routing.getGroupDataSources()) + .forEach( + (name, group) -> { + var members = groups.putArray(name); + group.getDataSourceMap().keySet().stream() + .sorted() + .forEach(members::add); + }); + return result; + } + + private static ObjectNode error(Throwable t) { + var sqlException = + Stream.iterate(t, Objects::nonNull, Throwable::getCause) + .filter(SQLException.class::isInstance) + .map(SQLException.class::cast) + .findFirst(); + var code = + switch (t) { + case FacadeException e -> e.code(); + case CannotFindDataSourceException _ -> ErrorCode.DATASOURCE_NOT_FOUND; + case JacksonException _ -> ErrorCode.BAD_REQUEST; + default -> + sqlException + .map(DynamicDataSourceFacade::classify) + .orElse(ErrorCode.INTERNAL); + }; + if (code == ErrorCode.INTERNAL) { + log.error("dynamic-datasource ffi call failed", t); + } + var error = + Json.MAPPER + .createObjectNode() + .put("code", code.name()) + .put("type", t.getClass().getName()) + .put("message", String.valueOf(t.getMessage())); + sqlException + .map(SQLException::getSQLState) + .ifPresent(state -> error.put("sqlState", state)); + return error; + } + + /** SQLState 23xxx 是违反数据库约束,例如库存、余额的 CHECK 约束。 */ + private static ErrorCode classify(SQLException e) { + var sqlState = e.getSQLState(); + return sqlState != null && sqlState.startsWith("23") + ? ErrorCode.CONSTRAINT_VIOLATION + : ErrorCode.SQL_ERROR; + } + + private record Opened( + DynamicRoutingDataSource routing, + DefaultDataSourceCreator creator, + String primary, + TransactionSessions sessions) {} + + /** {@link TransactionalExecutor} 有两个抽象方法,写不成 lambda。 */ + private record Transactional(TransactionalInfo info, Callable body) + implements TransactionalExecutor { + + @Override + public Object execute() throws Exception { + return body.call(); + } + + @Override + public TransactionalInfo getTransactionInfo() { + return info; + } + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/ErrorCode.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/ErrorCode.java new file mode 100644 index 00000000..2c167702 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/ErrorCode.java @@ -0,0 +1,38 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +/** 返回给调用方的 {@code error.code},各语言据此映射 HTTP 状态码,而不必认识 Java 异常类名。 */ +public enum ErrorCode { + /** 请求 JSON 格式错误或缺少必填字段,或者操作本身不被允许(例如删除 primary)。 */ + BAD_REQUEST, + /** 还没有调用 {@code dd_open},或者已经 {@code dd_close}。 */ + NOT_OPEN, + /** 重复调用 {@code dd_open}。 */ + ALREADY_OPEN, + /** strict 模式下找不到指定的数据源或分组。 */ + DATASOURCE_NOT_FOUND, + /** 语句的 {@code expectUpdateCount} 与实际更新行数不符。 */ + UPDATE_COUNT_MISMATCH, + /** 会话式事务不存在,已结束或因空闲超时被回滚。 */ + TRANSACTION_NOT_FOUND, + /** 违反数据库约束(SQLState 23xxx),例如库存、余额的 CHECK 约束。 */ + CONSTRAINT_VIOLATION, + /** 其他 SQL 错误。 */ + SQL_ERROR, + /** 其他未预期的错误。 */ + INTERNAL +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/FacadeException.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/FacadeException.java new file mode 100644 index 00000000..380d3973 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/FacadeException.java @@ -0,0 +1,31 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +/** 带有稳定 {@link ErrorCode} 的失败,由门面统一转成 {@code {"ok":false,"error":{...}}}。 */ +final class FacadeException extends RuntimeException { + + private final ErrorCode code; + + FacadeException(ErrorCode code, String message) { + super(message); + this.code = code; + } + + ErrorCode code() { + return code; + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/Json.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/Json.java new file mode 100644 index 00000000..ac3d86ef --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/Json.java @@ -0,0 +1,45 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.json.JsonMapper; + +/** 只使用 Jackson 的树模型:不做 POJO 绑定,native image 中也就不需要为业务类型登记反射。 */ +final class Json { + + static final JsonMapper MAPPER = JsonMapper.builder().build(); + + private Json() {} + + static JsonNode parse(String json) { + return json == null || json.isBlank() ? MAPPER.createObjectNode() : MAPPER.readTree(json); + } + + /** 字段缺失或为 JSON null 时返回 null。 */ + static String text(JsonNode node, String field) { + var value = node.get(field); + return value == null || value.isNull() ? null : value.asString(); + } + + static String required(JsonNode node, String field) { + var value = text(node, field); + if (value == null || value.isBlank()) { + throw new FacadeException(ErrorCode.BAD_REQUEST, "'%s' is required".formatted(field)); + } + return value; + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/NativeEntryPoints.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/NativeEntryPoints.java new file mode 100644 index 00000000..82012e49 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/NativeEntryPoints.java @@ -0,0 +1,130 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import com.baomidou.samples.ffi.DynamicDataSourceFacade.Operation; +import java.nio.charset.StandardCharsets; +import org.graalvm.nativeimage.Isolate; +import org.graalvm.nativeimage.IsolateThread; +import org.graalvm.nativeimage.UnmanagedMemory; +import org.graalvm.nativeimage.c.function.CEntryPoint; +import org.graalvm.nativeimage.c.type.CCharPointer; +import org.graalvm.nativeimage.c.type.CConst; +import org.graalvm.nativeimage.c.type.CTypeConversion; + +/** + * libdynamicds 的 C ABI(构建时生成 {@code libdynamicds.h})。 + * + *

前四个函数管理 isolate 与线程:进程内调用一次 {@code dd_create_isolate},其他 OS 线程先 {@code dd_attach_thread} + * 再调用业务函数。业务函数的签名统一为 {@code char* dd_xxx(graal_isolatethread_t* thread, const char* + * request)},请求与返回值都是 NUL 结尾的 UTF-8 JSON,返回值必须交给 {@code dd_free} 释放。 + */ +public final class NativeEntryPoints { + + private NativeEntryPoints() {} + + /** 创建 isolate,调用线程随之 attach;进程内只需调用一次。 */ + @CEntryPoint(name = "dd_create_isolate", builtin = CEntryPoint.Builtin.CREATE_ISOLATE) + static native IsolateThread createIsolate(); + + /** 取 isolate 句柄,交给其他线程 attach。 */ + @CEntryPoint(name = "dd_get_isolate", builtin = CEntryPoint.Builtin.GET_ISOLATE) + static native Isolate getIsolate(IsolateThread thread); + + /** 把当前 OS 线程 attach 到 isolate,对已经 attach 的线程是幂等的。 */ + @CEntryPoint(name = "dd_attach_thread", builtin = CEntryPoint.Builtin.ATTACH_THREAD) + static native IsolateThread attachThread(Isolate isolate); + + /** 线程退出前 detach。 */ + @CEntryPoint(name = "dd_detach_thread", builtin = CEntryPoint.Builtin.DETACH_THREAD) + static native int detachThread(IsolateThread thread); + + @CEntryPoint(name = "dd_open") + static CCharPointer open(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::open, request); + } + + @CEntryPoint(name = "dd_close") + static CCharPointer close(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::close, request); + } + + @CEntryPoint(name = "dd_execute") + static CCharPointer execute(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::execute, request); + } + + @CEntryPoint(name = "dd_transaction") + static CCharPointer transaction(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::transaction, request); + } + + @CEntryPoint(name = "dd_add_datasource") + static CCharPointer addDataSource(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::addDataSource, request); + } + + @CEntryPoint(name = "dd_remove_datasource") + static CCharPointer removeDataSource(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::removeDataSource, request); + } + + @CEntryPoint(name = "dd_list_datasources") + static CCharPointer listDataSources(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::listDataSources, request); + } + + @CEntryPoint(name = "dd_tx_begin") + static CCharPointer beginTransaction(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::beginTransaction, request); + } + + @CEntryPoint(name = "dd_tx_execute") + static CCharPointer executeInTransaction(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::executeInTransaction, request); + } + + @CEntryPoint(name = "dd_tx_commit") + static CCharPointer commitTransaction(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::commitTransaction, request); + } + + @CEntryPoint(name = "dd_tx_rollback") + static CCharPointer rollbackTransaction(IsolateThread thread, @CConst CCharPointer request) { + return call(DynamicDataSourceFacade::rollbackTransaction, request); + } + + /** 释放业务函数返回的字符串,传入 NULL 是安全的。 */ + @CEntryPoint(name = "dd_free") + static void free(IsolateThread thread, CCharPointer pointer) { + UnmanagedMemory.free(pointer); + } + + private static CCharPointer call(Operation operation, CCharPointer request) { + // JDK 18 起默认字符集固定为 UTF-8(JEP 400),toJavaString 按它解码 + var json = request.isNull() ? "" : CTypeConversion.toJavaString(request); + return toNativeString(DynamicDataSourceFacade.call(operation, json)); + } + + /** 复制到 malloc 出来的内存里:所有权交给调用方,由 {@code dd_free} 释放。 */ + private static CCharPointer toNativeString(String value) { + var bytes = value.getBytes(StandardCharsets.UTF_8); + CCharPointer pointer = UnmanagedMemory.malloc(bytes.length + 1); + CTypeConversion.asByteBuffer(pointer, bytes.length).put(bytes); + pointer.write(bytes.length, (byte) 0); + return pointer; + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/StatementExecutor.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/StatementExecutor.java new file mode 100644 index 00000000..4c10a50f --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/StatementExecutor.java @@ -0,0 +1,143 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.ds.ItemDataSource; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.baomidou.dynamic.datasource.tx.TransactionContext; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.Locale; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.node.ArrayNode; +import tools.jackson.databind.node.BooleanNode; +import tools.jackson.databind.node.NullNode; +import tools.jackson.databind.node.NumericNode; +import tools.jackson.databind.node.ObjectNode; + +/** + * 在 {@code ds} 指定的数据源或分组上执行一条语句,效果等同于调用一个标了 {@code @DS(ds)} 的方法。 + * + *

请求:{@code {"ds","sql","params","generatedKeys","expectUpdateCount"}},除 {@code sql} 外都可省略; + * {@code ds} 省略时走 primary。 + */ +final class StatementExecutor { + + private StatementExecutor() {} + + static ObjectNode run(DynamicRoutingDataSource routing, String primary, JsonNode statement) + throws SQLException { + var sql = Json.required(statement, "sql"); + var ds = Json.text(statement, "ds"); + var generatedKeys = statement.path("generatedKeys"); + DynamicDataSourceContextHolder.push(ds); + try { + // 没有事务时,这与 DynamicRoutingDataSource#getConnection 的行为完全一致;先解析出目标数据源, + // 是为了把分组里实际命中的成员告诉调用方。事务中必须走 getConnection,连接才会被事务接管。 + var target = + TransactionContext.getXID() == null ? routing.determineDataSource() : routing; + var datasource = + switch (target) { + case ItemDataSource item -> item.getName(); + default -> ds == null || ds.isEmpty() ? primary : ds; + }; + try (var connection = target.getConnection(); + var ps = prepare(connection, sql, generatedKeys)) { + bind(ps, statement.path("params")); + var result = Json.MAPPER.createObjectNode().put("datasource", datasource); + if (ps.execute()) { + try (var rs = ps.getResultSet()) { + return result.set("rows", rows(rs)); + } + } + var updateCount = ps.getUpdateCount(); + var mismatch = + statement + .optional("expectUpdateCount") + .filter(expected -> !expected.isNull()) + .map(JsonNode::asInt) + .filter(expected -> expected != updateCount); + if (mismatch.isPresent()) { + throw new FacadeException( + ErrorCode.UPDATE_COUNT_MISMATCH, + "expected %d row(s) to be updated but was %d: %s" + .formatted(mismatch.get(), updateCount, sql)); + } + result.put("updateCount", updateCount); + if (!generatedKeys.isEmpty()) { + try (var keys = ps.getGeneratedKeys()) { + result.set("generatedKeys", rows(keys)); + } + } + return result; + } + } finally { + DynamicDataSourceContextHolder.poll(); + } + } + + private static PreparedStatement prepare( + Connection connection, String sql, JsonNode generatedKeys) throws SQLException { + if (generatedKeys.isEmpty()) { + return connection.prepareStatement(sql); + } + var columns = generatedKeys.valueStream().map(JsonNode::asString).toArray(String[]::new); + return connection.prepareStatement(sql, columns); + } + + private static void bind(PreparedStatement ps, JsonNode params) throws SQLException { + for (var i = 0; i < params.size(); i++) { + var index = i + 1; + switch (params.get(i)) { + case NullNode _ -> ps.setNull(index, Types.NULL); + case BooleanNode b -> ps.setBoolean(index, b.booleanValue()); + case NumericNode n when n.isIntegralNumber() -> ps.setLong(index, n.longValue()); + case NumericNode n -> ps.setDouble(index, n.doubleValue()); + case JsonNode other -> ps.setString(index, other.asString()); + } + } + } + + /** 列名统一小写(H2 返回大写,PostgreSQL 返回小写),值只转成 JSON 的基本类型。 */ + private static ArrayNode rows(ResultSet rs) throws SQLException { + var rows = Json.MAPPER.createArrayNode(); + var metaData = rs.getMetaData(); + var columns = metaData.getColumnCount(); + while (rs.next()) { + var row = rows.addObject(); + for (var c = 1; c <= columns; c++) { + var label = metaData.getColumnLabel(c).toLowerCase(Locale.ROOT); + switch (rs.getObject(c)) { + case null -> row.putNull(label); + case Boolean b -> row.put(label, b); + case BigDecimal d -> row.put(label, d); + case Double d -> row.put(label, d); + case Float f -> row.put(label, f); + case Number n -> row.put(label, n.longValue()); + case Timestamp t -> row.put(label, t.toLocalDateTime().toString()); + default -> row.put(label, rs.getString(c)); + } + } + } + return rows; + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/TransactionSessions.java b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/TransactionSessions.java new file mode 100644 index 00000000..5ddbd6d6 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/main/java/com/baomidou/samples/ffi/TransactionSessions.java @@ -0,0 +1,205 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import com.baomidou.dynamic.datasource.tx.LocalTxUtil; +import java.time.Duration; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 跨越多次 {@code dd_tx_*} 调用的会话式事务。 + * + *

dynamic-datasource 把事务的 xid 与连接都放在 ThreadLocal 里,而宿主语言的每次调用可能来自不同的线程 (tokio 的 blocking + * 线程池、Starlette 的线程池、Node 的 worker),所以每个会话独占一个平台线程, 它的所有语句、提交与回滚都在这个线程上执行。空闲超过 {@code + * txIdleTimeoutSeconds} 的会话会被自动回滚, 以免宿主进程忘记收尾时一直占着连接。 + */ +final class TransactionSessions implements AutoCloseable { + + private static final Logger log = LoggerFactory.getLogger(TransactionSessions.class); + + private static final ThreadFactory SESSION_THREADS = + Thread.ofPlatform().name("dd-tx-", 1).daemon().factory(); + + private final Map sessions = new ConcurrentHashMap<>(); + + private final Duration idleTimeout; + + private final ScheduledExecutorService reaper = + Executors.newSingleThreadScheduledExecutor( + Thread.ofPlatform().name("dd-tx-reaper").daemon().factory()); + + TransactionSessions(Duration idleTimeout) { + this.idleTimeout = idleTimeout; + reaper.scheduleWithFixedDelay(this::rollbackIdleSessions, 1, 1, TimeUnit.SECONDS); + } + + /** 开启事务;返回的 txId 就是 dynamic-datasource 的 xid,便于与它的日志对照。 */ + String begin() throws Exception { + var session = new Session(); + try { + session.xid = session.call(LocalTxUtil::startTransaction); + } catch (Exception e) { + session.thread.shutdown(); + throw e; + } + sessions.put(session.xid, session); + return session.xid; + } + + T run(String txId, Callable work) throws Exception { + var session = sessions.get(txId); + if (session == null) { + throw notFound(txId); + } + return session.call(work); + } + + void commit(String txId) throws Exception { + complete(remove(txId), LocalTxUtil::commit); + } + + void rollback(String txId) throws Exception { + complete(remove(txId), LocalTxUtil::rollback); + } + + /** {@code dd_close} 时回滚所有尚未结束的会话。 */ + @Override + public void close() { + reaper.shutdownNow(); + sessions.keySet() + .forEach( + txId -> { + var session = sessions.remove(txId); + if (session != null) { + rollbackQuietly(txId, session); + } + }); + } + + private void rollbackIdleSessions() { + var now = System.nanoTime(); + sessions.forEach( + (txId, session) -> { + if (session.idleLongerThan(idleTimeout, now) + && sessions.remove(txId, session)) { + log.warn( + "dynamic-datasource ffi rolled back transaction [{}] idle for more than {}", + txId, + idleTimeout); + rollbackQuietly(txId, session); + } + }); + } + + private Session remove(String txId) { + var session = sessions.remove(txId); + if (session == null) { + throw notFound(txId); + } + return session; + } + + /** 在会话线程上提交或回滚,之后会话线程随即退出。 */ + private static void complete(Session session, Completion completion) throws Exception { + try { + session.call( + () -> { + try { + completion.apply(session.xid); + } finally { + session.completed = true; + } + return null; + }); + } finally { + session.thread.shutdown(); + } + } + + private static void rollbackQuietly(String txId, Session session) { + try { + complete(session, LocalTxUtil::rollback); + } catch (Exception e) { + log.warn("dynamic-datasource ffi failed to roll back transaction [{}]", txId, e); + } + } + + private static FacadeException notFound(String txId) { + return new FacadeException( + ErrorCode.TRANSACTION_NOT_FOUND, + "transaction [%s] does not exist, has completed or timed out".formatted(txId)); + } + + /** {@link LocalTxUtil#commit} 或 {@link LocalTxUtil#rollback}。 */ + @FunctionalInterface + private interface Completion { + void apply(String xid) throws Exception; + } + + private static final class Session { + + private final ExecutorService thread = Executors.newSingleThreadExecutor(SESSION_THREADS); + + private final AtomicInteger inFlight = new AtomicInteger(); + + private volatile long lastUsedNanos = System.nanoTime(); + + private volatile String xid; + + /** 只在会话线程上读写:提交或回滚之后才排到的语句不能再以自动提交的方式执行。 */ + private boolean completed; + + T call(Callable work) throws Exception { + inFlight.incrementAndGet(); + try { + return thread.submit( + () -> { + if (completed) { + throw notFound(xid); + } + return work.call(); + }) + .get(); + } catch (RejectedExecutionException _) { + throw notFound(xid); + } catch (ExecutionException e) { + if (e.getCause() instanceof Exception cause) { + throw cause; + } + throw (Error) e.getCause(); + } finally { + lastUsedNanos = System.nanoTime(); + inFlight.decrementAndGet(); + } + } + + boolean idleLongerThan(Duration timeout, long now) { + return inFlight.get() == 0 && now - lastUsedNanos > timeout.toNanos(); + } + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/AbstractDynamicDataSourceFacadeTest.java b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/AbstractDynamicDataSourceFacadeTest.java new file mode 100644 index 00000000..7d1afebf --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/AbstractDynamicDataSourceFacadeTest.java @@ -0,0 +1,327 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.baomidou.samples.ffi.DynamicDataSourceFacade.Operation; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Executors; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.node.ObjectNode; + +/** 同一组场景分别跑在 H2 与 PostgreSQL 上;门面是进程级单例,子类在 @BeforeAll 里 open。 */ +abstract class AbstractDynamicDataSourceFacadeTest { + + /** 本模块自带的 config/ 与 db/;surefire 的工作目录是模块目录。 */ + static final Path RESOURCES = Path.of("src/test/resources").toAbsolutePath(); + + static final int TX_IDLE_TIMEOUT_SECONDS = 2; + + /** 与三种语言的示例一样:读取 config/.json,再把 SQL 目录等放进 variables。 */ + static void open(String profile, Map variables) throws IOException { + var config = + (ObjectNode) + Json.parse( + Files.readString( + RESOURCES.resolve("config/%s.json".formatted(profile)))); + var configVariables = + config.putObject("variables").put("DB_DIR", RESOURCES.resolve("db").toString()); + variables.forEach(configVariables::put); + config.put("txIdleTimeoutSeconds", TX_IDLE_TIMEOUT_SECONDS); + ok(DynamicDataSourceFacade::open, config.toString()); + } + + @AfterAll + static void close() { + ok(DynamicDataSourceFacade::close, "{}"); + } + + /** 动态添加演示用的 slave_3,H2 与 PostgreSQL 的连接信息不同。 */ + abstract String slave3(); + + @BeforeEach + void resetOrderData() { + execute("order", "delete from p_order"); + execute("product", "update product set stock = 20 where id = 1"); + execute("account", "update account set balance = 50 where id = 1"); + } + + @Test + void readsFromSlaveGroupMembersInTurn() { + var served = new HashSet(); + for (var i = 0; i < 4; i++) { + var data = execute("slave", "select name from t_user order by id"); + var datasource = data.path("datasource").asString(); + assertThat(data.path("rows").get(0).path("name").asString()) + .isEqualTo("%s-张三".formatted(datasource)); + served.add(datasource); + } + assertThat(served).containsExactlyInAnyOrder("slave_1", "slave_2"); + } + + @Test + void strictModeRejectsUnknownDatasource() { + assertThat( + errorCode( + DynamicDataSourceFacade::execute, + statement("nope", "select 1").toString())) + .isEqualTo("DATASOURCE_NOT_FOUND"); + } + + @Test + void writesGoToPrimaryAndReturnGeneratedKeys() { + var data = + ok( + DynamicDataSourceFacade::execute, + """ + { + "sql": "insert into t_user (name, age) values (?, ?)", + "params": ["李四", 20], + "generatedKeys": ["id"] + } + """); + assertThat(data.path("datasource").asString()).isEqualTo("master"); + assertThat(data.path("updateCount").asInt()).isEqualTo(1); + var id = data.path("generatedKeys").get(0).path("id").asLong(); + assertThat(rows("master", "select name from t_user where id = ?", id)) + .extracting(row -> row.path("name").asString()) + .containsExactly("李四"); + assertThat(rows("slave_1", "select name from t_user where name = ?", "李四")).isEmpty(); + } + + @Test + void addsDatasourceToGroupAndRemovesIt() { + var added = ok(DynamicDataSourceFacade::addDataSource, slave3()); + assertThat(added.path("groups").path("slave")) + .extracting(JsonNode::asString) + .containsExactly("slave_1", "slave_2", "slave_3"); + var served = new HashSet(); + for (var i = 0; i < 6; i++) { + served.add( + execute("slave", "select count(*) c from t_user") + .path("datasource") + .asString()); + } + assertThat(served).containsExactlyInAnyOrder("slave_1", "slave_2", "slave_3"); + + var removed = ok(DynamicDataSourceFacade::removeDataSource, request("name", "slave_3")); + assertThat(removed.path("groups").path("slave")) + .extracting(JsonNode::asString) + .containsExactly("slave_1", "slave_2"); + assertThat(errorCode(DynamicDataSourceFacade::removeDataSource, request("name", "master"))) + .isEqualTo("BAD_REQUEST"); + assertThat(errorCode(DynamicDataSourceFacade::removeDataSource, request("name", "slave_3"))) + .isEqualTo("DATASOURCE_NOT_FOUND"); + } + + @Test + void batchTransactionCommitsAcrossDatasources() { + var data = ok(DynamicDataSourceFacade::transaction, placeOrderBatch(1, 1)); + assertThat(data.path("xid").asString()).isNotBlank(); + assertThat(data.path("results")) + .extracting(result -> result.path("datasource").asString()) + .containsExactly("order", "product", "account"); + assertThat(orderCount()).isEqualTo(1); + assertThat(stock()).isEqualTo(19); + assertThat(balance()).isEqualTo(40.0); + } + + @Test + void batchTransactionRollsBackEveryDatasourceOnConstraintViolation() { + // 总价 60 超过余额 50:account 的 CHECK 约束失败,已经执行的 order、product 语句一起回滚 + var error = error(DynamicDataSourceFacade::transaction, placeOrderBatch(1, 6)); + assertThat(error.path("code").asString()).isEqualTo("CONSTRAINT_VIOLATION"); + assertThat(error.path("sqlState").asString()).startsWith("23"); + assertThat(orderCount()).isZero(); + assertThat(stock()).isEqualTo(20); + assertThat(balance()).isEqualTo(50.0); + } + + @Test + void batchTransactionRollsBackOnUnexpectedUpdateCount() { + assertThat(errorCode(DynamicDataSourceFacade::transaction, placeOrderBatch(999, 1))) + .isEqualTo("UPDATE_COUNT_MISMATCH"); + assertThat(orderCount()).isZero(); + assertThat(stock()).isEqualTo(20); + } + + @Test + void sessionTransactionSpansCallerThreads() throws Exception { + // 模拟宿主语言的线程池:begin、每条语句与 commit 都可能落在不同的线程上 + try (var callers = Executors.newFixedThreadPool(3)) { + var txId = callers.submit(AbstractDynamicDataSourceFacadeTest::begin).get(); + var select = + statement( + "product", + "select price, stock from product where id = ? for update", + 1); + var product = callers.submit(() -> txExecute(txId, select)).get().path("rows").get(0); + assertThat(product.path("stock").asLong()).isEqualTo(20); + for (var statement : placeOrderStatements(1, 2)) { + callers.submit(() -> txExecute(txId, statement)).get(); + } + // 提交之前,事务外的连接看不到这些修改 + assertThat(orderCount()).isZero(); + callers.submit( + () -> + ok( + DynamicDataSourceFacade::commitTransaction, + request("txId", txId))) + .get(); + } + assertThat(orderCount()).isEqualTo(1); + assertThat(stock()).isEqualTo(18); + assertThat(balance()).isEqualTo(30.0); + } + + @Test + void sessionTransactionRollsBack() { + var txId = begin(); + placeOrderStatements(1, 2).forEach(statement -> txExecute(txId, statement)); + ok(DynamicDataSourceFacade::rollbackTransaction, request("txId", txId)); + assertThat(orderCount()).isZero(); + assertThat(stock()).isEqualTo(20); + assertThat(balance()).isEqualTo(50.0); + assertThat(errorCode(DynamicDataSourceFacade::commitTransaction, request("txId", txId))) + .isEqualTo("TRANSACTION_NOT_FOUND"); + } + + @Test + void idleSessionTransactionIsRolledBack() throws InterruptedException { + var txId = begin(); + txExecute(txId, placeOrderStatements(1, 1).getFirst()); + Thread.sleep(Duration.ofSeconds(TX_IDLE_TIMEOUT_SECONDS + 3)); + var select = statement("order", "select count(*) c from p_order").put("txId", txId); + assertThat(errorCode(DynamicDataSourceFacade::executeInTransaction, select.toString())) + .isEqualTo("TRANSACTION_NOT_FOUND"); + assertThat(orderCount()).isZero(); + } + + @Test + void rejectsSecondOpen() { + assertThat(errorCode(DynamicDataSourceFacade::open, "{}")).isEqualTo("ALREADY_OPEN"); + } + + /** 与 tx-local-sample 的下单流程相同:写订单、扣库存、扣余额,单价 10。 */ + static List placeOrderStatements(long userId, int amount) { + var totalPrice = 10.0 * amount; + var order = + statement( + "order", + """ + insert into p_order (user_id, product_id, amount, total_price, status) + values (?, ?, ?, ?, ?) + """, + userId, + 1, + amount, + totalPrice, + "SUCCESS"); + var product = + statement("product", "update product set stock = stock - ? where id = ?", amount, 1) + .put("expectUpdateCount", 1); + var account = + statement( + "account", + "update account set balance = balance - ? where id = ?", + totalPrice, + userId) + .put("expectUpdateCount", 1); + return List.of(order, product, account); + } + + static String placeOrderBatch(long userId, int amount) { + var request = Json.MAPPER.createObjectNode(); + request.putArray("statements").addAll(placeOrderStatements(userId, amount)); + return request.toString(); + } + + static ObjectNode statement(String ds, String sql, Object... params) { + var statement = Json.MAPPER.createObjectNode().put("ds", ds).put("sql", sql); + var values = statement.putArray("params"); + for (var param : params) { + values.add(Json.MAPPER.valueToTree(param)); + } + return statement; + } + + static JsonNode execute(String ds, String sql, Object... params) { + return ok(DynamicDataSourceFacade::execute, statement(ds, sql, params).toString()); + } + + static JsonNode rows(String ds, String sql, Object... params) { + return execute(ds, sql, params).path("rows"); + } + + static long orderCount() { + return rows("order", "select count(*) c from p_order").get(0).path("c").asLong(); + } + + static long stock() { + return rows("product", "select stock from product where id = 1") + .get(0) + .path("stock") + .asLong(); + } + + static double balance() { + return rows("account", "select balance from account where id = 1") + .get(0) + .path("balance") + .asDouble(); + } + + static String begin() { + return ok(DynamicDataSourceFacade::beginTransaction, "{}").path("txId").asString(); + } + + static JsonNode txExecute(String txId, ObjectNode statement) { + return ok( + DynamicDataSourceFacade::executeInTransaction, + statement.deepCopy().put("txId", txId).toString()); + } + + /** 只有一个字段的请求,例如 {@code {"txId": "..."}}。 */ + static String request(String field, String value) { + return Json.MAPPER.createObjectNode().put(field, value).toString(); + } + + static JsonNode ok(Operation operation, String request) { + var response = Json.parse(DynamicDataSourceFacade.call(operation, request)); + assertThat(response.path("ok").asBoolean()).as(response.toString()).isTrue(); + return response.path("data"); + } + + static JsonNode error(Operation operation, String request) { + var response = Json.parse(DynamicDataSourceFacade.call(operation, request)); + assertThat(response.path("ok").asBoolean()).as(response.toString()).isFalse(); + return response.path("error"); + } + + static String errorCode(Operation operation, String request) { + return error(operation, request).path("code").asString(); + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/DataSourceConfigTest.java b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/DataSourceConfigTest.java new file mode 100644 index 00000000..08897adc --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/DataSourceConfigTest.java @@ -0,0 +1,80 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.Test; + +class DataSourceConfigTest { + + @Test + void resolvesPlaceholdersFromVariablesThenEnvironmentThenDefaults() { + var config = + DataSourceConfig.parse( + Json.parse( + """ + { + "variables": {"HOST": "db.internal", "PATH": "from-variables"}, + "datasource": { + "master": { + "url": "jdbc:postgresql://${HOST}:${DD_TEST_UNDEFINED_PORT:5432}/ds", + "username": "${PATH}", + "password": "${HOME}" + } + } + } + """)); + var master = config.datasources().get("master"); + assertThat(master.getUrl()).isEqualTo("jdbc:postgresql://db.internal:5432/ds"); + // variables 优先于同名的环境变量 + assertThat(master.getUsername()).isEqualTo("from-variables"); + assertThat(master.getPassword()).isEqualTo(System.getenv("HOME")); + assertThat(config.primary()).isEqualTo("master"); + assertThat(config.strict()).isFalse(); + assertThat(config.randomStrategy()).isFalse(); + assertThat(config.txIdleTimeout()).hasSeconds(30); + } + + @Test + void rejectsUnresolvablePlaceholder() { + assertBadRequest( + """ + {"datasource": {"master": {"url": "${DD_TEST_UNDEFINED}"}}} + """); + } + + @Test + void rejectsInvalidConfiguration() { + assertBadRequest( + """ + {"datasource": {}} + """); + assertBadRequest( + """ + {"strategy": "fastest", "datasource": {"master": {"url": "jdbc:h2:mem:x"}}} + """); + assertBadRequest("[]"); + } + + private static void assertBadRequest(String configuration) { + assertThatThrownBy(() -> DataSourceConfig.parse(Json.parse(configuration))) + .isInstanceOfSatisfying( + FacadeException.class, + e -> assertThat(e.code()).isEqualTo(ErrorCode.BAD_REQUEST)); + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/H2DynamicDataSourceFacadeTest.java b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/H2DynamicDataSourceFacadeTest.java new file mode 100644 index 00000000..6fe2fefd --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/H2DynamicDataSourceFacadeTest.java @@ -0,0 +1,44 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import java.io.IOException; +import java.util.Map; +import org.junit.jupiter.api.BeforeAll; + +class H2DynamicDataSourceFacadeTest extends AbstractDynamicDataSourceFacadeTest { + + @BeforeAll + static void openH2() throws IOException { + open("h2", Map.of()); + } + + @Override + String slave3() { + var json = + """ + { + "name": "slave_3", + "url": "jdbc:h2:mem:ds_slave_3;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": {"schema": "file:%s"} + } + """; + return json.formatted(RESOURCES.resolve("db/user/schema.sql")); + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/PostgreSqlDynamicDataSourceFacadeTest.java b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/PostgreSqlDynamicDataSourceFacadeTest.java new file mode 100644 index 00000000..f6463004 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/java/com/baomidou/samples/ffi/PostgreSqlDynamicDataSourceFacadeTest.java @@ -0,0 +1,74 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.baomidou.samples.ffi; + +import java.io.IOException; +import java.util.Map; +import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.postgresql.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; +import org.testcontainers.utility.MountableFile; + +@Testcontainers +class PostgreSqlDynamicDataSourceFacadeTest extends AbstractDynamicDataSourceFacadeTest { + + /** 与 compose.yaml 相同:initdb 阶段执行 init-databases.sql,为每个数据源建一个数据库。 */ + @Container + static PostgreSQLContainer postgres = + new PostgreSQLContainer(DockerImageName.parse("postgres:18.6-trixie")) + .withCopyFileToContainer( + MountableFile.forHostPath( + RESOURCES.resolve("db/postgresql/init-databases.sql")), + "/docker-entrypoint-initdb.d/init-databases.sql"); + + @BeforeAll + static void openPostgreSql() throws IOException { + open( + "postgresql", + Map.of( + "POSTGRES_HOST", postgres.getHost(), + "POSTGRES_PORT", String.valueOf(port()), + "POSTGRES_USER", postgres.getUsername(), + "POSTGRES_PASSWORD", postgres.getPassword())); + } + + @Override + String slave3() { + var json = + """ + { + "name": "slave_3", + "url": "jdbc:postgresql://%s:%d/ds_slave_3", + "username": "%s", + "password": "%s", + "driverClassName": "org.postgresql.Driver", + "init": {"schema": "file:%s"} + } + """; + return json.formatted( + postgres.getHost(), + port(), + postgres.getUsername(), + postgres.getPassword(), + RESOURCES.resolve("db/user/schema.sql")); + } + + private static int port() { + return postgres.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT); + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/config/h2.json b/polyglot/dynamic-datasource-ffi/src/test/resources/config/h2.json new file mode 100644 index 00000000..8f1ba376 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/config/h2.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:h2:mem:ds_master;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:h2:mem:ds_slave_1;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:h2:mem:ds_slave_2;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:h2:mem:ds_order;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:h2:mem:ds_product;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:h2:mem:ds_account;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/config/postgresql.json b/polyglot/dynamic-datasource-ffi/src/test/resources/config/postgresql.json new file mode 100644 index 00000000..17dc5d6c --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/config/postgresql.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_master", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_1", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_2", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_order", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_product", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_account", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-account.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-account.sql new file mode 100644 index 00000000..f4542f38 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-account.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:余额 50 +INSERT INTO account (id, balance) VALUES (1, 50); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-product.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-product.sql new file mode 100644 index 00000000..29e2c949 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/data-product.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:单价 10,库存 20 +INSERT INTO product (id, price, stock) VALUES (1, 10, 20); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-account.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-account.sql new file mode 100644 index 00000000..e57a9a0c --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-account.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS account; +CREATE TABLE account +( + id BIGINT PRIMARY KEY, + balance DOUBLE PRECISION NOT NULL, + -- 余额不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_account_balance CHECK (balance >= 0) +); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-order.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-order.sql new file mode 100644 index 00000000..162129d7 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-order.sql @@ -0,0 +1,27 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS p_order; +CREATE TABLE p_order +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + user_id BIGINT NOT NULL, + product_id BIGINT NOT NULL, + amount INT NOT NULL, + total_price DOUBLE PRECISION, + status VARCHAR(16) NOT NULL, + add_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-product.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-product.sql new file mode 100644 index 00000000..c00a5370 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/order/schema-product.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS product; +CREATE TABLE product +( + id BIGINT PRIMARY KEY, + price DOUBLE PRECISION NOT NULL, + stock INT NOT NULL, + -- 库存不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_product_stock CHECK (stock >= 0) +); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/postgresql/init-databases.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/postgresql/init-databases.sql new file mode 100644 index 00000000..06d5ce5d --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/postgresql/init-databases.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- PostgreSQL 变体里每个数据源各用一个数据库,ds_slave_3 留给 POST /datasources 的动态添加演示。 +-- compose.yaml 把本文件挂载到 /docker-entrypoint-initdb.d/,CI 与 JVM 单测也执行同一份脚本。 +CREATE DATABASE ds_master; +CREATE DATABASE ds_slave_1; +CREATE DATABASE ds_slave_2; +CREATE DATABASE ds_slave_3; +CREATE DATABASE ds_order; +CREATE DATABASE ds_product; +CREATE DATABASE ds_account; diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-master.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-master.sql new file mode 100644 index 00000000..f5cb5ac2 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-master.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('master-张三', 18); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_1.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_1.sql new file mode 100644 index 00000000..382c7266 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_1.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_1-张三', 18); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_2.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_2.sql new file mode 100644 index 00000000..98208519 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/data-slave_2.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_2-张三', 18); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/schema.sql b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/schema.sql new file mode 100644 index 00000000..029bc1ff --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/db/user/schema.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- master / slave_1 / slave_2(以及动态添加的 slave_3)共用的表结构,H2 与 PostgreSQL 通用 +DROP TABLE IF EXISTS t_user; +CREATE TABLE t_user +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + name VARCHAR(64) NOT NULL, + age INT +); diff --git a/polyglot/dynamic-datasource-ffi/src/test/resources/simplelogger.properties b/polyglot/dynamic-datasource-ffi/src/test/resources/simplelogger.properties new file mode 100644 index 00000000..e8338b56 --- /dev/null +++ b/polyglot/dynamic-datasource-ffi/src/test/resources/simplelogger.properties @@ -0,0 +1,20 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.log.org.testcontainers=warn +org.slf4j.simpleLogger.log.tc=warn +org.slf4j.simpleLogger.log.com.github.dockerjava=warn diff --git a/polyglot/pom.xml b/polyglot/pom.xml new file mode 100644 index 00000000..bd99da7f --- /dev/null +++ b/polyglot/pom.xml @@ -0,0 +1,174 @@ + + + + 4.0.0 + + + com.baomidou + dynamic-datasource-samples + 1.0.0 + + + polyglot-samples + pom + + + UTF-8 + UTF-8 + + 25 + + 4.1.1 + + 25.3.4.1 + + + + dynamic-datasource-ffi + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot-dependencies.version} + pom + import + + + com.baomidou + dynamic-datasource-spring + ${ds.version} + + + + com.baomidou + dynamic-datasource-native-metadata + ${ds.version} + + + org.graalvm.sdk + nativeimage + ${graalvm-sdk.version} + + + + + + + + + org.graalvm.buildtools + native-maven-plugin + ${native-maven-plugin.version} + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + + + + + com.mycila + license-maven-plugin + + + ** + + + **/*.lock + **/.venv/** + **/__pycache__/** + **/.pytest_cache/** + **/.ruff_cache/** + + + + SLASHSTAR_STYLE + SLASHSTAR_STYLE + SCRIPT_STYLE + SCRIPT_STYLE + SCRIPT_STYLE + SCRIPT_STYLE + + + + + + + + + + native + + + + + org.graalvm.buildtools + native-maven-plugin + + true + + true + + + -march=compatibility + -H:+ReportExceptionStackTraces + + + + + add-reachability-metadata + + add-reachability-metadata + + + + native-compile + package + + compile-no-fork + + + + + + + + + + diff --git a/polyglot/python-fastapi-sample/.python-version b/polyglot/python-fastapi-sample/.python-version new file mode 100644 index 00000000..31555c62 --- /dev/null +++ b/polyglot/python-fastapi-sample/.python-version @@ -0,0 +1,17 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +3.14 diff --git a/polyglot/python-fastapi-sample/app/__init__.py b/polyglot/python-fastapi-sample/app/__init__.py new file mode 100644 index 00000000..37944a69 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/__init__.py @@ -0,0 +1,16 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + diff --git a/polyglot/python-fastapi-sample/app/config.py b/polyglot/python-fastapi-sample/app/config.py new file mode 100644 index 00000000..b024d132 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/config.py @@ -0,0 +1,43 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""本示例自带的数据源配置与 SQL 脚本:项目根目录下的 config/ 与 db/。""" + +from __future__ import annotations + +import json +import os +from pathlib import Path +from typing import Any + +_SOURCE_DIR = Path(__file__).resolve().parents[1] + +# 存放 config/ 与 db/ 的目录:默认是本项目的根目录,也可以用 SAMPLE_DIR 指定 +SAMPLE_DIR = Path(os.environ.get("SAMPLE_DIR") or _SOURCE_DIR).resolve() +DB_DIR = SAMPLE_DIR / "db" +# 默认用 ../dynamic-datasource-ffi 构建出的共享库 +LIBRARY = Path( + os.environ.get("DYNAMIC_DATASOURCE_LIB") + or _SOURCE_DIR.parent / "dynamic-datasource-ffi" / "target" / "libdynamicds.so" +) + + +def load_config(profile: str | None = None, variables: dict[str, str] | None = None) -> dict[str, Any]: + """读取 config/.json(默认取 DD_PROFILE,再默认 h2),并通过 variables 告诉 dd_open 建表脚本的位置。""" + profile = profile or os.environ.get("DD_PROFILE", "h2") + config = json.loads((SAMPLE_DIR / "config" / f"{profile}.json").read_text(encoding="utf-8")) + config["variables"] = {"DB_DIR": str(DB_DIR), **(variables or {})} + return config diff --git a/polyglot/python-fastapi-sample/app/database.py b/polyglot/python-fastapi-sample/app/database.py new file mode 100644 index 00000000..9686b9c9 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/database.py @@ -0,0 +1,30 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""各路由共用的 DynamicDataSource:进程内只有一个,dd_open / dd_close 由 main.py 的 lifespan 负责。""" + +from __future__ import annotations + +from app.config import LIBRARY +from app.dynamic_datasource import DynamicDataSource + +if not LIBRARY.exists(): + raise RuntimeError( + f"{LIBRARY} 不存在:安装本项目(uv sync / uv run)时会用 GraalVM 构建它,请安装 GraalVM 25 并让 JAVA_HOME " + "或 GRAALVM_HOME 指向它;或用 DYNAMIC_DATASOURCE_LIB 指向 libdynamicds.so" + ) + +dd = DynamicDataSource(LIBRARY) diff --git a/polyglot/python-fastapi-sample/app/dynamic_datasource.py b/polyglot/python-fastapi-sample/app/dynamic_datasource.py new file mode 100644 index 00000000..c8109bd2 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/dynamic_datasource.py @@ -0,0 +1,204 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""libdynamicds(dynamic-datasource 的 GraalVM native 共享库)的 ctypes 封装。 + +GraalVM 要求调用入口的 OS 线程已经 attach 到 isolate:每个线程第一次调用时 attach,并缓存在 +``threading.local`` 里。ctypes 调用期间会释放 GIL,FastAPI 线程池里的多个请求可以同时进入 Java 侧。 +""" + +from __future__ import annotations + +import ctypes +import json +import os +import threading +from collections.abc import Iterator, Sequence +from contextlib import contextmanager +from typing import Any + +# 业务函数的统一签名:char* dd_xxx(graal_isolatethread_t* thread, const char* request) +_OPERATIONS = ( + "dd_open", + "dd_close", + "dd_execute", + "dd_transaction", + "dd_add_datasource", + "dd_remove_datasource", + "dd_list_datasources", + "dd_tx_begin", + "dd_tx_execute", + "dd_tx_commit", + "dd_tx_rollback", +) + + +class DynamicDataSourceError(Exception): + """libdynamicds 返回的 ``{"ok": false, "error": {...}}``,``code`` 与 Java 侧的 ErrorCode 一一对应。""" + + def __init__(self, error: dict[str, Any]) -> None: + super().__init__(f"{error['code']}: {error['message']}") + self.code: str = error["code"] + self.message: str = error["message"] + self.sql_state: str | None = error.get("sqlState") + + +class _Library: + """加载共享库并创建 isolate;一个进程只需要一个实例。""" + + def __init__(self, path: str) -> None: + lib = ctypes.CDLL(path) + lib.dd_create_isolate.argtypes = [] + lib.dd_create_isolate.restype = ctypes.c_void_p + lib.dd_get_isolate.argtypes = [ctypes.c_void_p] + lib.dd_get_isolate.restype = ctypes.c_void_p + lib.dd_attach_thread.argtypes = [ctypes.c_void_p] + lib.dd_attach_thread.restype = ctypes.c_void_p + for name in _OPERATIONS: + function = getattr(lib, name) + function.argtypes = [ctypes.c_void_p, ctypes.c_char_p] + # 声明成 c_void_p 而不是 c_char_p:要拿到原始指针才能交还给 dd_free + function.restype = ctypes.c_void_p + lib.dd_free.argtypes = [ctypes.c_void_p, ctypes.c_void_p] + lib.dd_free.restype = None + self._lib = lib + self._local = threading.local() + # 创建 isolate 的线程随之 attach + self._local.thread = lib.dd_create_isolate() + self._isolate = lib.dd_get_isolate(self._local.thread) + + def _thread(self) -> int: + thread = getattr(self._local, "thread", None) + if thread is None: + thread = self._local.thread = self._lib.dd_attach_thread(self._isolate) + return thread + + def call(self, operation: str, request: dict[str, Any]) -> Any: + thread = self._thread() + pointer = getattr(self._lib, operation)(thread, json.dumps(request, ensure_ascii=False).encode()) + try: + response = json.loads(ctypes.string_at(pointer).decode()) + finally: + self._lib.dd_free(thread, pointer) + if not response["ok"]: + raise DynamicDataSourceError(response["error"]) + return response["data"] + + +_library: _Library | None = None +_library_lock = threading.Lock() + + +def _load(path: str) -> _Library: + global _library + with _library_lock: + if _library is None: + _library = _Library(path) + return _library + + +def statement( + sql: str, + params: Sequence[Any] = (), + *, + ds: str | None = None, + generated_keys: Sequence[str] | None = None, + expect_update_count: int | None = None, +) -> dict[str, Any]: + """一条语句的请求;``ds`` 为空时走 primary,相当于不标 ``@DS`` 的方法。""" + request: dict[str, Any] = {"sql": sql, "params": list(params)} + if ds is not None: + request["ds"] = ds + if generated_keys: + request["generatedKeys"] = list(generated_keys) + if expect_update_count is not None: + request["expectUpdateCount"] = expect_update_count + return request + + +def first_row(result: dict[str, Any]) -> dict[str, Any] | None: + """查询结果 ``{"datasource","rows"}`` 的第一行。""" + rows = result["rows"] + return rows[0] if rows else None + + +class Transaction: + """会话式事务。语句可以从任意线程发出,Java 侧会交给该事务独占的线程执行。""" + + def __init__(self, library: _Library, tx_id: str) -> None: + self._library = library + self.id = tx_id + + def execute(self, sql: str, params: Sequence[Any] = (), **options: Any) -> dict[str, Any]: + """dd_tx_execute,参数与 :meth:`DynamicDataSource.execute` 相同。""" + return self._library.call("dd_tx_execute", {"txId": self.id, **statement(sql, params, **options)}) + + def commit(self) -> None: + self._library.call("dd_tx_commit", {"txId": self.id}) + + def rollback(self) -> None: + self._library.call("dd_tx_rollback", {"txId": self.id}) + + +class DynamicDataSource: + """进程内唯一的 DynamicRoutingDataSource;所有方法都是阻塞调用,适合在 FastAPI 的同步路由里使用。""" + + def __init__(self, library_path: str | os.PathLike[str]) -> None: + self._library = _load(os.fspath(library_path)) + + def open(self, config: dict[str, Any]) -> dict[str, Any]: + """dd_open:config 的字段与 ``spring.datasource.dynamic.*`` 同名,返回当前的数据源与分组。""" + return self._library.call("dd_open", config) + + def close(self) -> None: + """dd_close:回滚未结束的会话式事务并关闭所有连接池。""" + self._library.call("dd_close", {}) + + def execute(self, sql: str, params: Sequence[Any] = (), **options: Any) -> dict[str, Any]: + """dd_execute:在 ``ds`` 指定的数据源或分组上执行一条语句,相当于调用一个 ``@DS(ds)`` 方法。""" + return self._library.call("dd_execute", statement(sql, params, **options)) + + def transaction(self, statements: Sequence[dict[str, Any]]) -> dict[str, Any]: + """dd_transaction:一次调用内把一批语句(用 :func:`statement` 构造)放进同一个本地事务。""" + return self._library.call("dd_transaction", {"statements": list(statements)}) + + def add_datasource(self, name: str, **property: Any) -> dict[str, Any]: + return self._library.call("dd_add_datasource", {"name": name, **property}) + + def remove_datasource(self, name: str) -> dict[str, Any]: + return self._library.call("dd_remove_datasource", {"name": name}) + + def list_datasources(self) -> dict[str, Any]: + return self._library.call("dd_list_datasources", {}) + + def begin(self) -> Transaction: + """dd_tx_begin:开启跨多次调用的会话式事务。""" + return Transaction(self._library, self._library.call("dd_tx_begin", {})["txId"]) + + @contextmanager + def transactional(self) -> Iterator[Transaction]: + """相当于 ``@DSTransactional``:with 块正常结束时提交,抛出异常时回滚。""" + transaction = self.begin() + try: + yield transaction + except BaseException: + try: + transaction.rollback() + except DynamicDataSourceError: + # 回滚失败时还有 Java 侧的空闲超时兜底,这里保留业务异常本身 + pass + raise + transaction.commit() diff --git a/polyglot/python-fastapi-sample/app/errors.py b/polyglot/python-fastapi-sample/app/errors.py new file mode 100644 index 00000000..ca22ef57 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/errors.py @@ -0,0 +1,53 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""错误响应 ``{"code","message"}``,三个示例的错误码一致;相当于 tx-local-sample 的 GlobalExceptionHandler。""" + +from __future__ import annotations + +from fastapi import Request +from fastapi.responses import JSONResponse + +from app.dynamic_datasource import DynamicDataSourceError + +# dynamic-datasource 的错误码到 HTTP 状态码,其余一律 500 +_STATUSES = {"BAD_REQUEST": 400, "DATASOURCE_NOT_FOUND": 404, "CONSTRAINT_VIOLATION": 409, "UPDATE_COUNT_MISMATCH": 409} + + +class ApiError(Exception): + def __init__(self, status: int, code: str, message: str) -> None: + super().__init__(message) + self.status = status + self.code = code + self.message = message + + @classmethod + def of(cls, error: DynamicDataSourceError) -> ApiError: + message = error.message.lower() + # 批量事务里库存、余额不足由 CHECK 约束兜底,按约束名还原成与会话式事务相同的业务错误 + if error.code == "CONSTRAINT_VIOLATION" and "ck_product_stock" in message: + return cls(409, "INSUFFICIENT_STOCK", "库存不足") + if error.code == "CONSTRAINT_VIOLATION" and "ck_account_balance" in message: + return cls(409, "INSUFFICIENT_BALANCE", "余额不足") + return cls(_STATUSES.get(error.code, 500), error.code, error.message) + + +async def handle_api_error(_: Request, error: ApiError) -> JSONResponse: + return JSONResponse({"code": error.code, "message": error.message}, status_code=error.status) + + +async def handle_dynamic_datasource_error(request: Request, error: DynamicDataSourceError) -> JSONResponse: + return await handle_api_error(request, ApiError.of(error)) diff --git a/polyglot/python-fastapi-sample/app/main.py b/polyglot/python-fastapi-sample/app/main.py new file mode 100644 index 00000000..aa8e60da --- /dev/null +++ b/polyglot/python-fastapi-sample/app/main.py @@ -0,0 +1,61 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""在 FastAPI 里使用 dynamic-datasource,接口与 rust-axum-sample、typescript-hono-sample 一致,约定见 ../README.md。 + +按 FastAPI 文档的 Bigger Applications 组织:每个资源一个 APIRouter,放在 app/routers/ 下,这里负责组装。 +路由都是同步 ``def``:FastAPI 把它们放进线程池执行,阻塞的 libdynamicds 调用不会卡住事件循环。 +""" + +from __future__ import annotations + +import json +from collections.abc import AsyncIterator +from contextlib import asynccontextmanager +from typing import Any + +from fastapi import FastAPI +from fastapi.concurrency import run_in_threadpool + +from app.config import load_config +from app.database import dd +from app.dynamic_datasource import DynamicDataSourceError +from app.errors import ApiError, handle_api_error, handle_dynamic_datasource_error +from app.routers import accounts, datasources, orders, products, users + + +def create_app(config: dict[str, Any] | None = None) -> FastAPI: + """启动时用 config(默认 load_config())dd_open,关闭时 dd_close;测试里传入 Testcontainers 的连接信息。""" + + @asynccontextmanager + async def lifespan(_: FastAPI) -> AsyncIterator[None]: + described = await run_in_threadpool(dd.open, config if config is not None else load_config()) + print("dynamic-datasource is open:", json.dumps(described, ensure_ascii=False)) + yield + await run_in_threadpool(dd.close) + + app = FastAPI(title="python-fastapi-sample", lifespan=lifespan) + app.include_router(users.router) + app.include_router(datasources.router) + app.include_router(orders.router) + app.include_router(products.router) + app.include_router(accounts.router) + app.add_exception_handler(ApiError, handle_api_error) + app.add_exception_handler(DynamicDataSourceError, handle_dynamic_datasource_error) + return app + + +app = create_app() diff --git a/polyglot/python-fastapi-sample/app/routers/__init__.py b/polyglot/python-fastapi-sample/app/routers/__init__.py new file mode 100644 index 00000000..37944a69 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/__init__.py @@ -0,0 +1,16 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + diff --git a/polyglot/python-fastapi-sample/app/routers/accounts.py b/polyglot/python-fastapi-sample/app/routers/accounts.py new file mode 100644 index 00000000..d2c7113f --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/accounts.py @@ -0,0 +1,47 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""/accounts,以及下单时扣减余额,对应 tx-local-sample 的 AccountService。""" + +from __future__ import annotations + +from typing import Any + +from fastapi import APIRouter + +from app.database import dd +from app.dynamic_datasource import Transaction, first_row +from app.errors import ApiError + +router = APIRouter(tags=["accounts"]) + + +@router.get("/accounts/{account_id}") +def get_account(account_id: int) -> dict[str, Any]: + account = first_row(dd.execute("select id, balance from account where id = ?", [account_id], ds="account")) + if account is None: + raise ApiError(404, "ACCOUNT_NOT_FOUND", "用户不存在") + return account + + +def reduce_balance(tx: Transaction, user_id: int, total_price: float) -> None: + """对应 ``AccountService#reduceBalance``:检查并扣减余额。""" + account = first_row(tx.execute("select balance from account where id = ? for update", [user_id], ds="account")) + if account is None: + raise ApiError(404, "ACCOUNT_NOT_FOUND", "用户不存在") + if account["balance"] < total_price: + raise ApiError(409, "INSUFFICIENT_BALANCE", "余额不足") + tx.execute("update account set balance = balance - ? where id = ?", [total_price, user_id], ds="account") diff --git a/polyglot/python-fastapi-sample/app/routers/datasources.py b/polyglot/python-fastapi-sample/app/routers/datasources.py new file mode 100644 index 00000000..6cef74ba --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/datasources.py @@ -0,0 +1,65 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""/datasources:运行时增删数据源,对应 add-remove-datasource-sample。""" + +from __future__ import annotations + +from typing import Any + +from fastapi import APIRouter +from pydantic import BaseModel + +from app.config import DB_DIR +from app.database import dd + +router = APIRouter(tags=["datasources"]) + + +@router.get("/datasources") +def list_datasources() -> dict[str, Any]: + """当前的数据源与分组。""" + return dd.list_datasources() + + +class NewDatasource(BaseModel): + name: str + url: str + username: str | None = None + password: str | None = None + driver_class_name: str | None = None + + +@router.post("/datasources", status_code=201) +def add_datasource(datasource: NewDatasource) -> dict[str, Any]: + """名称带下划线时自动入组(slave_3 → slave)。 + + 新从库沿用 t_user 的建表脚本:脚本路径由服务端决定,不接受客户端传入。 + """ + return dd.add_datasource( + datasource.name, + url=datasource.url, + username=datasource.username, + password=datasource.password, + driverClassName=datasource.driver_class_name, + init={"schema": f"file:{DB_DIR / 'user' / 'schema.sql'}"}, + ) + + +@router.delete("/datasources/{name}") +def remove_datasource(name: str) -> dict[str, Any]: + """删除数据源并关闭它的连接池,primary 不能删除。""" + return dd.remove_datasource(name) diff --git a/polyglot/python-fastapi-sample/app/routers/orders.py b/polyglot/python-fastapi-sample/app/routers/orders.py new file mode 100644 index 00000000..45b8266c --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/orders.py @@ -0,0 +1,113 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""/orders:多数据源本地事务,对应 tx-local-sample 的 OrderController 与 OrderService。""" + +from __future__ import annotations + +from typing import Any + +from fastapi import APIRouter +from pydantic import BaseModel + +from app.database import dd +from app.dynamic_datasource import first_row, statement +from app.errors import ApiError +from app.routers.accounts import reduce_balance +from app.routers.products import reduce_stock + +router = APIRouter(tags=["orders"]) + + +class PlaceOrder(BaseModel): + user_id: int + product_id: int + amount: int + + +def check_amount(order: PlaceOrder) -> None: + if order.amount <= 0: + raise ApiError(400, "BAD_REQUEST", "amount 必须大于 0") + + +def placed(order_id: Any, order: PlaceOrder, total_price: float) -> dict[str, Any]: + return {**order.model_dump(), "id": order_id, "total_price": total_price, "status": "SUCCESS"} + + +@router.post("/orders", status_code=201) +def place_order(order: PlaceOrder) -> dict[str, Any]: + """与 ``OrderService#placeOrder`` 逐行对应。 + + 一个会话式事务跨 order、product、account 三个库,任何一步失败都整体回滚。 + """ + check_amount(order) + with dd.transactional() as tx: + inserted = tx.execute( + "insert into p_order (user_id, product_id, amount, status) values (?, ?, ?, 'INIT')", + [order.user_id, order.product_id, order.amount], + ds="order", + generated_keys=["id"], + ) + order_id = inserted["generatedKeys"][0]["id"] + total_price = reduce_stock(tx, order.product_id, order.amount) + reduce_balance(tx, order.user_id, total_price) + tx.execute( + "update p_order set status = 'SUCCESS', total_price = ? where id = ?", [total_price, order_id], ds="order" + ) + return placed(order_id, order, total_price) + + +@router.post("/orders/batch", status_code=201) +def place_order_batch(order: PlaceOrder) -> dict[str, Any]: + """先在事务外读单价,再把三条写语句一次交给 dd_transaction。 + + 库存、余额不足由 CHECK 约束兜底;单价在下单期间被改过则 expectUpdateCount 不满足,同样整体回滚。 + """ + check_amount(order) + product = first_row(dd.execute("select price from product where id = ?", [order.product_id], ds="product")) + if product is None: + raise ApiError(404, "PRODUCT_NOT_FOUND", "商品不存在") + price = product["price"] + total_price = price * order.amount + result = dd.transaction( + [ + statement( + "insert into p_order (user_id, product_id, amount, total_price, status) values (?, ?, ?, ?, 'SUCCESS')", + [order.user_id, order.product_id, order.amount, total_price], + ds="order", + generated_keys=["id"], + ), + statement( + "update product set stock = stock - ? where id = ? and price = ?", + [order.amount, order.product_id, price], + ds="product", + expect_update_count=1, + ), + statement( + "update account set balance = balance - ? where id = ?", + [total_price, order.user_id], + ds="account", + expect_update_count=1, + ), + ] + ) + return placed(result["results"][0]["generatedKeys"][0]["id"], order, total_price) + + +@router.get("/orders") +def list_orders() -> list[dict[str, Any]]: + sql = "select id, user_id, product_id, amount, total_price, status from p_order order by id" + return dd.execute(sql, ds="order")["rows"] diff --git a/polyglot/python-fastapi-sample/app/routers/products.py b/polyglot/python-fastapi-sample/app/routers/products.py new file mode 100644 index 00000000..42d77709 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/products.py @@ -0,0 +1,50 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""/products,以及下单时扣减库存,对应 tx-local-sample 的 ProductService。""" + +from __future__ import annotations + +from typing import Any + +from fastapi import APIRouter + +from app.database import dd +from app.dynamic_datasource import Transaction, first_row +from app.errors import ApiError + +router = APIRouter(tags=["products"]) + + +@router.get("/products/{product_id}") +def get_product(product_id: int) -> dict[str, Any]: + product = first_row(dd.execute("select id, price, stock from product where id = ?", [product_id], ds="product")) + if product is None: + raise ApiError(404, "PRODUCT_NOT_FOUND", "商品不存在") + return product + + +def reduce_stock(tx: Transaction, product_id: int, amount: int) -> float: + """对应 ``ProductService#reduceStock``:检查并扣减库存,返回总价。""" + product = first_row( + tx.execute("select price, stock from product where id = ? for update", [product_id], ds="product") + ) + if product is None: + raise ApiError(404, "PRODUCT_NOT_FOUND", "商品不存在") + if product["stock"] < amount: + raise ApiError(409, "INSUFFICIENT_STOCK", "库存不足") + tx.execute("update product set stock = stock - ? where id = ?", [amount, product_id], ds="product") + return product["price"] * amount diff --git a/polyglot/python-fastapi-sample/app/routers/users.py b/polyglot/python-fastapi-sample/app/routers/users.py new file mode 100644 index 00000000..a63e5913 --- /dev/null +++ b/polyglot/python-fastapi-sample/app/routers/users.py @@ -0,0 +1,53 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""/users:读写分离与按请求头切换数据源,对应 jdbc-template-sample 与 spel-sample。""" + +from __future__ import annotations + +from typing import Annotated, Any + +from fastapi import APIRouter, Header, Response +from pydantic import BaseModel + +from app.database import dd + +router = APIRouter(tags=["users"]) + + +@router.get("/users") +def list_users(response: Response, x_datasource: Annotated[str | None, Header()] = None) -> list[dict[str, Any]]: + """默认读 slave 组(相当于 ``@DS("slave")``),请求头 X-Datasource 相当于 spel-sample 的 ``@DS("#header.xxx")``。""" + result = dd.execute("select id, name, age from t_user order by id", ds=x_datasource or "slave") + response.headers["X-Datasource-Served"] = result["datasource"] + return result["rows"] + + +class NewUser(BaseModel): + name: str + age: int | None = None + + +@router.post("/users", status_code=201) +def create_user(user: NewUser) -> dict[str, Any]: + """不指定数据源时写 primary,也就是 master。""" + result = dd.execute("insert into t_user (name, age) values (?, ?)", [user.name, user.age], generated_keys=["id"]) + return { + "id": result["generatedKeys"][0]["id"], + "name": user.name, + "age": user.age, + "datasource": result["datasource"], + } diff --git a/polyglot/python-fastapi-sample/config/h2.json b/polyglot/python-fastapi-sample/config/h2.json new file mode 100644 index 00000000..8f1ba376 --- /dev/null +++ b/polyglot/python-fastapi-sample/config/h2.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:h2:mem:ds_master;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:h2:mem:ds_slave_1;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:h2:mem:ds_slave_2;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:h2:mem:ds_order;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:h2:mem:ds_product;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:h2:mem:ds_account;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/python-fastapi-sample/config/postgresql.json b/polyglot/python-fastapi-sample/config/postgresql.json new file mode 100644 index 00000000..17dc5d6c --- /dev/null +++ b/polyglot/python-fastapi-sample/config/postgresql.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_master", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_1", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_2", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_order", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_product", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_account", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/python-fastapi-sample/db/order/data-account.sql b/polyglot/python-fastapi-sample/db/order/data-account.sql new file mode 100644 index 00000000..f4542f38 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/order/data-account.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:余额 50 +INSERT INTO account (id, balance) VALUES (1, 50); diff --git a/polyglot/python-fastapi-sample/db/order/data-product.sql b/polyglot/python-fastapi-sample/db/order/data-product.sql new file mode 100644 index 00000000..29e2c949 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/order/data-product.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:单价 10,库存 20 +INSERT INTO product (id, price, stock) VALUES (1, 10, 20); diff --git a/polyglot/python-fastapi-sample/db/order/schema-account.sql b/polyglot/python-fastapi-sample/db/order/schema-account.sql new file mode 100644 index 00000000..e57a9a0c --- /dev/null +++ b/polyglot/python-fastapi-sample/db/order/schema-account.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS account; +CREATE TABLE account +( + id BIGINT PRIMARY KEY, + balance DOUBLE PRECISION NOT NULL, + -- 余额不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_account_balance CHECK (balance >= 0) +); diff --git a/polyglot/python-fastapi-sample/db/order/schema-order.sql b/polyglot/python-fastapi-sample/db/order/schema-order.sql new file mode 100644 index 00000000..162129d7 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/order/schema-order.sql @@ -0,0 +1,27 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS p_order; +CREATE TABLE p_order +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + user_id BIGINT NOT NULL, + product_id BIGINT NOT NULL, + amount INT NOT NULL, + total_price DOUBLE PRECISION, + status VARCHAR(16) NOT NULL, + add_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/polyglot/python-fastapi-sample/db/order/schema-product.sql b/polyglot/python-fastapi-sample/db/order/schema-product.sql new file mode 100644 index 00000000..c00a5370 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/order/schema-product.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS product; +CREATE TABLE product +( + id BIGINT PRIMARY KEY, + price DOUBLE PRECISION NOT NULL, + stock INT NOT NULL, + -- 库存不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_product_stock CHECK (stock >= 0) +); diff --git a/polyglot/python-fastapi-sample/db/postgresql/init-databases.sql b/polyglot/python-fastapi-sample/db/postgresql/init-databases.sql new file mode 100644 index 00000000..06d5ce5d --- /dev/null +++ b/polyglot/python-fastapi-sample/db/postgresql/init-databases.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- PostgreSQL 变体里每个数据源各用一个数据库,ds_slave_3 留给 POST /datasources 的动态添加演示。 +-- compose.yaml 把本文件挂载到 /docker-entrypoint-initdb.d/,CI 与 JVM 单测也执行同一份脚本。 +CREATE DATABASE ds_master; +CREATE DATABASE ds_slave_1; +CREATE DATABASE ds_slave_2; +CREATE DATABASE ds_slave_3; +CREATE DATABASE ds_order; +CREATE DATABASE ds_product; +CREATE DATABASE ds_account; diff --git a/polyglot/python-fastapi-sample/db/user/data-master.sql b/polyglot/python-fastapi-sample/db/user/data-master.sql new file mode 100644 index 00000000..f5cb5ac2 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/user/data-master.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('master-张三', 18); diff --git a/polyglot/python-fastapi-sample/db/user/data-slave_1.sql b/polyglot/python-fastapi-sample/db/user/data-slave_1.sql new file mode 100644 index 00000000..382c7266 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/user/data-slave_1.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_1-张三', 18); diff --git a/polyglot/python-fastapi-sample/db/user/data-slave_2.sql b/polyglot/python-fastapi-sample/db/user/data-slave_2.sql new file mode 100644 index 00000000..98208519 --- /dev/null +++ b/polyglot/python-fastapi-sample/db/user/data-slave_2.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_2-张三', 18); diff --git a/polyglot/python-fastapi-sample/db/user/schema.sql b/polyglot/python-fastapi-sample/db/user/schema.sql new file mode 100644 index 00000000..029bc1ff --- /dev/null +++ b/polyglot/python-fastapi-sample/db/user/schema.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- master / slave_1 / slave_2(以及动态添加的 slave_3)共用的表结构,H2 与 PostgreSQL 通用 +DROP TABLE IF EXISTS t_user; +CREATE TABLE t_user +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + name VARCHAR(64) NOT NULL, + age INT +); diff --git a/polyglot/python-fastapi-sample/hatch_build.py b/polyglot/python-fastapi-sample/hatch_build.py new file mode 100644 index 00000000..1608a98a --- /dev/null +++ b/polyglot/python-fastapi-sample/hatch_build.py @@ -0,0 +1,37 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""安装本项目时(包括 uv sync、uv run 自动完成的可编辑安装)按需构建 libdynamicds。 + +共享库已是最新时 ``build-libdynamicds.sh`` 什么也不做;用 DYNAMIC_DATASOURCE_LIB 指定了现成的共享库时不构建。 +""" + +from __future__ import annotations + +import os +import subprocess +from pathlib import Path +from typing import Any + +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class LibDynamicDsBuildHook(BuildHookInterface): + def initialize(self, version: str, build_data: dict[str, Any]) -> None: + if os.environ.get("DYNAMIC_DATASOURCE_LIB"): + return + script = Path(self.root).parent / "build-libdynamicds.sh" + subprocess.run(["sh", str(script)], check=True) diff --git a/polyglot/python-fastapi-sample/pyproject.toml b/polyglot/python-fastapi-sample/pyproject.toml new file mode 100644 index 00000000..68f752af --- /dev/null +++ b/polyglot/python-fastapi-sample/pyproject.toml @@ -0,0 +1,68 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[project] +name = "python-fastapi-sample" +version = "1.0.0" +description = "在 FastAPI 里通过 libdynamicds 使用 dynamic-datasource" +license = "Apache-2.0" +requires-python = ">=3.11" +dependencies = [ + "fastapi>=0.143.3", + "uvicorn>=0.54.0", +] + +[dependency-groups] +dev = [ + "httpx2>=2.13.1", + "pytest>=9.1.1", + "ruff>=0.17.1", + "testcontainers>=4.15.0", +] + +[build-system] +requires = ["hatchling>=1.32.4"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["app"] + +# hatch_build.py:安装本项目时(包括 uv sync、uv run 自动完成的可编辑安装)按需构建 libdynamicds +[tool.hatch.build.targets.wheel.hooks.custom] + +[tool.uv] +# 这些文件变化时 uv 重新安装本项目,Java 源码或 pom 改动后共享库随之重新构建 +cache-keys = [ + { file = "pyproject.toml" }, + { file = "hatch_build.py" }, + { file = "../build-libdynamicds.sh" }, + { file = "../dynamic-datasource-ffi/src/main/**" }, + { file = "../dynamic-datasource-ffi/pom.xml" }, + { file = "../dynamic-datasource-ffi/target/libdynamicds.so" }, + { file = "../pom.xml" }, + { file = "../../pom.xml" }, +] + +[tool.pytest.ini_options] +pythonpath = ["."] +testpaths = ["tests"] + +[tool.ruff] +line-length = 120 +target-version = "py311" + +[tool.ruff.lint] +select = ["E", "F", "I", "UP", "B"] diff --git a/polyglot/python-fastapi-sample/tests/test_api.py b/polyglot/python-fastapi-sample/tests/test_api.py new file mode 100644 index 00000000..7154f4b2 --- /dev/null +++ b/polyglot/python-fastapi-sample/tests/test_api.py @@ -0,0 +1,150 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""与 rust-axum-sample、typescript-hono-sample 相同的一组场景,分别跑在 H2 与 Testcontainers 启动的 PostgreSQL 上。 + +isolate 与 dd_open 都是进程级单例,两个测试依次打开、关闭各自的 DynamicRoutingDataSource。 +""" + +from __future__ import annotations + +from concurrent.futures import ThreadPoolExecutor +from typing import Any + +from fastapi.testclient import TestClient +from httpx2 import Response +from testcontainers.community.postgres import PostgresContainer + +from app.config import SAMPLE_DIR, load_config +from app.main import create_app + + +def test_h2() -> None: + slave_3 = { + "name": "slave_3", + "url": "jdbc:h2:mem:ds_slave_3;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driver_class_name": "org.h2.Driver", + } + run_scenarios(load_config("h2"), slave_3) + + +def test_postgresql() -> None: + # 与 compose.yaml 一样,initdb 阶段执行 init-databases.sql,为每个数据源建一个数据库 + postgres = PostgresContainer("postgres:18.6-trixie", username="postgres", password="postgres") + postgres.with_copy_into_container( + SAMPLE_DIR / "db" / "postgresql" / "init-databases.sql", "/docker-entrypoint-initdb.d/init-databases.sql" + ) + with postgres: + host = postgres.get_container_host_ip() + port = str(postgres.get_exposed_port(5432)) + variables = { + "POSTGRES_HOST": host, + "POSTGRES_PORT": port, + "POSTGRES_USER": "postgres", + "POSTGRES_PASSWORD": "postgres", + } + slave_3 = { + "name": "slave_3", + "url": f"jdbc:postgresql://{host}:{port}/ds_slave_3", + "username": "postgres", + "password": "postgres", + "driver_class_name": "org.postgresql.Driver", + } + run_scenarios(load_config("postgresql", variables), slave_3) + + +def order(product_id: int, amount: int) -> dict[str, int]: + return {"user_id": 1, "product_id": product_id, "amount": amount} + + +def names(response: Response) -> list[str]: + return [user["name"] for user in response.json()] + + +def assert_order_state(client: TestClient, orders: int, stock: int, balance: float) -> None: + assert len(client.get("/orders").json()) == orders + assert client.get("/products/1").json()["stock"] == stock + assert client.get("/accounts/1").json()["balance"] == balance + + +def run_scenarios(config: dict[str, Any], slave_3: dict[str, Any]) -> None: + """动态添加的 slave_3 由调用方给出,因为它的连接信息随数据库不同。""" + # 进入时触发 lifespan 里的 dd_open,退出时 dd_close + with TestClient(create_app(config)) as client: + # 读请求默认走 slave 组,两次请求轮询到两个成员 + served = set() + for _ in range(2): + response = client.get("/users") + assert response.status_code == 200 + datasource = response.headers["X-Datasource-Served"] + assert response.json()[0]["name"] == f"{datasource}-张三" + served.add(datasource) + assert served == {"slave_1", "slave_2"} + + # 请求头指定数据源;strict 模式下未知数据源直接报错 + response = client.get("/users", headers={"X-Datasource": "master"}) + assert response.headers["X-Datasource-Served"] == "master" + assert response.json()[0]["name"] == "master-张三" + response = client.get("/users", headers={"X-Datasource": "nope"}) + assert response.status_code == 404 + assert response.json()["code"] == "DATASOURCE_NOT_FOUND" + + # 写请求走 primary + response = client.post("/users", json={"name": "李四", "age": 20}) + assert response.status_code == 201 + assert response.json()["datasource"] == "master" + assert isinstance(response.json()["id"], int) + assert "李四" in names(client.get("/users", headers={"X-Datasource": "master"})) + assert "李四" not in names(client.get("/users", headers={"X-Datasource": "slave_1"})) + + # 运行时增删数据源,slave_3 自动进入 slave 组 + response = client.post("/datasources", json=slave_3) + assert response.status_code == 201, response.text + assert response.json()["groups"]["slave"] == ["slave_1", "slave_2", "slave_3"] + assert len({client.get("/users").headers["X-Datasource-Served"] for _ in range(3)}) == 3 + response = client.delete("/datasources/slave_3") + assert response.status_code == 200 + assert response.json()["groups"]["slave"] == ["slave_1", "slave_2"] + assert client.delete("/datasources/master").status_code == 400 + + # 会话式事务下单:与 tx-local-sample 相同的流程,失败时三个库一起回滚 + response = client.post("/orders", json=order(1, 1)) + assert response.status_code == 201, response.text + assert response.json()["total_price"] == 10.0 + assert_order_state(client, 1, 19, 40.0) + response = client.post("/orders", json=order(1, 6)) + assert response.status_code == 409 + assert response.json()["code"] == "INSUFFICIENT_BALANCE" + assert client.post("/orders", json=order(1, 30)).json()["code"] == "INSUFFICIENT_STOCK" + assert client.post("/orders", json=order(999, 1)).status_code == 404 + assert_order_state(client, 1, 19, 40.0) + + # 批量事务下单:一次 dd_transaction,CHECK 约束兜底 + response = client.post("/orders/batch", json=order(1, 1)) + assert response.status_code == 201, response.text + assert_order_state(client, 2, 18, 30.0) + response = client.post("/orders/batch", json=order(1, 6)) + assert response.status_code == 409 + assert response.json()["code"] == "INSUFFICIENT_BALANCE" + assert client.post("/orders/batch", json=order(1, 30)).json()["code"] == "INSUFFICIENT_STOCK" + assert_order_state(client, 2, 18, 30.0) + + # 并发请求落在 FastAPI 线程池的多个线程上,各自 attach 到 isolate + with ThreadPoolExecutor(max_workers=8) as pool: + statuses = list(pool.map(lambda _: client.get("/users").status_code, range(20))) + assert statuses == [200] * 20 diff --git a/polyglot/python-fastapi-sample/uv.lock b/polyglot/python-fastapi-sample/uv.lock new file mode 100644 index 00000000..7a80f4aa --- /dev/null +++ b/polyglot/python-fastapi-sample/uv.lock @@ -0,0 +1,781 @@ +version = 1 +revision = 5 +requires-python = ">=3.11" +resolution-markers = [ + "python_full_version >= '3.12' and sys_platform == 'emscripten'", + "python_full_version < '3.12' or sys_platform != 'emscripten'", +] + +[[package]] +name = "annotated-doc" +version = "0.0.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/8e/38aa427ed5402449e226975b649c5dc73ccadfefeb95e6aecb8f8ea4b6b6/annotated_doc-0.0.5.tar.gz", hash = "sha256:c7e58ce09192557605d8bbd92836d7e1d520ac9580096042c0bfd197efacf1bb", size = 10758, upload-time = "2026-07-28T13:50:58.129Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3e/30/e900b21425a860e195f32e37657aa1f7c7f2b1bfb26f03ca209b90933c06/annotated_doc-0.0.5-py3-none-any.whl", hash = "sha256:117bac03a25ede5df5440e855b32d556049ca169ead221505badf432fed4b101", size = 5302, upload-time = "2026-07-28T13:50:57.239Z" }, +] + +[[package]] +name = "annotated-types" +version = "0.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" }, +] + +[[package]] +name = "anyio" +version = "4.15.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "typing-extensions", marker = "python_full_version < '3.15'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a9/d2/f4d173e22df740bc37b1db102b386ba719b66e95b0f0d751f556b387e6d2/anyio-4.15.1.tar.gz", hash = "sha256:9f28306018cbd6d329e64a36d58256edff76dd996fe423bc957326e578b82a94", size = 276966, upload-time = "2026-09-05T10:42:39.44Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079, upload-time = "2026-09-05T10:42:37.923Z" }, +] + +[[package]] +name = "certifi" +version = "2026.7.22" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a3/c2/24167ea9858356b47a87a50d39908bfdb72ceeefe0041586e704e5376b3a/certifi-2026.7.22.tar.gz", hash = "sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55", size = 138112, upload-time = "2026-07-22T03:35:12.644Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0b/a7/71ac2cff56fec219ed242bb11b8efb69fcc4bec75db06fb7bfe35de520e6/certifi-2026.7.22-py3-none-any.whl", hash = "sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775", size = 136983, upload-time = "2026-07-22T03:35:11.276Z" }, +] + +[[package]] +name = "charset-normalizer" +version = "3.5.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/33/1c/f41d4e74c28ab327ff3acd36053f7ea506c55872d7a90b0fa71aa3ab0c89/charset_normalizer-3.5.2.tar.gz", hash = "sha256:39de2a259fc954455c57274dc94c79d5842774e1247a016aff30bc0efed0f4ef", size = 172659, upload-time = "2026-09-30T04:39:23.398Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/22/67/6a0b94a7960d5e1b5eacd2fb529f3fccc47db4644f7f0a7cfdcfc3be578a/charset_normalizer-3.5.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3d21b8b13c7592db2ac5e544a6d83187b995257472b0c9e8351b6d507ae37ed6", size = 370642, upload-time = "2026-09-30T04:35:06.91Z" }, + { url = "https://files.pythonhosted.org/packages/fb/94/01009e13b94041599004edf32e56e382c24e570f60f79bab8efe45cfe1eb/charset_normalizer-3.5.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d760fe2a4d7c3b226cb9026d6a842868d52a7901bd98420e1baf14e80da85cf5", size = 259280, upload-time = "2026-09-30T04:35:08.448Z" }, + { url = "https://files.pythonhosted.org/packages/66/85/3b5358f60a13210f0b67d3755c168ef758701b021e655d88d4da28554467/charset_normalizer-3.5.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c9790464842f85f437dbbb54417eda1e0e6bfc52dd8d22d6fd1c994b73b2dc74", size = 245335, upload-time = "2026-09-30T04:35:10.104Z" }, + { url = "https://files.pythonhosted.org/packages/74/75/77c1c479b09ecd751d1e767b251ea5c14d4d50ff757bf404afab2692f600/charset_normalizer-3.5.2-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4685902cf26edf013ed7a3da0f426ebba7a00ebb9541386d835afbf002c11cab", size = 291707, upload-time = "2026-09-30T04:35:11.575Z" }, + { url = "https://files.pythonhosted.org/packages/0b/0d/363f78cacb70f58f15f4b083961bbd9d292f335d3f5c66fc4f1cfe69cb90/charset_normalizer-3.5.2-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4495c5002a7b28557e7e222e77e0b661183e432b7d6d2e788101e3f240e05b8c", size = 286747, upload-time = "2026-09-30T04:35:13.022Z" }, + { url = "https://files.pythonhosted.org/packages/e4/ed/cf505d3011ffceb12c2067a7a5d3cfe92b875d4d44bb0ff0d69375e2c184/charset_normalizer-3.5.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:211d5a3eb6af8f513b8d4ca19a8c1b7accab1b5f0d3175f9826b03c1a920dc1f", size = 269972, upload-time = "2026-09-30T04:35:14.606Z" }, + { url = "https://files.pythonhosted.org/packages/15/d8/f0a93a431d170e7ca681d4f6650fee3de934d18560e474e7267eb4b0f987/charset_normalizer-3.5.2-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef4fcbf3327382cd4c9f540babd61248208af7b93eec4de397b4d5f58a09e288", size = 269339, upload-time = "2026-09-30T04:35:16.087Z" }, + { url = "https://files.pythonhosted.org/packages/86/bd/9b2bd1c5b7af02462c9752d33994834ff972a96b4c483eefde9e594488e2/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd16aabe4a02a297c23417aa17ac6299dbd8c49f673bcd645b4929b11f5a4400", size = 261683, upload-time = "2026-09-30T04:35:17.488Z" }, + { url = "https://files.pythonhosted.org/packages/76/a5/cac540ab0fd61f3fec88ad3dbb64509e71424593d73cfdfff5ab3e4db279/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:fb9e68df06293761f9fe66ade60a9bc6d0f5e42b8acf2939a9158af86ab0e5bd", size = 248143, upload-time = "2026-09-30T04:35:18.849Z" }, + { url = "https://files.pythonhosted.org/packages/71/7a/ff467301deef2089fad87f72df9e000a26a78fec7acbb18e1999371b8369/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:59f63901b0031c3136cf64704dcb21de0bbae62ce2c9529bc39d27665463de37", size = 292358, upload-time = "2026-09-30T04:35:20.326Z" }, + { url = "https://files.pythonhosted.org/packages/ad/77/22d7e785d1e210afc2e2f58600dd1799d17a35665faf84383f002826c5f8/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:304d5463e65a35d7bb0850550e0780395395f6fcf452f04db7d5ca7cecc425ac", size = 268766, upload-time = "2026-09-30T04:35:21.72Z" }, + { url = "https://files.pythonhosted.org/packages/ae/91/e8e946267f1c2d9e2bd651726e2fbd2addf02c4d36cea5069e32ca9d7bb5/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9cf9b1a857e25c4baceeb3624e92a56df3668f398c4acba74e174d81fb4d1d3a", size = 287432, upload-time = "2026-09-30T04:35:23.273Z" }, + { url = "https://files.pythonhosted.org/packages/4e/88/7561d8a88d555e7df6623abe7c0070b4baf47549b9408783a2ae0a1a6cf7/charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:114e4d0c92d618409ed82a99e22b5c5e768fe995f2973f78265f4524f49d4640", size = 272470, upload-time = "2026-09-30T04:35:24.655Z" }, + { url = "https://files.pythonhosted.org/packages/35/7e/578c702301ec036f01455f30744a08d2b42f6ab35b9b2d4bf8cae0ef2a80/charset_normalizer-3.5.2-cp311-cp311-win32.whl", hash = "sha256:2625388c6c754520c37abaf3b41eb34d1cc4a373f457898f08606c8e362b891d", size = 186688, upload-time = "2026-09-30T04:35:26.225Z" }, + { url = "https://files.pythonhosted.org/packages/e8/fc/fdf8cf52ff21cd5bf158f20978991cf985325842f74283eb6df26c8a39d8/charset_normalizer-3.5.2-cp311-cp311-win_amd64.whl", hash = "sha256:87e50a3e7cb90af586b6c5faf23e302a970415ac73bd7bd90a515a04b427ef96", size = 214932, upload-time = "2026-09-30T04:35:27.796Z" }, + { url = "https://files.pythonhosted.org/packages/97/66/3e45a506d8110b632541faf9a9470185aa9878f1ed44020f31346c1c5e5b/charset_normalizer-3.5.2-cp311-cp311-win_arm64.whl", hash = "sha256:254eb48b9fa5ee9898a3c445825a1f340fe53712a098904b39b0bddba8ea3cb1", size = 202828, upload-time = "2026-09-30T04:35:29.259Z" }, + { url = "https://files.pythonhosted.org/packages/e7/c8/693809898870237d82785a03f3b2b58fe4c9f14669f84a7d4e623c92a59e/charset_normalizer-3.5.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:ed2a239c0ea213acc1908150a3037257083c7c083128f1a4cec2ec4b97dca491", size = 367780, upload-time = "2026-09-30T04:35:30.888Z" }, + { url = "https://files.pythonhosted.org/packages/c9/87/2fea8c13dc24b3ca9c6f803a5b2dfdeae73eb4f9e12c7885ed908ff0433c/charset_normalizer-3.5.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b91363207bd9dc966a691e959bb47f64b30f7ac4b072be9968b366982f7db77c", size = 246730, upload-time = "2026-09-30T04:35:32.286Z" }, + { url = "https://files.pythonhosted.org/packages/a8/9e/09efac30b937722f46d3110ba30b875b24b2e3a266ed746cc4e376a94d80/charset_normalizer-3.5.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:38a873987f3be698494da8b2e3085e29da02da7b633dce73e79c699a113d7bf0", size = 237707, upload-time = "2026-09-30T04:35:33.709Z" }, + { url = "https://files.pythonhosted.org/packages/9e/18/70d76670b13686237863a379928d60bd10e021f17d243ab3d7014c4a5f4e/charset_normalizer-3.5.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:355ad8011081dec5412240c087a9a0c9d4d5039f3ed11a3f13e18c2b29b56c51", size = 273050, upload-time = "2026-09-30T04:35:35.138Z" }, + { url = "https://files.pythonhosted.org/packages/54/e2/77a8b09d5adc013ed07b95b01b8b8fa5441c4e810e83ee7e4aae2fa4d91a/charset_normalizer-3.5.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ee21e28f0430bd6dc9086c6e525d5e818a44a5ad19720c8a0ef766792f3eb5e5", size = 270345, upload-time = "2026-09-30T04:35:36.502Z" }, + { url = "https://files.pythonhosted.org/packages/7f/c5/38806a25ab5e65fc178f39affeda20858efafede2fce1ffc2556cfc9fe73/charset_normalizer-3.5.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3d31298449090ab8d47b7b1b2a555ff73cac7ed438a08b7ac160980c7ebed649", size = 257601, upload-time = "2026-09-30T04:35:37.919Z" }, + { url = "https://files.pythonhosted.org/packages/ae/8d/213565184708fdb263ae55e2c04ee1ff748129dd65d48ed0e3502da9c85a/charset_normalizer-3.5.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5cde776b7cc66e4f6c99612cea4aa7269aa65863f7a15841b2c264f103822f4e", size = 252222, upload-time = "2026-09-30T04:35:39.544Z" }, + { url = "https://files.pythonhosted.org/packages/7e/24/76d2cefc25472531e4c5c7dfff68865eb1c39b78482f0fdc15b46f047830/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ae4f5fea5b8b8ccff88238cc8569303e5ee95efae67fa62922a311397a71f346", size = 248482, upload-time = "2026-09-30T04:35:41.088Z" }, + { url = "https://files.pythonhosted.org/packages/7d/dc/65a801b66ab4c197e22c433ab25e7ac24324ac6f45a2269aca42cce309bf/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f7d486c83842422badd511868fd8a9a20e9407ace71564b6af47ce7e60a336c1", size = 241206, upload-time = "2026-09-30T04:35:42.59Z" }, + { url = "https://files.pythonhosted.org/packages/a7/95/ca9b5eabde673002c6f1e7ada1b223916fe18f6d661da7aabd4d643718f1/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:11a4d68a6ecda3292cb1e50239e111543ba5d709bb62a6b4ea1afcfa729d8875", size = 273190, upload-time = "2026-09-30T04:35:44.347Z" }, + { url = "https://files.pythonhosted.org/packages/2d/8b/803b4d2a3f6e1740f63f1e87b04d14b42f3d4fdfe6ed7d4db2d34102b14f/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d6734d2ef8a50fbf8445c139477da401f50d62a0606bf00e20ec6d87773fefb1", size = 253527, upload-time = "2026-09-30T04:35:45.915Z" }, + { url = "https://files.pythonhosted.org/packages/a9/55/93c0e5dbd085ae0471346026abbe7e0db9ea2d6fea74e51f0b5a46f233a7/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:a815775b6c38d4e0ff7bcffbeba67feded90202bb6a226b8dd35f1c855217413", size = 271285, upload-time = "2026-09-30T04:35:47.49Z" }, + { url = "https://files.pythonhosted.org/packages/95/69/0dbd0e0b9b16cfa816cdfcb3e2e3854a1f680dc07fb1245ea125e7448060/charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23851fb4e1b85ed3f6c2a27b777cdfe2e19fb5b38429a8faf38c7542b7665869", size = 260010, upload-time = "2026-09-30T04:35:48.996Z" }, + { url = "https://files.pythonhosted.org/packages/58/9d/e7b88e7b1bf403590c3b573277b5e1e488c68c7a6fbacca310a2c324e90c/charset_normalizer-3.5.2-cp312-cp312-win32.whl", hash = "sha256:db19d07e2e0129e974a0e65d0064fc222a446cd5122c2fd4184d2af9fc734a9e", size = 184125, upload-time = "2026-09-30T04:35:50.777Z" }, + { url = "https://files.pythonhosted.org/packages/eb/e6/e6e083884cbcfd49c64865af05027fe7011be7b2d9179524f099a1b611f3/charset_normalizer-3.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:780fbe7cab297b81dad9fb8dc5eb003c0468ffb0d9e5f65068c53a34661a96bc", size = 207486, upload-time = "2026-09-30T04:35:52.194Z" }, + { url = "https://files.pythonhosted.org/packages/c4/e3/017aea0911ada7405a825c7d937eb3a13009664e2f5b38e8c4bbf2abf894/charset_normalizer-3.5.2-cp312-cp312-win_arm64.whl", hash = "sha256:e2af3aad578aa6bd1384bcf4750fc285e5a9de53f40b7d41e5a0bf748edeb2b3", size = 196734, upload-time = "2026-09-30T04:35:53.636Z" }, + { url = "https://files.pythonhosted.org/packages/c5/34/68292d68512768591aaff07c59bb53ee31341c87759433a859c4641a50c2/charset_normalizer-3.5.2-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:ed905975ab14056a2e5eb1c376cb2e1ebc5396baf84163939c518556fccde9f5", size = 225946, upload-time = "2026-09-30T04:35:55.313Z" }, + { url = "https://files.pythonhosted.org/packages/e3/80/bee0b01b90ccd5322ae1d0abb33fab1bd95b7c2eadaf02aeccf22e04ee83/charset_normalizer-3.5.2-cp313-cp313-android_24_x86_64.whl", hash = "sha256:a66c3bc5ab1f0ff2164fc9965ddd611ff0802173f4b9d24554c563f6ab7e1d6e", size = 238619, upload-time = "2026-09-30T04:35:56.863Z" }, + { url = "https://files.pythonhosted.org/packages/78/6e/60ce52a85a7fd631ae8482ae6d74521014ca2f255892679484dc04d7ef56/charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:d2374b62878abb00cd8309b32af6c0b715cd02dec0ca74ef12e5069bdc64144a", size = 206701, upload-time = "2026-09-30T04:35:58.639Z" }, + { url = "https://files.pythonhosted.org/packages/36/8c/71aafad23f971afc84c2b295bc0c560739ce1dac558aad9fec22e39f3639/charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:d376bbd28b3a8999db1a103b3b388aee6f1ddeb3e51bc2172993efdcd86e064d", size = 210506, upload-time = "2026-09-30T04:36:00.147Z" }, + { url = "https://files.pythonhosted.org/packages/91/da/3c5a7798c046df7d2d68ad653cf5b6c5a8bfee225055a843c6f2f42aac1a/charset_normalizer-3.5.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:6045373d5a89a5ec71afde535db987ca28e76dfa276c2d4c818265b375d4b055", size = 366626, upload-time = "2026-09-30T04:36:01.77Z" }, + { url = "https://files.pythonhosted.org/packages/e1/16/710ac3de2ee354e2bd1a9c94efe45a2d27b5c6ad39b2d6a905be2c094b6c/charset_normalizer-3.5.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:849df64e889b2e17230d58410a03dba311a65b163508fd33679b2b737d4b7858", size = 244624, upload-time = "2026-09-30T04:36:03.389Z" }, + { url = "https://files.pythonhosted.org/packages/d6/39/45c7439f5b63d24f7d5b2a1d760f34af7628782d7144b4cc8ded45c2d4bc/charset_normalizer-3.5.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:15c44f7edfd477b06f517a5cc317fc1707edb9de2c865f43d4b6513907473234", size = 235731, upload-time = "2026-09-30T04:36:04.987Z" }, + { url = "https://files.pythonhosted.org/packages/4d/34/38f3154785ce92e9f56eb226f4d35bdfae6b008480dd055f58837a89c810/charset_normalizer-3.5.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a89012d6d5476ee112d20d998570ed58df2260a852afb1758809cd6900411d21", size = 270352, upload-time = "2026-09-30T04:36:06.412Z" }, + { url = "https://files.pythonhosted.org/packages/04/f3/859f74e7babc977705026b30593b3be04049632a522fb7000f83c033d747/charset_normalizer-3.5.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0c951d5e6dd9c2ff60609476752bee49da4206adde960ebc247766937f72e718", size = 267393, upload-time = "2026-09-30T04:36:07.865Z" }, + { url = "https://files.pythonhosted.org/packages/4b/85/41d27f234b82e47c167a5f6c0f62501dc0c640585ff4aba79e08a390336a/charset_normalizer-3.5.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7218e8f32b0956cfcd048fd42d9d5779809745ca1d86113ca56f66e7ae1549c4", size = 254660, upload-time = "2026-09-30T04:36:09.248Z" }, + { url = "https://files.pythonhosted.org/packages/58/ca/5d1a997587febe5b26d8daffe363b5c1a091cece19828eec6502fd09c5ef/charset_normalizer-3.5.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a19a731138fc27d5682277d3b9df22855cea1239bce7fcec5f78f42ef2d1f3c3", size = 249996, upload-time = "2026-09-30T04:36:10.73Z" }, + { url = "https://files.pythonhosted.org/packages/b3/1f/d1e78246f7ed60c8c8d606b4ac27f66ce49cc3e95f24893ccbeba9f77302/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:62603db9a7caa0802eaa28c1c46fecd7b3a263a774069c24c3c28c302448721c", size = 247028, upload-time = "2026-09-30T04:36:12.294Z" }, + { url = "https://files.pythonhosted.org/packages/8e/37/eba316edd4f0c4d3a5d945924c4eeeae59abac4056aa815d8a4268f863a2/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:b6856554c4f44d79fc2307d5768854310a8f0096e501c75637542c82292b0429", size = 240562, upload-time = "2026-09-30T04:36:13.887Z" }, + { url = "https://files.pythonhosted.org/packages/c8/8e/aaa037d40ca9ef045977f1a661048b1aa33f223adfce3452fe9be9f79d14/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1bc0baf5ef96b6ede57d47f4b8fe4d9d84019c3bfcbeb20a41edc6a6ee341f1f", size = 271699, upload-time = "2026-09-30T04:36:15.41Z" }, + { url = "https://files.pythonhosted.org/packages/26/19/1c1c9f75974adf523b87f34b8a2adc5a435cd65916812bcbd0dfa45f9a29/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:56bc200a365efb37383b7852e4cc5898d3b2da5987289b543956cf8cad71018a", size = 252030, upload-time = "2026-09-30T04:36:16.839Z" }, + { url = "https://files.pythonhosted.org/packages/bc/90/0660ef18e18df0a4d2a1a0edff7dfbba42d4e50ef2425557a5bb7051f77b/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2c9ad19a6cfcd5ea5c0d41161d22f9df1dcc277e9bef2751391334546a314c00", size = 268565, upload-time = "2026-09-30T04:36:18.468Z" }, + { url = "https://files.pythonhosted.org/packages/79/ba/57adc269824e8658f1a0f97a9e514c247445a9632b3419b97e0ba37f16dc/charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e243bd13217235fc7290c621941c3f5cc8b66e4872495be821d7436ba2fb838d", size = 257627, upload-time = "2026-09-30T04:36:19.938Z" }, + { url = "https://files.pythonhosted.org/packages/9a/85/33abd4315c052d3d4f54c92b1ee49bfbc0dc7115a981e462a793b6d2ab87/charset_normalizer-3.5.2-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:a090bb2c68df85450502e3e20d665e3a5af9c65a84d6508ed477badd49166fd3", size = 143407, upload-time = "2026-09-30T04:36:21.376Z" }, + { url = "https://files.pythonhosted.org/packages/4f/de/6435e18d1aaa5d910b896d551411c96af1f42a0c56c29afc2016c61ccc2e/charset_normalizer-3.5.2-cp313-cp313-win32.whl", hash = "sha256:2b7b3bbfb4fe8ef40600792d762fbaa9057559f9d3fad209525b7a22b99e91fd", size = 183207, upload-time = "2026-09-30T04:36:22.776Z" }, + { url = "https://files.pythonhosted.org/packages/9c/76/b8ec57f4e9ee3253541abf95e4a462c0175fe8032dcd070f1f2421240942/charset_normalizer-3.5.2-cp313-cp313-win_amd64.whl", hash = "sha256:78456a747de8dc58360ffa581f30a002baf5aa28cb262536545e91f113ed7639", size = 206489, upload-time = "2026-09-30T04:36:24.306Z" }, + { url = "https://files.pythonhosted.org/packages/3e/60/c647c6ae47480221e875ea5d743ff94946f7416e3c69415ab772928e8d32/charset_normalizer-3.5.2-cp313-cp313-win_arm64.whl", hash = "sha256:11912e4bb14baae7c5d8791aa55ba0a3a03ec6729073307b0f57270abaa713d3", size = 195501, upload-time = "2026-09-30T04:36:25.846Z" }, + { url = "https://files.pythonhosted.org/packages/58/ca/7aa91362a2f77ac8e9e28a9b902a74f7d0e11a851ef0d27a74308da8cd90/charset_normalizer-3.5.2-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:1afb975bd5d68d5ce9f6b6d44fdf2f7e34b895a35e95708a7a91b20a3b51d187", size = 226010, upload-time = "2026-09-30T04:36:27.669Z" }, + { url = "https://files.pythonhosted.org/packages/a8/cf/ac8878d0322cf88a1aad4c7b147db32ca0bd806eb0060957b2e31486dbe6/charset_normalizer-3.5.2-cp314-cp314-android_24_x86_64.whl", hash = "sha256:bbbfc8e28816f19d7c0f1816664980c0a9875d01b27cdf8eedddb639d9e108ad", size = 239266, upload-time = "2026-09-30T04:36:29.434Z" }, + { url = "https://files.pythonhosted.org/packages/c9/6d/9a08d7e0b29b7208e2c6c01dc56c8e0520e7c7beadbbfb024b58fd69c8a5/charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7967d08cf06dee78443b874f98c98036f624f3a4e73e11f9f64f5be4d25393cf", size = 206783, upload-time = "2026-09-30T04:36:30.872Z" }, + { url = "https://files.pythonhosted.org/packages/82/44/b0aa350280e6ff5a5492d17cf10460dd39d5ee848f872f7ba2df10607f60/charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4c2b5031f63e331e3839b40aed2dd6f191e9c07edbde303e7876846ea1946995", size = 210449, upload-time = "2026-09-30T04:36:32.625Z" }, + { url = "https://files.pythonhosted.org/packages/7c/8a/40db9aa9f5907bb0e6f8b6d64064bf8852fb33d4b813ff9414911df7647c/charset_normalizer-3.5.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fcff63213e8e6e47770541a4607175404f47cbb3ebea7b6058cc82d524a0e424", size = 367815, upload-time = "2026-09-30T04:36:34.197Z" }, + { url = "https://files.pythonhosted.org/packages/7f/72/9c5e7707b57c8ddfa9ddf7b0b1d009d7fbab9e9e887d5b721060f37e307d/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8d86d6fc60743dc916eb79e2eb1ec4818e21e427731543af40a3021851174a13", size = 247095, upload-time = "2026-09-30T04:36:35.803Z" }, + { url = "https://files.pythonhosted.org/packages/83/09/71e453691e927de4ddf792770cfaab3f49d494e222f66ea5e404bbd5e39c/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7a881931aa470808df94a8c380eed2bbbc76cd9dc622310f99665658c821eb6d", size = 233942, upload-time = "2026-09-30T04:36:37.407Z" }, + { url = "https://files.pythonhosted.org/packages/9f/86/85c84e4da8b27dd409577d9437926ff581c5f9d3c66038dc68c1a526de51/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8024d00c3faf3fc0c16e07a69f4405e8eac7cc0ab15f65fe6cf43827c4cf72b4", size = 273762, upload-time = "2026-09-30T04:36:38.904Z" }, + { url = "https://files.pythonhosted.org/packages/92/08/564955a4b5f2ccb410ab480bbe8c6a18063ff27f2d35458731c4a5335df9/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4d48f2d08b9de5864e2c8744d4461b862fb149a18274abc8b698c45975573438", size = 269514, upload-time = "2026-09-30T04:36:40.469Z" }, + { url = "https://files.pythonhosted.org/packages/18/24/bad3ac4271589df29cf5ce2f5ae490518a5739358052bd0d61209e6fea54/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34276fd796040bf0993ab33a369aa572e6979c7aab225a88893667ad8eac8f7a", size = 255056, upload-time = "2026-09-30T04:36:42.02Z" }, + { url = "https://files.pythonhosted.org/packages/d6/3e/350d89ad49916b86554d6f5f2d03ec1152148f87e5ff735106c6a03b1a36/charset_normalizer-3.5.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0521c5665880b33d603717defa76c094048900010897909952397feb3039da56", size = 251311, upload-time = "2026-09-30T04:36:43.577Z" }, + { url = "https://files.pythonhosted.org/packages/56/5b/4970a2d154df502e133402906dd04e3ae7cada7b3011283c88d0479a2585/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:eff0ac9dbe711a4aee69bf04a83896aa9b85f19641264053a9f6d48573abb7dd", size = 250190, upload-time = "2026-09-30T04:36:45.185Z" }, + { url = "https://files.pythonhosted.org/packages/88/8c/f1a91bddc8fb47c2889e29ea7ea49a194eb0d9868675d786806519c00d76/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:1503bccbeb36d5527790c3930327704c39af22de3112f1b1666a9f3ce15ee204", size = 237098, upload-time = "2026-09-30T04:36:46.689Z" }, + { url = "https://files.pythonhosted.org/packages/24/0e/bb5dace3cc7e79068425386a6589c19b5a2ab5fefc2a46abea6919683332/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:52aa6992700996af31f375de0c6bacd402b0097fe40b53c426b9f51a90ebabc7", size = 274228, upload-time = "2026-09-30T04:36:48.31Z" }, + { url = "https://files.pythonhosted.org/packages/9d/79/b849ad523017ea9f5a45581bbebed91439e0cf42fd2860a6f64e358eb5a6/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e09a3942ecbdee5cce73ea9d42da82b81b72ac1bf031ce069b93b5adf4eac8cd", size = 252401, upload-time = "2026-09-30T04:36:50.091Z" }, + { url = "https://files.pythonhosted.org/packages/89/8c/75469d690cf47200bce8f6cad7655724fc23148e147abfc5ce78b5f65863/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:c7c9ab723cde841fefb34efbad91e87f00a674b1fe1cd0784fde742bf2c154dc", size = 271846, upload-time = "2026-09-30T04:36:51.719Z" }, + { url = "https://files.pythonhosted.org/packages/26/cd/6d52d3c7437cdcf2e310ce9f28f282e733d4ef60ed19105d1819c356255f/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ddc7dacc8ece3a182e7f15cb862d1fd616b46d076cb1ae9dd232b2c38b655874", size = 258151, upload-time = "2026-09-30T04:36:53.234Z" }, + { url = "https://files.pythonhosted.org/packages/f7/4c/070b38bdb5f49a70199fce923ec0726a49536a63ab262abbfcaaf351110b/charset_normalizer-3.5.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:ee43c17b173d46a3212baa6ead3ae258eeabdae48c263a01ccf0218c366dd655", size = 143570, upload-time = "2026-09-30T04:36:54.816Z" }, + { url = "https://files.pythonhosted.org/packages/81/84/9ebfc8ed6c8c4fcd8e726ff6bf220cc8deb3966e31dce9be8dd8aa017e64/charset_normalizer-3.5.2-cp314-cp314-win32.whl", hash = "sha256:4f87960d57feabfb618e4e0af6e7371645fa26a277860739d6e5d6e0012c92f0", size = 186412, upload-time = "2026-09-30T04:36:56.643Z" }, + { url = "https://files.pythonhosted.org/packages/d1/78/5ed86f743d4bc350db307e7636419a0a5ee1d91806d30c7f667bd5c80dae/charset_normalizer-3.5.2-cp314-cp314-win_amd64.whl", hash = "sha256:e4e81e09c1578b8df602e3db08b0b3ea0a6947ad612f52bf8dc5ea8d47691f0c", size = 210965, upload-time = "2026-09-30T04:36:58.205Z" }, + { url = "https://files.pythonhosted.org/packages/53/94/a3a7698e9b1a395e1eb99ccd9a324be9347973bff4e72db2a06496d7cd27/charset_normalizer-3.5.2-cp314-cp314-win_arm64.whl", hash = "sha256:80d02b6f04e92601a081dd97b23d3128033098bff5d35d392ddcc0476ea11253", size = 200406, upload-time = "2026-09-30T04:36:59.764Z" }, + { url = "https://files.pythonhosted.org/packages/c1/48/c5dd00d5ef7791f02666de250a5bb6071e29b7e133cf4b835800b6d3bc27/charset_normalizer-3.5.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:dca9ab98072a5a54ebacebdc45f53e645336b320c667410b061be1ca588ae709", size = 396871, upload-time = "2026-09-30T04:37:01.543Z" }, + { url = "https://files.pythonhosted.org/packages/12/c8/8379554b42e8368161d898476686947a0fdbd3e8865170d7909dcabfdee8/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f0aa869112ef88429ae17820d99c3dd9504c9e9c671d3c246f3d7442cb051084", size = 249711, upload-time = "2026-09-30T04:37:03.111Z" }, + { url = "https://files.pythonhosted.org/packages/4a/eb/2ddb1035d17320caa9f41682935123a9a250277b261c3efc86b2d2a21343/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c0afc6800ba57ccc350374c5bd6150419915d95ce93cdbab2d783d75eaf30ecb", size = 231146, upload-time = "2026-09-30T04:37:04.721Z" }, + { url = "https://files.pythonhosted.org/packages/4a/24/2ecb4bde104322cd7859d6594fcfa74649f8d90b3221c9feecbef149875b/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7dcd882da75ef9adf94903b1e3b9419e8aa8fb4c7396822b834b9ef7fb96954f", size = 271552, upload-time = "2026-09-30T04:37:06.295Z" }, + { url = "https://files.pythonhosted.org/packages/3f/98/9d5f6ebc3aee9fef5d30b4aff11fb2ab7a1222b4064f8ef2c7c87cde217a/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2e06a3a98f916dd41d27f3105e02e7a40181c98c94b9158733d03a6f80506c09", size = 269810, upload-time = "2026-09-30T04:37:07.905Z" }, + { url = "https://files.pythonhosted.org/packages/09/e1/a3b06a10461b1b7628853c934c644e03bc28e42767116afb52f19a56519b/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bd128f206a7752ae1f2ab6c61bf8a24ba28913a10df8b14c2637b973ff97a80", size = 259845, upload-time = "2026-09-30T04:37:09.554Z" }, + { url = "https://files.pythonhosted.org/packages/fd/d3/6f561f74a296cf27d61775a1dc665ad13f3bff6a798810ca05907f37a7c4/charset_normalizer-3.5.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c8f3d67aeaf55f017982b73683f0e7342ba2f6635a78f69ce89ebb26aa411e5c", size = 252825, upload-time = "2026-09-30T04:37:11.274Z" }, + { url = "https://files.pythonhosted.org/packages/26/9f/69e13ca3b18f43e0eafcd34c04a45b732ae22a43b54a5fc9e119103356eb/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fe9753dfee015c570d73df76f899f18444d41388bffcde097deba51c4fadbb9f", size = 252659, upload-time = "2026-09-30T04:37:12.941Z" }, + { url = "https://files.pythonhosted.org/packages/73/a9/ace29806a0dae18939919c76ba526472d83214afa101105fabff2cf30625/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:92888bb3187c5ba50500b00b3b310c9f2c651709d28036077680cb5255450a03", size = 238819, upload-time = "2026-09-30T04:37:14.659Z" }, + { url = "https://files.pythonhosted.org/packages/f8/c1/6116d52a2e3311ec80f21f5fb5e17b27405f10b9608af8f6e69516841a1b/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d008d90a7f2471519aef0c90dfbe73b3e6e4d5e66ac48e19154c17e89e98b604", size = 272973, upload-time = "2026-09-30T04:37:16.346Z" }, + { url = "https://files.pythonhosted.org/packages/19/aa/9955c7e93bba10a9c7e8f7a5031b7ced66f3a1883a55c00712b8d5850ff3/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:31f3930700408d211f13378ccbe1c40845d8da54bd0681fac3a9b5aae81c7aa8", size = 253692, upload-time = "2026-09-30T04:37:18.212Z" }, + { url = "https://files.pythonhosted.org/packages/bb/33/2a6ae7fdc1b10cb581cef91addd8cdfc5f40d50abb5702309369d5834579/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:2a925889534b3748302dae5dead07cc13480de1dac3aea80a941b729b471ef93", size = 268757, upload-time = "2026-09-30T04:37:19.877Z" }, + { url = "https://files.pythonhosted.org/packages/a2/22/80992720a0282cd39bba1db35868e6b9c22f41281160143a836544bc1d8a/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f5ec61164adcec446f8969a3358ec3f9b26bbda3b9213e5586d219afa8df2915", size = 262220, upload-time = "2026-09-30T04:37:21.583Z" }, + { url = "https://files.pythonhosted.org/packages/92/9f/181fd07e1bffea1d95cd80c84ac537354f50699c22cfc4d3c02b6fc16208/charset_normalizer-3.5.2-cp314-cp314t-win32.whl", hash = "sha256:598a11a2c7ebaa5334bf698bf29568c9c390abac6a154d8170fedecd1cea38c5", size = 197797, upload-time = "2026-09-30T04:37:23.235Z" }, + { url = "https://files.pythonhosted.org/packages/49/1c/25d8415ec1c4f2f41f1680435e4c87cfb378ff2f677d950946f2a45d0632/charset_normalizer-3.5.2-cp314-cp314t-win_amd64.whl", hash = "sha256:7fdde2c9fd9e3eca40631e024664cf2584272cc8f96308cbe5fdfc930f51d8bc", size = 222765, upload-time = "2026-09-30T04:37:24.891Z" }, + { url = "https://files.pythonhosted.org/packages/3e/b4/46b48f013dadfc0d0d33b375438e31bdf5a989dc68389c6bf627054d4df9/charset_normalizer-3.5.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d1befeed746d247c81127bb14de9dc3d30edb6e5976d34f83f86ed262b1d9105", size = 210985, upload-time = "2026-09-30T04:37:26.634Z" }, + { url = "https://files.pythonhosted.org/packages/ca/e9/34e597dee616d0b8ee4b34d29399e85c2204ade174157a48505d42baa4ff/charset_normalizer-3.5.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:87475fabc8d9996fd9c27debb395e642e8c838d78a00b6e932227a0e06b81e26", size = 367676, upload-time = "2026-09-30T04:37:28.329Z" }, + { url = "https://files.pythonhosted.org/packages/60/9f/a5d1c91c0263745e2cd344c5a4415d787c575501ab1d449f1148ac6b495d/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9409a8bf35cf78353942504b24a57de3d75b708997a1e4bd8db71ac8633ce364", size = 248414, upload-time = "2026-09-30T04:37:30.167Z" }, + { url = "https://files.pythonhosted.org/packages/26/79/e697f77464748a3ee3cf490c83d592459400d4898380d66c38366b03080c/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:498dc3188ca05a68231ac3fdbfc7f57eb67e1343c30e0fea17f8218c1599b253", size = 244775, upload-time = "2026-09-30T04:37:31.964Z" }, + { url = "https://files.pythonhosted.org/packages/ca/87/3d42a42e18ea066e2513936fd678a00696e77878b5ae04528976abdbcb83/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e242bb1c5e76e97dfa9e7f209a71e93a01d7f19ffdd5cfbb2e2d55b4f08f8ab0", size = 273877, upload-time = "2026-09-30T04:37:33.661Z" }, + { url = "https://files.pythonhosted.org/packages/c3/76/8a28136f3938ba9836f84280ce0c4d61ed1cf15a036b2034900c62634162/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:def79fa35ef0cef8d2accec024f4fdc7ead3012ff02f5215c783f39f03ef8cfc", size = 269455, upload-time = "2026-09-30T04:37:35.573Z" }, + { url = "https://files.pythonhosted.org/packages/a0/a1/4fbf5d0f0f1b2a080474c1cf9a2f12c4c6531bb0e8ba591055e846d2b4e9/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3df041de8887954562c9b261cba85ca0e9ded74048daf125f45edcfaa4832229", size = 257336, upload-time = "2026-09-30T04:37:37.397Z" }, + { url = "https://files.pythonhosted.org/packages/ba/a2/8b50aa320adb880ad579518e6f718f24944804b42a88b83d267d5d444125/charset_normalizer-3.5.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:04851f73ae72b8413dddadb16a49dfee95263553741fd42d546f7d66907e6be5", size = 257584, upload-time = "2026-09-30T04:37:39.522Z" }, + { url = "https://files.pythonhosted.org/packages/a5/57/50e3fed84e175f40349bd0da7a4fce94c87f0378f52d74f511d89e0bdc20/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:183b88127acdb4fabe59d951ab424faf1af7b63cdbb5f776186c1ea2ffcaed98", size = 251854, upload-time = "2026-09-30T04:37:41.23Z" }, + { url = "https://files.pythonhosted.org/packages/d6/54/f7fbb3493c9f49091213b9c2d6dd65800696f1ce1a3f196a4205f50417b1/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:16fa0eccf81304b79c5cd87f9271c3b85dd9dd99245e4422ae9c0dd45e0f99d3", size = 248767, upload-time = "2026-09-30T04:37:42.883Z" }, + { url = "https://files.pythonhosted.org/packages/d9/37/b3a6385acc5a1e45b39ae9c90bfb9cf838a09b9dd37ef2740ab4c6b4a2eb/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:7441d755b7ab94f8d4eb3e43ec05482d760842fd263d003a99102d742cd835e2", size = 274479, upload-time = "2026-09-30T04:37:44.658Z" }, + { url = "https://files.pythonhosted.org/packages/89/44/809913e2cfd279e635a9294fdbbfb1b1dc62a8189d473d561f649fce98d8/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:ca403d7e4798f525fdfc78e258820419cbbd0f0ecbab9de7840e3c017cf6b8cf", size = 258310, upload-time = "2026-09-30T04:37:46.529Z" }, + { url = "https://files.pythonhosted.org/packages/af/a2/f28400ab13359d91bd39179df8e149376b9bf36588e739a3a4f9de2b84b2/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:df29a0a7107f7011e77f4eebdddec4c7331e24d787a0b21a46d63bdf7445da95", size = 271100, upload-time = "2026-09-30T04:37:48.399Z" }, + { url = "https://files.pythonhosted.org/packages/e9/89/9bab37955edf0adb3b66f8a3a6617d9f2f487e0d56f295a6a286cb640aa6/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f3c96f633825733f735c5a9cf21d21a257d8e1edf0b1cee0a064b9c424ca0f7d", size = 259936, upload-time = "2026-09-30T04:37:50.023Z" }, + { url = "https://files.pythonhosted.org/packages/23/b5/4459e08d45a679f903d50fea08bc52cfa728cca4d7bd02c757b5e5abda2e/charset_normalizer-3.5.2-cp315-cp315-win32.whl", hash = "sha256:281cb91036248400f4cc957495cccd44c275c2e0c5854f7e45ac5cf7dc193847", size = 186301, upload-time = "2026-09-30T04:37:51.722Z" }, + { url = "https://files.pythonhosted.org/packages/98/e8/55d5fd3935b4bce6da4fe0df61898e8c82653e317e677bd58aceb9c60f13/charset_normalizer-3.5.2-cp315-cp315-win_amd64.whl", hash = "sha256:89b53f3cda69831909888e0494f4fa0bcd3537e3e138dabeb620bd6ad946bae8", size = 210858, upload-time = "2026-09-30T04:37:53.427Z" }, + { url = "https://files.pythonhosted.org/packages/a9/5b/974423c2fd8e524c7a7f64318c1e02240ef954912fa2b4d70344107b9c68/charset_normalizer-3.5.2-cp315-cp315-win_arm64.whl", hash = "sha256:6be488a102b8cf28d0391d8c4ba7748938ae28b78ad901f8585520fca33ead1a", size = 200309, upload-time = "2026-09-30T04:37:55.015Z" }, + { url = "https://files.pythonhosted.org/packages/ee/f9/00ee0195db1013d8f7c416fd770fbeb560bb46eb2e36b054d05cb56f6cfa/charset_normalizer-3.5.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:915563965d418f986e7e145accc592eae9e1a1be3566ff98a05d7a9ec42a76e1", size = 395343, upload-time = "2026-09-30T04:37:56.743Z" }, + { url = "https://files.pythonhosted.org/packages/04/3a/c00b50e94c964cf934c7899cd47c97952fc11dad71cc5884b3c61795b09b/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:65cd72beeeca9d3aaea1201e5923859f308f952f9c71de93f06063c79f0f7a3b", size = 250114, upload-time = "2026-09-30T04:37:58.607Z" }, + { url = "https://files.pythonhosted.org/packages/50/27/d102dc880bbcffd0479ab64dfc1fb96777a854355a55e2bda72a71efadcb/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b7fd005a73d9e657273b7a10dc71a9e03c8fb9ee6999798d6918ce095b81ac7f", size = 239997, upload-time = "2026-09-30T04:38:00.511Z" }, + { url = "https://files.pythonhosted.org/packages/a5/4a/bf7ef45794dd293fab5f98a9309817977fbb845b9998f171b8cc5d8437a3/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e54da4baf05720032d527874d40b65fa4d7e5c6c6a43d0c3adbeffcaf275a2b3", size = 272313, upload-time = "2026-09-30T04:38:02.509Z" }, + { url = "https://files.pythonhosted.org/packages/e8/ee/008a2837737991474c5754bb3191010007663860979701990982a502cbaf/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:124fbf1a8ff966d87ae05bb8bd45a71f966055ed8bba320d0c7cf450bc5f4d0e", size = 269986, upload-time = "2026-09-30T04:38:04.435Z" }, + { url = "https://files.pythonhosted.org/packages/93/ad/bd74a283940dc910c5b14f8e4f80a248082bc9c0fcbe1f54530cb6d9cc5e/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:28b4f0d66fb834ff90f28209ac7bce77868c45d8c93e26f906709d9b7c2e1af9", size = 260202, upload-time = "2026-09-30T04:38:06.549Z" }, + { url = "https://files.pythonhosted.org/packages/8a/7b/ed341c66f69f688723501fac752be3d63c7159ca0d0d4174fc611e5710bb/charset_normalizer-3.5.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:58ca3755ee7ff7f59b57789ec9833c9de9ea275405cdd240eda1f193112e398a", size = 259083, upload-time = "2026-09-30T04:38:08.311Z" }, + { url = "https://files.pythonhosted.org/packages/cc/9d/e41588b777965e5031a43128a1e96173ebb35ac75fc53ec3b517e7c21cd4/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:443eae2bf318abeaf6f15d785138f71fd6de770e99a92158b8b814265e079115", size = 253081, upload-time = "2026-09-30T04:38:10.402Z" }, + { url = "https://files.pythonhosted.org/packages/81/35/b761eb6d8c1eb218b9b42b9b4d5ac902afdc399fb6dac6f9a9aac7bda589/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:58f361dcbab699cf8f42db3f47c8e7fd1036f138c23a5d08de9fde5f425a730c", size = 248712, upload-time = "2026-09-30T04:38:12.317Z" }, + { url = "https://files.pythonhosted.org/packages/4d/2c/147169a041b747759f37405c0a97157e8e92de967968373101ff14915cba/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1b4cbc7c3491ccb4aa17fcd8165649d01cf39f76de1696da8631b5f71b85401d", size = 274176, upload-time = "2026-09-30T04:38:14.138Z" }, + { url = "https://files.pythonhosted.org/packages/f0/2d/0ff8db0d373ba8538db686db11cd7e8912031490b9e4f383b41912e8d594/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:ba0b1d2620edf869789c3879223f52bf2afc5d31b3cb47cc57b3a12c05e2aa9d", size = 259413, upload-time = "2026-09-30T04:38:15.841Z" }, + { url = "https://files.pythonhosted.org/packages/8a/8e/b4a085fb47c9d3a7e43576a4784fdd8fe23f907514a972de8086edaf7a48/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:5e2b6b57e9733d39f0c9fd3185efa6b8e29652c4cd8fe94180272cf6ed9a78c4", size = 269434, upload-time = "2026-09-30T04:38:17.626Z" }, + { url = "https://files.pythonhosted.org/packages/83/1c/d8d8d7322a7c3eecdf3237a4a419cf41d2eaad8e006ce7dfdd9d4c8fa2eb/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:51cf45226a9b588d0d2b4880c62d686934b63ab0bd79ca23ab0e9762eb27441b", size = 262716, upload-time = "2026-09-30T04:38:19.214Z" }, + { url = "https://files.pythonhosted.org/packages/a0/16/0e4c6ba9b44e97a2da150e52d331e8f9c968b21b358fbffa6c856cebcd89/charset_normalizer-3.5.2-cp315-cp315t-win32.whl", hash = "sha256:5fb29fb8cd1a46c27a1bf9613ad5ec2599310d46b4025d9556404a6b6a292800", size = 197159, upload-time = "2026-09-30T04:38:21.037Z" }, + { url = "https://files.pythonhosted.org/packages/be/33/e90bc2b1374f7f36ef106f56620de5a783907e19ca857efe2277e31cac3e/charset_normalizer-3.5.2-cp315-cp315t-win_amd64.whl", hash = "sha256:a192e2c40070d92c3ccf777e3a5c4ff515573cd2bb7ed0c537fdadbbec5bbf21", size = 221322, upload-time = "2026-09-30T04:38:22.886Z" }, + { url = "https://files.pythonhosted.org/packages/66/89/dfa6dcb08c200b7830ab56439e8c1890f2971d51aafbb3937894a2e7fcfc/charset_normalizer-3.5.2-cp315-cp315t-win_arm64.whl", hash = "sha256:749e97e1b32313717a565abbe321bc2190bc8b35f1a67e4cdbc7c56c8d8ffe58", size = 209192, upload-time = "2026-09-30T04:38:24.648Z" }, + { url = "https://files.pythonhosted.org/packages/8c/ab/176fbfd5b64939c55d652366aa5b9ef1d767af207a3aa6ebeb0d226c484d/charset_normalizer-3.5.2-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:4275811936e2f06feff5e598fb42a1b7ae852da8e39605211892b56b81a34efd", size = 331815, upload-time = "2026-09-30T04:38:26.216Z" }, + { url = "https://files.pythonhosted.org/packages/7e/84/371eac6b30bdbcbf2d632a1a01809103459216fcaae61b8b8d922c1bfb8a/charset_normalizer-3.5.2-cp37-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1c50fe28bbc2ced33386f298650d91218076c05420e6cbd790b913adc41659e7", size = 253276, upload-time = "2026-09-30T04:38:28.032Z" }, + { url = "https://files.pythonhosted.org/packages/43/6f/c4fbae58febff71709c51bc7e18fdfa55341dc382704740f9f0cbf03817b/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d19fbd981a488e22cd04883659ca6b08f50b5974f9fd7c95655ef6a043e5893f", size = 241239, upload-time = "2026-09-30T04:38:29.732Z" }, + { url = "https://files.pythonhosted.org/packages/61/71/458c3f42164a07d0c5210798e9e704b39e540a6793b05aba67f3a35243a9/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0fed1d06615f022ee3b13caf5e8b180cfea32bb2c5aded8a9d44277afc040f93", size = 231121, upload-time = "2026-09-30T04:38:31.462Z" }, + { url = "https://files.pythonhosted.org/packages/09/54/ab9e89367076f6331bb6c65c4bf14a5361fa5191cb6561bf534f18504e1b/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:838dcc90063569a0448120554591a1d6c4a4ffe11babf048908793154ab86ade", size = 260350, upload-time = "2026-09-30T04:38:33.239Z" }, + { url = "https://files.pythonhosted.org/packages/7c/c1/061431ecc688d9d76602502cb57cc01e691e682c18f1beb45f9673b5bbd2/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2ce45c6627b22c47e390bc91a41c3d13032192e699fa0bea96e9671b373d69b0", size = 255430, upload-time = "2026-09-30T04:38:34.865Z" }, + { url = "https://files.pythonhosted.org/packages/8d/1f/20c8949f0676f7ab811abdeb7f4d7f1cbc6e61ff20bef08b44edeb092bc8/charset_normalizer-3.5.2-cp37-abi3-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0774bf9bf620249fee3e0b8b9fd3065de213be30f3aa94ce2494b3b638949e26", size = 250612, upload-time = "2026-09-30T04:38:36.649Z" }, + { url = "https://files.pythonhosted.org/packages/2b/9e/46f2fa4c431fc98c4ae76a8cb5bdca54e0341e3cfc3fcfd8e82740250818/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1db38f4c5496827c1a501846d64d14c3b80c7e6714e406cd7dc36a9899fa1011", size = 242083, upload-time = "2026-09-30T04:38:38.26Z" }, + { url = "https://files.pythonhosted.org/packages/bd/39/559be29a0c0f086e0bba6922babd38916cc5e0b58ced4de13ee01ea05508/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:304d8e4d493af723536393eee0c689eb7813f4a474c8b479dee63f1fdd98f621", size = 232738, upload-time = "2026-09-30T04:38:39.81Z" }, + { url = "https://files.pythonhosted.org/packages/ff/6c/387b0e4f756a282831c1d9fc6aeb6c51ca4507ca202767c8de15ce9b12e2/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:9b7f416ff0978e2f2249330527f0ad6fa02f4932e6199692d3b52da2048c19e4", size = 260703, upload-time = "2026-09-30T04:38:41.346Z" }, + { url = "https://files.pythonhosted.org/packages/96/92/1fdf015f09ef449f50d3ac4b67c90887c9c318b727daa95cc4f866e6521d/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e", size = 247622, upload-time = "2026-09-30T04:38:42.937Z" }, + { url = "https://files.pythonhosted.org/packages/dc/3c/8e7b8a5671ad5d433669fb2a76f1a0164df2d9b1718b0206bc2a16d840cc/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_s390x.whl", hash = "sha256:7e841fb9010836c992c9f12fcbd43a831de93a5f726fc1ccd8ca1d0268c5014c", size = 257500, upload-time = "2026-09-30T04:38:44.604Z" }, + { url = "https://files.pythonhosted.org/packages/b4/f0/45b579df5cabc1d5d53ea1cc35e8437d3ca768c0acccc7041517cb6fbb32/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9cae88599c7219005d879f98e5ed53341e9a122af585e1091200358a3003d2a0", size = 255100, upload-time = "2026-09-30T04:38:46.289Z" }, + { url = "https://files.pythonhosted.org/packages/31/68/fdec18a343f5fb3f310588dd478b09ac4799e0b187dbade3a8cd776f03ef/charset_normalizer-3.5.2-cp37-abi3-win32.whl", hash = "sha256:01b0c0d2262a9e28e8484a278c7e1b5d650e3ac8cf2683d2967e25899f208bdf", size = 174499, upload-time = "2026-09-30T04:38:47.999Z" }, + { url = "https://files.pythonhosted.org/packages/9d/8a/b618149cc5207943a0242068d7a27897f56a62947b5a039085f2a22029f8/charset_normalizer-3.5.2-cp37-abi3-win_amd64.whl", hash = "sha256:9f56f72050826f63dcee7a7f55b0a77168cb3bfc553fd405e7f8f9ece75a4036", size = 200092, upload-time = "2026-09-30T04:38:49.707Z" }, + { url = "https://files.pythonhosted.org/packages/03/cf/4c66866fa9e2b1c78e3c911516d1de497a677b7ac60f1eceda74ce777ca3/charset_normalizer-3.5.2-cp37-abi3-win_arm64.whl", hash = "sha256:40ab6bffa02ae10a0581e6c198be7d2d8ca5c2a0c64e4ed3465d766df457573e", size = 294363, upload-time = "2026-09-30T04:38:51.312Z" }, + { url = "https://files.pythonhosted.org/packages/fc/ad/d07d7862a62ffa6d79d68074d14823243dd235a77c45262acbf6adeb28bf/charset_normalizer-3.5.2-py3-none-any.whl", hash = "sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685", size = 68872, upload-time = "2026-09-30T04:39:21.828Z" }, +] + +[[package]] +name = "click" +version = "8.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/0e/7fa0ef50764b67090eca4114772a2abf8b6148198475e54c660b97caeee6/click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34", size = 382235, upload-time = "2026-08-26T13:33:14.56Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", size = 125251, upload-time = "2026-08-26T13:33:12.928Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "docker" +version = "7.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pywin32", marker = "sys_platform == 'win32'" }, + { name = "requests" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/88/7f/731ff914b0255d3d065f45fd4e626d4b8c95dbcbaada049f337a6ac16410/docker-7.2.0.tar.gz", hash = "sha256:cebb93773d334f778e023a7ee352a8d6e13ab1bd3b863a4d4a59dec897df43ac", size = 118731, upload-time = "2026-07-09T14:53:46.39Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/75/23/529140fe1aab80fc6992f93a706deec709140a6397439139a054e1515c45/docker-7.2.0-py3-none-any.whl", hash = "sha256:a3f45fdeb9165e2d25d9a1d02ddf3bc70fb572cf5ebbf9b58558c22caf29b71f", size = 148775, upload-time = "2026-07-09T14:53:45.224Z" }, +] + +[[package]] +name = "fastapi" +version = "0.143.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-doc" }, + { name = "opentelemetry-api" }, + { name = "pydantic" }, + { name = "starlette" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/38/d5/b0aeb0b303650ac87b0411de4aaf3f901b06042dcc3fb00f30b97b7ff585/fastapi-0.143.3.tar.gz", hash = "sha256:b9ab567ee57afb4454004ce04c889f8f0160ac47946b99795887cd6e88484848", size = 469834, upload-time = "2026-10-16T14:14:13.31Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/1a/03d246befcf307219bb2161c97d8c5d314f84125bf7dd245730a28589828/fastapi-0.143.3-py3-none-any.whl", hash = "sha256:75e8bd68e2f52f77d29b2879749c257d64de2d85282d25270caf2bfccce5efe5", size = 144849, upload-time = "2026-10-16T14:14:11.763Z" }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, +] + +[[package]] +name = "httpcore2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, + { name = "truststore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/cb/f3/1db7aa2bc2524062192bb0e0323969492d1883152a232fe36eea65f4e35c/httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103", size = 68071, upload-time = "2026-09-23T07:47:22.372Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/09/ba/a4568248771ce81957bfb7cc600264a40fbcda092391ee1c415c50be4bea/httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a", size = 83423, upload-time = "2026-09-23T07:47:19.365Z" }, +] + +[[package]] +name = "httpx2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio", marker = "sys_platform != 'emscripten'" }, + { name = "httpcore2", marker = "sys_platform != 'emscripten'" }, + { name = "httpx2-jsfetch", marker = "python_full_version >= '3.12' and sys_platform == 'emscripten'" }, + { name = "idna" }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d5/44/474bef2a0e9d90f1715d32cb98b0738695ca17ba324095fb2497ed7fbd59/httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa", size = 100405, upload-time = "2026-09-23T07:47:23.052Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d8/9c/6fe8931fd9f381042a9e4c7d5a7b4cbf7016b252bec0c99a49fce42c3326/httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4", size = 95597, upload-time = "2026-09-23T07:47:20.995Z" }, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872, upload-time = "2026-08-07T00:13:07.492Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, +] + +[[package]] +name = "idna" +version = "3.20" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209, upload-time = "2026-10-06T22:48:38.076Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552, upload-time = "2026-10-06T22:48:36.959Z" }, +] + +[[package]] +name = "opentelemetry-api" +version = "1.45.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/2e/02/6e0ae9cc61bd3169d401077b507b3ebc344745171e1051ab430be012dcd9/opentelemetry_api-1.45.1.tar.gz", hash = "sha256:aa38ed19bcc084ba42782a73255b3582283eced7ad6dddbd6695189e69adfb75", size = 72804, upload-time = "2026-10-06T17:32:58.133Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/41/f7dcf80b81ee8e71c1a2b59f14208bc723edbd89ed027a73b175abf6348e/opentelemetry_api-1.45.1-py3-none-any.whl", hash = "sha256:b31553efa588ae44bc306f863c785c5333a9ecc091248c6ee68b4b6c87fdedfb", size = 60256, upload-time = "2026-10-06T17:32:33.506Z" }, +] + +[[package]] +name = "packaging" +version = "26.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, +] + +[[package]] +name = "pluggy" +version = "1.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bf/db/7fc19e6f2dc92a966727031389fc2e08b558f0f25eb7403c1119ad4713cd/pluggy-1.7.0.tar.gz", hash = "sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8", size = 123304, upload-time = "2026-10-15T09:50:58.343Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" }, +] + +[[package]] +name = "pydantic" +version = "2.14.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7c/0b/8e10b2e693af8ec54346a14caf36221334775975a747c9ceaa3f8371d96d/pydantic-2.14.1.tar.gz", hash = "sha256:94f478203dd03404682a1ada216965651dd74b1d2d5ffd62e00e0837caab5c26", size = 900362, upload-time = "2026-10-11T18:37:55.396Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/35/ea/a56b9fe5066f3537b7882f77e9c5dfb26d8c2eefdaed9b5fc73d57b4dc22/pydantic-2.14.1-py3-none-any.whl", hash = "sha256:9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454", size = 488106, upload-time = "2026-10-11T18:37:53.437Z" }, +] + +[[package]] +name = "pydantic-core" +version = "2.50.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a6/24/af4ec4be49fbc810f35b0bdcacc3d433b56bbfa469fd3bfd4ae116cd9bf1/pydantic_core-2.50.1.tar.gz", hash = "sha256:e50d7b94baac6c7d09927fa5ca5800a0c7ee5015c7fcff65beb3a1931b5a6e09", size = 513515, upload-time = "2026-10-11T18:35:44.82Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/45/1b/ca81811da3d2aea724fb3c4ba6b83f50ab8f210576306ccd601973142d35/pydantic_core-2.50.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:c531166c42ea7bdfecc8c50049581f05dd1993b09cc7c52bb36a14e96deaec7d", size = 2152145, upload-time = "2026-10-11T18:31:58.046Z" }, + { url = "https://files.pythonhosted.org/packages/59/20/938ef7e0541af0a314e2f9d63848dbd1656ba2ebfe5ca0469f7ebee00d5e/pydantic_core-2.50.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b6d0c2183008c188e19f4906d426b293bdc4f67ab17df8e180fe16cda208fa71", size = 2045761, upload-time = "2026-10-11T18:31:59.35Z" }, + { url = "https://files.pythonhosted.org/packages/2f/4b/456497fe2affa18f49b226e89bde31e8a204751ee343dd9beaac5438123e/pydantic_core-2.50.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94be440c03fede26969a5ce75468e0e6a9927a1b46d9b679ee8adc1b057b0350", size = 2049557, upload-time = "2026-10-11T18:32:01.121Z" }, + { url = "https://files.pythonhosted.org/packages/a5/9d/cd5dfe13928f55e236dff3a1bee06721d318ca6c955d9ca993b0a5d09f39/pydantic_core-2.50.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:36c426eac0af8d1529ff8467e612b933346caec1fdc0d774f78f67a1a11e16c1", size = 2188153, upload-time = "2026-10-11T18:32:02.442Z" }, + { url = "https://files.pythonhosted.org/packages/fb/8d/d0b25bc484f8d9136ea76ece69e0b2d24ab370cc2e7bbd1b79e61723b763/pydantic_core-2.50.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:028e2f212273d4a39b1ec1e0de8166b1165a65fc0f1111452a9d94fc7c625c63", size = 2388308, upload-time = "2026-10-11T18:32:03.767Z" }, + { url = "https://files.pythonhosted.org/packages/c5/64/6513cac7c9f78492abafa01d57a69de1d246bf3085fd7b0330bf14b025b3/pydantic_core-2.50.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e6f0cc1bb9900dc558960894adeb30b0c083366fc1d69b856209fb2ca5c36fe5", size = 2431187, upload-time = "2026-10-11T18:32:05.159Z" }, + { url = "https://files.pythonhosted.org/packages/ed/60/7f2ae89c37e69a3dc0da9ff57b0388c285542c688d05f36767770429de85/pydantic_core-2.50.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8812592c85d0edf423f10eadcef42716d71e8219085ad9e85b775057b7306133", size = 2157623, upload-time = "2026-10-11T18:32:06.616Z" }, + { url = "https://files.pythonhosted.org/packages/87/02/e3a71373b85a7973099b9a229a4302c7792262717e0b4997e41c01f7dd16/pydantic_core-2.50.1-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:bbce99252ba3167b2b6277f1829d5bf4b43b754524bddf7f944707c3db7d2253", size = 2254539, upload-time = "2026-10-11T18:32:07.968Z" }, + { url = "https://files.pythonhosted.org/packages/3f/d5/5b620aaf40dc631d911565b64d49d3fa8422027c046a7a96dc4e4921ae98/pydantic_core-2.50.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:476f6ed8e43cd1e0b460920e23571700872b284e77331cb30c4faf459cf48a4b", size = 2267344, upload-time = "2026-10-11T18:32:09.399Z" }, + { url = "https://files.pythonhosted.org/packages/e0/48/f46baf4580d8a56ca4782aa65842e16d3cf39736b29fcce8e9c0521b3422/pydantic_core-2.50.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2cbd1b75b09e976ed0d6b6ca297675632ca35df86130088457cdc60ef36970ae", size = 2300877, upload-time = "2026-10-11T18:32:10.903Z" }, + { url = "https://files.pythonhosted.org/packages/2b/9d/e7d28505e6092c1fe075838a4f793ccbe6dd676e44ab16175815ee06cfe0/pydantic_core-2.50.1-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:5958c72adb417c39b12ac87525ac60b0d73315fcdc59e21f44ee4a5e2512c9ef", size = 2464270, upload-time = "2026-10-11T18:32:12.329Z" }, + { url = "https://files.pythonhosted.org/packages/22/b1/3bf63b82efd93ebc9968f9c12fc46037a28bcb452c88e4688f33e5ff7dca/pydantic_core-2.50.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d8f9e8a6c4ab04b78d61f78627370d834eb004b2869dcb28cfffa647b4ea1980", size = 2478653, upload-time = "2026-10-11T18:32:13.735Z" }, + { url = "https://files.pythonhosted.org/packages/28/17/26d1e4b9c2ba6a92b7dc75bbcb99ef44456b7e3af1bced868403667ea7d3/pydantic_core-2.50.1-cp311-cp311-win32.whl", hash = "sha256:4be846f55c9477f5f3ddde8f2ce941137e16862a56d018ed885d422bb6ae02f2", size = 2120246, upload-time = "2026-10-11T18:32:15.591Z" }, + { url = "https://files.pythonhosted.org/packages/24/65/3e875e7991eaecd4d70686293ff0d8a99aa8f93dc295e6a21c3d702912fb/pydantic_core-2.50.1-cp311-cp311-win_amd64.whl", hash = "sha256:0048b6dddc8ef4b64fccaad878bd143b0c3882ea9936279dc11d613f6b7dd1bc", size = 2176332, upload-time = "2026-10-11T18:32:17.153Z" }, + { url = "https://files.pythonhosted.org/packages/ab/5c/58dbd17c61f209d91c70f549eb7a3bbec7023e89ea12dead091462d6d658/pydantic_core-2.50.1-cp311-cp311-win_arm64.whl", hash = "sha256:6a733778df2f7087ec1100ed0b41533e4f3001976e99570fa34f57c66e7f8e3e", size = 2182471, upload-time = "2026-10-11T18:32:18.49Z" }, + { url = "https://files.pythonhosted.org/packages/ee/94/101b49a6c63f99586755690696eae14532772587d9e39e93f7b8d28a49da/pydantic_core-2.50.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:704075d10b74f2f3c6e15407c696d88701df35fc8953f434a431add0d0074db0", size = 2222428, upload-time = "2026-10-11T18:32:20.228Z" }, + { url = "https://files.pythonhosted.org/packages/db/a3/f8b1b39349c33037c73d7a1b794c9c29d8f07d5bd2b74399c1375a529cc6/pydantic_core-2.50.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e8e1d6ce820aa23317e8209a86bd65a540973c12dc7552b48a4f6c8e9926815e", size = 2025779, upload-time = "2026-10-11T18:32:21.723Z" }, + { url = "https://files.pythonhosted.org/packages/d2/2d/862a7d115305cc621358e51ba13f296e0ffdf4fbd984be9f63bc7862730b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c18db21573bd2c6489f9a544b7499f0df2853958c568e5e783536ee1f690af41", size = 2048429, upload-time = "2026-10-11T18:32:23.3Z" }, + { url = "https://files.pythonhosted.org/packages/c0/7d/fed95d18bf2b5abe2d5ab2bbec4184bfc22b6805994a33ccdae8edffd25a/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cb57f304525a5e3c13333b772bf9a473f36326e9c821b2e8e1b2fd36f80ae2c3", size = 2173274, upload-time = "2026-10-11T18:32:24.697Z" }, + { url = "https://files.pythonhosted.org/packages/93/1e/c6f22ceac65dc3d291ff79bea0eb74cbd1de8b128f01fee48af03bcea1e1/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a27c09d86600f1bf2fe3f37e1ae697faf3143931c09322cd799da94deee923b5", size = 2360403, upload-time = "2026-10-11T18:32:26.281Z" }, + { url = "https://files.pythonhosted.org/packages/2c/97/190b5b6bfe4c72f265feb657913eb30749193927a5ad7b83cfa7866a25a2/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:46b3301d3b5c886f77de7546e47274a5842c622ea2020b8c6524c6b66913b4a6", size = 2439799, upload-time = "2026-10-11T18:32:27.844Z" }, + { url = "https://files.pythonhosted.org/packages/90/24/48cd98388e4ac2c08d0800af36d15413db15e20387f1038123a2c86cb2f6/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e", size = 2160157, upload-time = "2026-10-11T18:32:29.553Z" }, + { url = "https://files.pythonhosted.org/packages/00/86/d909133d0b9979ed14c20f110f21124a0e346caf071bd66ac5af3009062b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:e5faeaee74a57d32b3ab3aebad2e348f06d3ba946fc5d28c1728455f00a3d13a", size = 2229523, upload-time = "2026-10-11T18:32:31.027Z" }, + { url = "https://files.pythonhosted.org/packages/90/31/4b43f08131b2098e73a852fd932063385f3103b33839fd9d1abdb89e673d/pydantic_core-2.50.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3cda0e538208e5d722bbf3698b24f19c0a7d05bc8d5f8a7f9b121ea7fa243d9", size = 2242700, upload-time = "2026-10-11T18:32:32.622Z" }, + { url = "https://files.pythonhosted.org/packages/88/77/de39658569dc7a4c293d110a89629f61145e7538f00d1e4280c28debefd3/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:57f51b31ff826e2859120cf4737c5a758a48d96f3e97da40ccee1796d58078ff", size = 2278452, upload-time = "2026-10-11T18:32:34.165Z" }, + { url = "https://files.pythonhosted.org/packages/46/bd/1eeb9e4e791e81210ef9096f58080b32ba15b5b13c108d50aaa3f8ce9f73/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8daa7ee75245d43ad7d747e5c9ecc1b1d06552f72b14887e9276f787d57375f4", size = 2450098, upload-time = "2026-10-11T18:32:35.547Z" }, + { url = "https://files.pythonhosted.org/packages/1c/e6/b2accfdff17e5a88d6358536702146de00f9339adaa4d5bbe1ee93cb4832/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:acbf31f37c53a5ac0c34706c80b4f5107ba20b05fdd3816124bf236ef0c57dd2", size = 2476839, upload-time = "2026-10-11T18:32:37.119Z" }, + { url = "https://files.pythonhosted.org/packages/3b/7e/c8a83eb5d2cd42c2e13507150fb777b1edea5a018adc9cbf2858a1d08285/pydantic_core-2.50.1-cp312-cp312-win32.whl", hash = "sha256:45b11cac094aa25725581d9304eee93c9028516b9ea80dd9e175e13a5a2c840e", size = 2101425, upload-time = "2026-10-11T18:32:38.593Z" }, + { url = "https://files.pythonhosted.org/packages/c5/17/8bbd530b8659e9d963f5b16f6cb8e159f4cd174b4d6304e48969ab12dba8/pydantic_core-2.50.1-cp312-cp312-win_amd64.whl", hash = "sha256:132529c83901437ff642f585216831bf5fd7a91df66829907e155192ead62498", size = 2172522, upload-time = "2026-10-11T18:32:40.112Z" }, + { url = "https://files.pythonhosted.org/packages/af/9f/a79d690b127e4e3cff143d031538ab9aa715f6b2fbeecbd07cd6f2bf9fb7/pydantic_core-2.50.1-cp312-cp312-win_arm64.whl", hash = "sha256:4e834f6a8e4ff772dcc34f58ef5504147a3ea5b0f4eeb13b0f8eb2ca75ac57f1", size = 2161366, upload-time = "2026-10-11T18:32:41.606Z" }, + { url = "https://files.pythonhosted.org/packages/ae/57/0e237d7091d2cd44a35d243b7344227f90440166860469cd036afc23a04d/pydantic_core-2.50.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:d5e062c01286d861fd6a1c4ff6e063547b3e713067f2df033c0ff97ac2ca006b", size = 2222774, upload-time = "2026-10-11T18:32:43.103Z" }, + { url = "https://files.pythonhosted.org/packages/f7/b9/c720e56858d4e1539503297ed37063e0c08e0f3541c41b777f6a800f75fa/pydantic_core-2.50.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0c003c3b7f49debb893d2d85ae099ac5959c9839e2f330fadb1fcdf7a6594482", size = 2024738, upload-time = "2026-10-11T18:32:44.587Z" }, + { url = "https://files.pythonhosted.org/packages/4d/b8/fbfc25875219cc060e613170ff10e850c6d8924beb4910da57c2ee3ba1d2/pydantic_core-2.50.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:409e0ea40ec30d9158f33574fd758e689f6045a0f2596701828c27816ca9687d", size = 2047049, upload-time = "2026-10-11T18:32:46.164Z" }, + { url = "https://files.pythonhosted.org/packages/d7/43/34210124d504c553688f2f04b48500b131237528ac545b445e0d6d30e0d5/pydantic_core-2.50.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:131059670f1d2444269b8585cb888963994871932447c08b39ac6a51fcfef658", size = 2173415, upload-time = "2026-10-11T18:32:47.722Z" }, + { url = "https://files.pythonhosted.org/packages/65/cf/6e178e8fdc11da5965bef980983bf46326a42f436871dd51ba0a57f39df1/pydantic_core-2.50.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6dbcbee53bf17196a7f745aa9bf5a9603953a1e365b1f020be3207c676a3e7c4", size = 2361719, upload-time = "2026-10-11T18:32:49.217Z" }, + { url = "https://files.pythonhosted.org/packages/11/14/bd5169d356aa91bf777e28ba0b281c192d286d03c2812c9c9db023a2f00e/pydantic_core-2.50.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:325c23f3e35cfbf0fe3486fa5f7260d1e45885173002d30a28ca019994124255", size = 2439803, upload-time = "2026-10-11T18:32:51.025Z" }, + { url = "https://files.pythonhosted.org/packages/1c/bc/d79d000e5203ebef39af839f2ce77a777fcad6e08ad26af9a2fcd114ffc8/pydantic_core-2.50.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17e722e156d0444ecaefbe640bdb60928752bf2013e2b7a11cdb099aaae19bec", size = 2158402, upload-time = "2026-10-11T18:32:52.714Z" }, + { url = "https://files.pythonhosted.org/packages/1b/a5/4902cb5fd599422c130bd3124ab31ee8b771199bd56662702eed07d3fec7/pydantic_core-2.50.1-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:aa8224f10880d9bf1b5993988ba153d42a8b4f3f4f511f93b1f09c93ff613c72", size = 2229755, upload-time = "2026-10-11T18:32:54.126Z" }, + { url = "https://files.pythonhosted.org/packages/1a/f5/c1481f8669f6060d89110c9b1374173fc8767ca276b84f4870bd8acd5e3f/pydantic_core-2.50.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:41bc8237121bd8dc8d888dfd6279fc166ffc88c1f1bf3a8bf00869680533ca4c", size = 2242303, upload-time = "2026-10-11T18:32:55.641Z" }, + { url = "https://files.pythonhosted.org/packages/04/f9/77fc3c7653ba9b6e42049e17e96b25388187d4a7c274ab1cb07f58ac8419/pydantic_core-2.50.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:45c6266d071c241f2a168d45bf8c54344f0effce35e7e6b73afdec11f3687568", size = 2278345, upload-time = "2026-10-11T18:32:57.38Z" }, + { url = "https://files.pythonhosted.org/packages/95/9b/0579c5d12e7f2b16b27e6782427987341fcce07b0725e02ddb0b74add0c4/pydantic_core-2.50.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:1deeacb112d14d3f4fcb16b165f7dbaf76c70ba6e82f37ba042bdab51970a0b8", size = 2449947, upload-time = "2026-10-11T18:32:58.896Z" }, + { url = "https://files.pythonhosted.org/packages/a8/ac/1b677db91eba54cc5922f4de6edc46ba45c2bd712dfdc0130382d158e214/pydantic_core-2.50.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:1c96fd793b73d1b92e65570132505498fe7b21eaef73cdf74e67e5dfba7ac9e4", size = 2476889, upload-time = "2026-10-11T18:33:00.665Z" }, + { url = "https://files.pythonhosted.org/packages/4d/2a/3a9f6624ee3ea9ccba5249dde11418bb4c35780a7a92608f8768bd3fea39/pydantic_core-2.50.1-cp313-cp313-win32.whl", hash = "sha256:06ead20d39ffd6f2f6f2a8f8a6de67ff8bb1b4f14a8a30e058502514ee2ac685", size = 2101118, upload-time = "2026-10-11T18:33:02.329Z" }, + { url = "https://files.pythonhosted.org/packages/2d/1f/323f78ddd9d9938aac420c1abb4e8ba799fc8bdab0acc67c0593b837c979/pydantic_core-2.50.1-cp313-cp313-win_amd64.whl", hash = "sha256:7816e98acc08119dc0f340ab167048ecc54126316330c1f0caf7c6756c88e28f", size = 2170840, upload-time = "2026-10-11T18:33:03.919Z" }, + { url = "https://files.pythonhosted.org/packages/cb/09/8497c52a739ae425c3ac2f7f56414cbc711c67d374346174f40fe2062644/pydantic_core-2.50.1-cp313-cp313-win_arm64.whl", hash = "sha256:c17799a62c142d61b8a3c51752a7cbc87fe2ad4ccfab10e628a77b405075c662", size = 2161633, upload-time = "2026-10-11T18:33:05.518Z" }, + { url = "https://files.pythonhosted.org/packages/49/33/28b96e81677153715e3eafb9f26663a80841e859fde282a380359b0d3fa1/pydantic_core-2.50.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:1cf41f1ae3fa155cf167a72689ad044bcc1e3c97e064123677149bdfb5dafc4a", size = 2224428, upload-time = "2026-10-11T18:33:07.153Z" }, + { url = "https://files.pythonhosted.org/packages/94/40/15c06410c9b7b8da5805d27b64e09bd3f900e986728106db2689dbc51513/pydantic_core-2.50.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4df197990c15b5a37c5a277d131d9f2c67de6133f2e5dafd80d9bba4b99f46f9", size = 2023740, upload-time = "2026-10-11T18:33:08.763Z" }, + { url = "https://files.pythonhosted.org/packages/a1/4e/5eb629f6efc2a27e421d789dd4bfacbb5f6d09c80c28b13d1e87d73163d5/pydantic_core-2.50.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0036473f5583e6a60e50b8b21651511564277a3f05cc5dab8cf579f552cd5f6c", size = 2049435, upload-time = "2026-10-11T18:33:10.366Z" }, + { url = "https://files.pythonhosted.org/packages/ba/8e/f195aebec49ad12318876ac2368c197a7939f5d52f8e156d2238ef8a4588/pydantic_core-2.50.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:992c3514ec891fa7858099183e4d64e6bd5a5d4ff452fae29df22faa77a006bb", size = 2172975, upload-time = "2026-10-11T18:33:12.368Z" }, + { url = "https://files.pythonhosted.org/packages/e0/f5/7ad9fb83010cd5ea0948409db105676ed779c4e709e2d3d89b9fe2558794/pydantic_core-2.50.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:739dc730e6be3bd5ec2f4ab5cfc7eb047cc45fc1497b3bafec74ff2ed07df597", size = 2364197, upload-time = "2026-10-11T18:33:14.244Z" }, + { url = "https://files.pythonhosted.org/packages/ca/fb/bf0aab3e78301d202b82a0322ec968cd703b11fc0623fde9a28708936f62/pydantic_core-2.50.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:32fad3a91e51b6d2039c572db04a5a873260b399f6bd62c3552671fa7a4a2899", size = 2444259, upload-time = "2026-10-11T18:33:15.79Z" }, + { url = "https://files.pythonhosted.org/packages/45/35/38f6d6564fae57d9b12e5676dfa947e0e7d5c46dbeaa7eb3352261d6d299/pydantic_core-2.50.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42b54c2c90ad348b5e3a85e03e715d572c1fde357ef104cdfe3b03b697a404ea", size = 2159857, upload-time = "2026-10-11T18:33:17.51Z" }, + { url = "https://files.pythonhosted.org/packages/65/a0/fb0a3ca10f139dcf765b2d312d10cf0f65c57c59993229d00ad12b14ceff/pydantic_core-2.50.1-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:2df1ff41884de2bc4b307bafd7c40a691094fad2ff8e767e5b45a319257bcf4e", size = 2233954, upload-time = "2026-10-11T18:33:19.591Z" }, + { url = "https://files.pythonhosted.org/packages/8c/6a/e63842252702aa4ec6e6b7178ca85e541a77459076592c23ebe2d9840b33/pydantic_core-2.50.1-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe90228920fd8ff2be62622b6bb8a2b11acd65046d50c6b130614b5879605a20", size = 2243876, upload-time = "2026-10-11T18:33:21.393Z" }, + { url = "https://files.pythonhosted.org/packages/39/25/5991cf8318b37e0dfab47b87541619a1df8501a793cba0d978846cba37a7/pydantic_core-2.50.1-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:844b869f118e22a41a091bdcedda8a71bc1b0f62c38d1a0c3211cece47e1d8fc", size = 2277908, upload-time = "2026-10-11T18:33:23.324Z" }, + { url = "https://files.pythonhosted.org/packages/a7/3e/3ee8baaa6cc25a6961c69168cf9ff0f002d56f4e0d541ad6724c18fb61f3/pydantic_core-2.50.1-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:2eb75304506894a281d346220a4f7481a1b8729577c5ed2a05395991966a8396", size = 2449285, upload-time = "2026-10-11T18:33:24.942Z" }, + { url = "https://files.pythonhosted.org/packages/c0/c7/acbec6deac13fe697a80c275a9b6661db62c4d323bac8a47347b1f39c7cd/pydantic_core-2.50.1-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:6b20a4bffabdad0db2927ac034ae3b8a681b1f7a0182f3e60b479ad2fde21ebb", size = 2479013, upload-time = "2026-10-11T18:33:26.925Z" }, + { url = "https://files.pythonhosted.org/packages/10/08/21a3f237b264389f6219d053ee78fc1b5c2fd402c1b1cb2b6cb8b85f9834/pydantic_core-2.50.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:99ba9bc2b8062ea0c326a990f7f00e6530c23579de66dd246e72c4cafef950a5", size = 1484400, upload-time = "2026-10-11T18:33:28.693Z" }, + { url = "https://files.pythonhosted.org/packages/09/ce/077a6d262d12ef09108377ac0717f029f420d773ace63cafd6143af75568/pydantic_core-2.50.1-cp314-cp314-win32.whl", hash = "sha256:cf356f70551d40374eaffb1aa63f1eb6d2006681cbd7a9faea173ce0f4dd7cd2", size = 2103222, upload-time = "2026-10-11T18:33:30.326Z" }, + { url = "https://files.pythonhosted.org/packages/14/4c/350a2415209c43d670eb71d3c040f332c04a30583d39e311b05c7ac15762/pydantic_core-2.50.1-cp314-cp314-win_amd64.whl", hash = "sha256:d32f3acc081cc3923386d88f422cde8892335e95f034e0104bb4cf9310d9915f", size = 2171586, upload-time = "2026-10-11T18:33:32.139Z" }, + { url = "https://files.pythonhosted.org/packages/bf/92/9bea6ca96580a0902fed366f064f0829e404f41889b34543279a1162b888/pydantic_core-2.50.1-cp314-cp314-win_arm64.whl", hash = "sha256:bed5163e03b98bc1fa2eb05d74c63d9c5c95d8ed6254985481640fbf5e237dea", size = 2155773, upload-time = "2026-10-11T18:33:33.896Z" }, + { url = "https://files.pythonhosted.org/packages/86/8c/f121f073cf32bdd5cba7e6230b1ce0ac845b0cf43e44dd597d95af272db2/pydantic_core-2.50.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:9572c1369e9c9da2d64a7b7992c786d90ff295abc93964cfe3125e4290768070", size = 2234017, upload-time = "2026-10-11T18:33:35.588Z" }, + { url = "https://files.pythonhosted.org/packages/a4/69/2bb2bcd6146cffe98d760a46c42ae71efd5151d9b2f9c9bf6619a3b32083/pydantic_core-2.50.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2005207aafe1231315718bf6ed5d064a7300fb4772754af35ee72fc68159492e", size = 2001016, upload-time = "2026-10-11T18:33:37.57Z" }, + { url = "https://files.pythonhosted.org/packages/20/b3/fbf854c7d07ec114260c26e9e2071a4381740f9ae09641dbfcbdf2a18c45/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64f6047f62a6c5ae08d0a6afb035667aa2d97c3d20d69762e034c5ea144d92a5", size = 2023015, upload-time = "2026-10-11T18:33:39.433Z" }, + { url = "https://files.pythonhosted.org/packages/65/20/6de55b2f92cdb614b745c6e9ced639fc4fd7e1e77604825a88bdece6fcbd/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1ef800dd7d85bcdadf4c3076e4c94e43939493558a3b69a1ea830c706d4617bb", size = 2192543, upload-time = "2026-10-11T18:33:41.381Z" }, + { url = "https://files.pythonhosted.org/packages/0c/d9/19e91c94bd5c405945ce2f15526808aea37e162c253160de8ed7bf70b406/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b0135bcdcaa0f23573f286e4cb5e0fd2962700964ed13df085b85f2b97aeab9e", size = 2388704, upload-time = "2026-10-11T18:33:43.167Z" }, + { url = "https://files.pythonhosted.org/packages/b6/bc/2e24c8415eae1a25ee5a5484946a917123bad2e9d01689a759236928175a/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0b3a6f334c6a2345ca15318ff894502a90012536404b37c844a976c76c846e0b", size = 2464118, upload-time = "2026-10-11T18:33:44.856Z" }, + { url = "https://files.pythonhosted.org/packages/bd/1f/945b8053cb061c64e102bcaf7bfb9ed740c0bd4349f9bb978a7d4ddff4ab/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06e01fbbfdb9be777b316a71b6c49efaf4a08b615d0a98d678cda3023f79d019", size = 2150142, upload-time = "2026-10-11T18:33:46.661Z" }, + { url = "https://files.pythonhosted.org/packages/2b/78/96a3e50bf0d64aaae781107eb9335b7529d05a85793ed6e7241c4cd1d931/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:a29a061fec0b4e2d714f277e70a3a18125ecff803f2fea6eade2f2e53711d112", size = 2245577, upload-time = "2026-10-11T18:33:48.574Z" }, + { url = "https://files.pythonhosted.org/packages/7a/5d/a6038a0322232758a6ebfa709f4ca14a60bf5b93940cd0b345056a557da4/pydantic_core-2.50.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f5187624823423e1d1b82b1072ac41dc837389e18d3d0572cc19bbee46cd550a", size = 2263728, upload-time = "2026-10-11T18:33:50.527Z" }, + { url = "https://files.pythonhosted.org/packages/0d/4b/76ded3333a457a9344c4f2d63f2d82d0101654b05178fa4ddfe7d3627674/pydantic_core-2.50.1-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:3e46a9eb0a0901dd6275e6b06ac3a464885ef350ec4121fe486869de8053e4bb", size = 2293630, upload-time = "2026-10-11T18:33:52.362Z" }, + { url = "https://files.pythonhosted.org/packages/a9/00/9eca378335c9c1b72bc779bf6e4c2a82ce784f14ec48a0e87102c9870e05/pydantic_core-2.50.1-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:756d669f04e62ec4148ecfe22be6a4484d9b1181a6ef32e205ebfd200540858b", size = 2468048, upload-time = "2026-10-11T18:33:54.118Z" }, + { url = "https://files.pythonhosted.org/packages/35/ca/e3832e9cf93651251de43c8c5c029ed680a3c1a0a1b17ee26c81bed08cbd/pydantic_core-2.50.1-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:c516cc5367ca3448995d42cb994bf3f4c9002d2a7c22eac9622551269ad1b807", size = 2512159, upload-time = "2026-10-11T18:33:55.99Z" }, + { url = "https://files.pythonhosted.org/packages/4b/f2/773469b5a10a39116a2cb17edaf6d722f017dd8da07161b371465311c542/pydantic_core-2.50.1-cp314-cp314t-win32.whl", hash = "sha256:9d1bed94af6a63835461f3cf7502058eb166c58c4778e11d0f433cfb1bd69e19", size = 2098406, upload-time = "2026-10-11T18:33:58.043Z" }, + { url = "https://files.pythonhosted.org/packages/ee/42/0bb74f8f25204b259b11ab7c12dc7f180893b6bd706118b385147fb6efd5/pydantic_core-2.50.1-cp314-cp314t-win_amd64.whl", hash = "sha256:c8dce1f1e0e5358b682a6ad3fa5e31b31d4560997b8e61417e9217c8d60f8a0c", size = 2148481, upload-time = "2026-10-11T18:33:59.913Z" }, + { url = "https://files.pythonhosted.org/packages/47/0d/d801646c9679a4e630e15cf521d4108b93854b42a6e6e02391bd4c6b1095/pydantic_core-2.50.1-cp314-cp314t-win_arm64.whl", hash = "sha256:ceff0acc940be2715bd6ad17b24c0e5304abf44f6efd0f81ee8499e640f9dc86", size = 2174972, upload-time = "2026-10-11T18:34:01.875Z" }, + { url = "https://files.pythonhosted.org/packages/b2/84/23984b763d8862a02a13d27a44b6e8169428fd85ecfed88f54c29108604d/pydantic_core-2.50.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:8a6791afa2245e6c6b180122d105941644f5bd410bb18623b408808cc41a3102", size = 2224599, upload-time = "2026-10-11T18:34:04.016Z" }, + { url = "https://files.pythonhosted.org/packages/4d/90/a63cf8586abc1d1a3f6d9b18f0224789ebf003851f092ebda3c7c863fd32/pydantic_core-2.50.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:84f34323a61a365b4e9295de6028474754829aaddd59c7bf1a040e7487ef8f3c", size = 2024191, upload-time = "2026-10-11T18:34:05.901Z" }, + { url = "https://files.pythonhosted.org/packages/a6/6a/f34bff9808ffb4907fbf5f5040457d253cacf2da7fce9efbc99ca1b1a44d/pydantic_core-2.50.1-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23edad659e8dbd8ca7e4e877fe6c81573abbdf215bd25a68b53e1272f58b80c7", size = 2048252, upload-time = "2026-10-11T18:34:07.757Z" }, + { url = "https://files.pythonhosted.org/packages/b2/54/13f419bf1eb59852003818e25935aaf175687d978f4c4bca70e08fe40a3b/pydantic_core-2.50.1-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a5fce22f1e87d181e924e12da7d81cfe031fb3881a5ddf26ad28f141756ca43", size = 2173376, upload-time = "2026-10-11T18:34:09.592Z" }, + { url = "https://files.pythonhosted.org/packages/6d/6c/b5a34d24cd0c81669d8f8339d74e6815abcf2f8fb48ab4b49b84c09be1d5/pydantic_core-2.50.1-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c73622ef819328873b53109ee4f77ceb598bffedd02daf916102be3228866b78", size = 2364559, upload-time = "2026-10-11T18:34:11.534Z" }, + { url = "https://files.pythonhosted.org/packages/eb/8d/d64d6216a8df365082665927ff923f183056f9049fee08e9777c9ac05296/pydantic_core-2.50.1-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ce8c25ca38cc0e3d7753ba180808de2c0c8cb24eae0df64491e40921454e9831", size = 2444697, upload-time = "2026-10-11T18:34:13.535Z" }, + { url = "https://files.pythonhosted.org/packages/b8/0d/1b1149f60a00ea21ba5f70e28acbd40feb4598af414f80f53c921fac07c9/pydantic_core-2.50.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7689580e72a642ab5ec64d5f55b2e33636fa43b4ebe63c0c2c965ef307c7d1aa", size = 2159961, upload-time = "2026-10-11T18:34:15.56Z" }, + { url = "https://files.pythonhosted.org/packages/1e/35/f236549299dcc78e71e945495d7ec67e78d20844d0999c60601685003031/pydantic_core-2.50.1-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:d5c0e32fdbce7f1e8ef4d11f655694bf5f4175c757a9f1dc2be09b8864e5bcf5", size = 2234581, upload-time = "2026-10-11T18:34:17.502Z" }, + { url = "https://files.pythonhosted.org/packages/6a/85/26901a490522b7f75ef9bb9a7afb73e5bb550f0e1cb5b99a0069183e2eb9/pydantic_core-2.50.1-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:40f523349960fa30f3ea51404308ff50f9997a90df639590f47a057c1f32b415", size = 2244090, upload-time = "2026-10-11T18:34:19.402Z" }, + { url = "https://files.pythonhosted.org/packages/ca/2c/481bcfc70ceeb77a778ca6e5b705fe592cb64735c108157f81b7dd9c280e/pydantic_core-2.50.1-cp315-cp315-musllinux_1_1_aarch64.whl", hash = "sha256:d4193206b6587047437f6f11d7e776df23e1c1e23af2a54d9347275614791e10", size = 2277948, upload-time = "2026-10-11T18:34:21.317Z" }, + { url = "https://files.pythonhosted.org/packages/24/eb/f1e09333faa7ba447cde967310f758430cc7c5e987bdab5228816c70030d/pydantic_core-2.50.1-cp315-cp315-musllinux_1_1_armv7l.whl", hash = "sha256:84bc765b282a9d5b7fe0348b8648904f25a6a04b2139da52b1dd30c8ac3a2c8f", size = 2449688, upload-time = "2026-10-11T18:34:23.321Z" }, + { url = "https://files.pythonhosted.org/packages/d1/b3/036bde636db8f76d92996e81aefc75678ab5cec4a07eea1ad0c72a893fc3/pydantic_core-2.50.1-cp315-cp315-musllinux_1_1_x86_64.whl", hash = "sha256:ed1e728b39a383c81035b2459cfcb35d99dfb01f7d6ebe3a913bc1cc5b81e459", size = 2479286, upload-time = "2026-10-11T18:34:25.214Z" }, + { url = "https://files.pythonhosted.org/packages/d0/a3/07f018294ee18d144afeb6df1a47d9e92960f014be45c5ed13519fa5af95/pydantic_core-2.50.1-cp315-cp315-win32.whl", hash = "sha256:bc94f474417604bd383d2cd445d071b07dd55fedceed3ce33407bf1fcc107290", size = 2103683, upload-time = "2026-10-11T18:34:27.42Z" }, + { url = "https://files.pythonhosted.org/packages/5f/98/f9bd7e1f9b6709f155acb9ef826d9c3884fe925f811fd8e55b9b52280bad/pydantic_core-2.50.1-cp315-cp315-win_amd64.whl", hash = "sha256:983a662de2571cb2502fc8ff47b6770b03d025d2eb314c92f77b3f07c74720ed", size = 2171681, upload-time = "2026-10-11T18:34:29.508Z" }, + { url = "https://files.pythonhosted.org/packages/10/87/4bb3e1e7f385c076ab5af4d6dd0571b22042cd8207eb810d5b9fef15ae31/pydantic_core-2.50.1-cp315-cp315-win_arm64.whl", hash = "sha256:94845ff54dc5193f228cab81b2662a04bfbb892e95bdc15edf7399000ce57d54", size = 2156251, upload-time = "2026-10-11T18:34:31.455Z" }, + { url = "https://files.pythonhosted.org/packages/47/47/83643225b08f2aef6c8cc4bbe6e3f79c5e139c4364a6e450d0f399d87774/pydantic_core-2.50.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:4a53d13cdfbedbfa87f08b83c1a0a5efcc767d785a4b41934fa9cb672670493a", size = 2234363, upload-time = "2026-10-11T18:34:33.65Z" }, + { url = "https://files.pythonhosted.org/packages/5e/66/127ca649ba2f2462039dc1e694c6c01e00a3689f023a617364d3507e6d97/pydantic_core-2.50.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:efbecf43d321f7b9281441f1f213f7c21c66988b0e06c2730ba13ed47a46bb08", size = 2000972, upload-time = "2026-10-11T18:34:36.037Z" }, + { url = "https://files.pythonhosted.org/packages/5e/4f/e421e0a5d653b1203b090b2e48745976988d7338a647940704b5b9c2b399/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bc1f08f68dac9f9e83845a8039880aba2ab553eb9b2259c3243a313182c253fe", size = 2022925, upload-time = "2026-10-11T18:34:37.972Z" }, + { url = "https://files.pythonhosted.org/packages/d5/4e/ea5568e2491e1a71100f15ae8c2d01ef52db42a184a2d4e716bc79e5eb8f/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5dfe41f232befddb9c4377f6cfc702b51595e2d78ed082672adf8758d2c4619f", size = 2192867, upload-time = "2026-10-11T18:34:39.921Z" }, + { url = "https://files.pythonhosted.org/packages/ae/5e/3b8c3a35acbe219909ada5defad5d7d9fed845fb2b37bd5ec518f453c119/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:adc06d218a1cadfd2ec4628424d7d79ce4eba69c2965e7e7b55106f0da5208c8", size = 2388687, upload-time = "2026-10-11T18:34:42.184Z" }, + { url = "https://files.pythonhosted.org/packages/b6/aa/7889b4e515f91a2e8c0ae6b5081fec0feb30c4398d1434e14793c60f173a/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2cf91809d0721ab81592ba67bea7694821679c10b1a2e3c3460082b286c1918a", size = 2464415, upload-time = "2026-10-11T18:34:44.384Z" }, + { url = "https://files.pythonhosted.org/packages/08/78/93449e628eb8a6fdcce3eff9043081179d1bc7ce6f1bff32dc5006f41e00/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:23923ab9292c40da026330b1ecf4dc2618c8e86e0422e5d1fbf50d94d64ca4f8", size = 2150823, upload-time = "2026-10-11T18:34:46.392Z" }, + { url = "https://files.pythonhosted.org/packages/f4/f1/72c5bc129fceb0d00f05dc1e67f518c1728de1928c55f81fc13d7690de39/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:f3377c8c2b3ce898423c5e5dd94c7982e30aa7717a7e6ab2470b9de364963709", size = 2245806, upload-time = "2026-10-11T18:34:48.805Z" }, + { url = "https://files.pythonhosted.org/packages/28/2a/922a0e78f3aa6ab837b59f88190233fb8dad546c17995fde9bb3ed3b9b49/pydantic_core-2.50.1-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:455a773617b5913bf5c20d0692e5787b119e52c4d40ea644ca31f5758fd31be2", size = 2264160, upload-time = "2026-10-11T18:34:50.876Z" }, + { url = "https://files.pythonhosted.org/packages/52/a8/0f1449e3e1b20941c9372faa18e7b6a092e30cdfa841902473f7989532ac/pydantic_core-2.50.1-cp315-cp315t-musllinux_1_1_aarch64.whl", hash = "sha256:1a9006395dece0e32e704c315eff8a00bede494f6108546cfc5539c89fef4f9a", size = 2294031, upload-time = "2026-10-11T18:34:52.876Z" }, + { url = "https://files.pythonhosted.org/packages/d1/d0/1031f492857de70355fb16524bbb03efce5fd34c93ed4a1ec60be07e0d4b/pydantic_core-2.50.1-cp315-cp315t-musllinux_1_1_armv7l.whl", hash = "sha256:d2d82aa62521c55ddfb000ae70f88cdd8de974078f6024e821dfe5addd0c818f", size = 2468423, upload-time = "2026-10-11T18:34:54.995Z" }, + { url = "https://files.pythonhosted.org/packages/46/52/269ffffa645b8e47906395a39cf9db1151ae9fa4bcd7f47b960bc31baf37/pydantic_core-2.50.1-cp315-cp315t-musllinux_1_1_x86_64.whl", hash = "sha256:009634b83993777ddcd69cad0ffcace43dabde692109528e35f0fde91e386a8b", size = 2512598, upload-time = "2026-10-11T18:34:57.149Z" }, + { url = "https://files.pythonhosted.org/packages/31/5c/e47e28281f20326ff6f3c31d626f0a83e615d2d94ba41bb0ad6ec237184a/pydantic_core-2.50.1-cp315-cp315t-win32.whl", hash = "sha256:3fde4fdc6487a58d944ca87cf5adc95d5f266e872c19599f5f4c0a8a1b1f9f9f", size = 2098535, upload-time = "2026-10-11T18:34:59.313Z" }, + { url = "https://files.pythonhosted.org/packages/03/ad/759e181e69c1b472c60b2049e5f61d5da1deefdd5ce1df4bb2ebcf771f25/pydantic_core-2.50.1-cp315-cp315t-win_amd64.whl", hash = "sha256:1c8632d4ac04e6f91128fca584b3a8a507d81604c24eeaaad00d4be42765c32b", size = 2148645, upload-time = "2026-10-11T18:35:01.571Z" }, + { url = "https://files.pythonhosted.org/packages/6d/56/8a702c27e5be9f47e5f19d8669227424290e4c024e7c370279cbaf244b4e/pydantic_core-2.50.1-cp315-cp315t-win_arm64.whl", hash = "sha256:c3ede305158e75510be50869b319550ab072008c13d64d4ab1e094fb286b6f44", size = 2175297, upload-time = "2026-10-11T18:35:04.079Z" }, + { url = "https://files.pythonhosted.org/packages/e7/73/a23a327237d9bb985298ce47702e196f995ce850224c12c70886bd66bb5c/pydantic_core-2.50.1-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:062e891facce5ca296a1c37098e5e466780457f86413894b399f0cf22934f769", size = 2162560, upload-time = "2026-10-11T18:35:06.274Z" }, + { url = "https://files.pythonhosted.org/packages/df/b2/33b37b5e82408f402a5e82649a43e7c95cd5dab7beaeef2c35cedbfd18f2/pydantic_core-2.50.1-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:49c2cbb2397fe4d0987e84606e691af6cb87bc0ee1bd3e7b737f7e10b4c142f9", size = 2075250, upload-time = "2026-10-11T18:35:08.455Z" }, + { url = "https://files.pythonhosted.org/packages/04/62/c7d5b9249466ccab90f3ce4790c2399dbfb8172ae9e74a7753dd295fe65a/pydantic_core-2.50.1-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9e4472072de0137ee0d8e72d6620e85939c271d2f90f6bbb4b15c24638b79f92", size = 2107891, upload-time = "2026-10-11T18:35:10.918Z" }, + { url = "https://files.pythonhosted.org/packages/d4/7e/28d29bc1657195933147f772dee0558d9e0f045bbc11db7f992f40c37bb5/pydantic_core-2.50.1-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ed4f3cef55164b026fefb41341b7754cc6b624c75dfe7142d2ecceb5ad21c87", size = 2268026, upload-time = "2026-10-11T18:35:13.336Z" }, + { url = "https://files.pythonhosted.org/packages/a5/09/1bcf160f3cd6333e2a76982fae5963e5032de0bcaaba38464223dc266bfe/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:76e2e83fa6ec8cdc972d438dafc2522b3a47bee4ec0ae668b29cfb1977ab5242", size = 2217070, upload-time = "2026-10-11T18:35:15.688Z" }, + { url = "https://files.pythonhosted.org/packages/3d/81/f02de95eec7794dfc7a5bc69a834f0e834b31b3009014ce6de903855f775/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:a51eee75939cf811ac09b278745a6cee7dc873ccfbc8b9af3cc88fe4b7ce25b5", size = 2039027, upload-time = "2026-10-11T18:35:18.07Z" }, + { url = "https://files.pythonhosted.org/packages/4d/16/227746ed3771d9bf2304568b55134849ece34e13b38b1d76de763015c77f/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae28183297fb0d2b8dc46a1f01d51f5e45825fc5afe76a835a6cb7fb34821295", size = 2109009, upload-time = "2026-10-11T18:35:20.218Z" }, + { url = "https://files.pythonhosted.org/packages/e5/b9/7664d1592a0e5a74903f357cd5b28ceb7336f3473256c5a4e8c8432f1881/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88e492e8b9d0312e7dc13667c30222abf284dc3b79b5302b3607b41a5784ce61", size = 2269883, upload-time = "2026-10-11T18:35:22.48Z" }, + { url = "https://files.pythonhosted.org/packages/bd/35/002a378302ff91d2a7f149bc8d22363faf581ba40ac39d0123444315a32d/pydantic_core-2.50.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:7456d699b13954e9c0164dcb267250a10ae0dfb03e6e26d6796ab0d46e189c84", size = 2154076, upload-time = "2026-10-11T18:35:24.743Z" }, + { url = "https://files.pythonhosted.org/packages/4b/5c/7a034330082c00f3c9795052bd9b161aaaf6e1951e897ac00a094823ef7e/pydantic_core-2.50.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:b0d955195bbbe489ad343fcc956eacea9357b79cb22192c66cacdefcbc14b32f", size = 2085850, upload-time = "2026-10-11T18:35:27.009Z" }, + { url = "https://files.pythonhosted.org/packages/57/fa/d5b44a7d3d4eceed6ef8713a0003af56fefde6ec75915513bcdd5d730cd9/pydantic_core-2.50.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2c634642694e6a0dad2ab1d375589fa671fd442edd5caf7d9737b8f6ca22906", size = 2259754, upload-time = "2026-10-11T18:35:29.763Z" }, + { url = "https://files.pythonhosted.org/packages/b6/88/e01dd37301710bd8b3b2daf34ec9e2a6e83a333130831c0d468b0292a48c/pydantic_core-2.50.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ee6db2fbed51a7991302e8fac498cd67e336246026d0dfa84cf5166ce1412760", size = 2268712, upload-time = "2026-10-11T18:35:32.654Z" }, + { url = "https://files.pythonhosted.org/packages/3e/43/5bb80d4a4d2b2d84612a30205662cc521a20d209c94abc079ea48b4e0df2/pydantic_core-2.50.1-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:79490e33c4c0fcb933bbbcfc3a62184d8803b99f535863dfbb925e1bcb6945ad", size = 2305049, upload-time = "2026-10-11T18:35:35.392Z" }, + { url = "https://files.pythonhosted.org/packages/e8/7b/e3ef76b269cfe4a5bd3bdcf5d7124cf05e5a8909d443b91639307116bdae/pydantic_core-2.50.1-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:48569b0ade9edfbe065cad1d700175546592aebbb42f02adcebcc26e75b896fe", size = 2466001, upload-time = "2026-10-11T18:35:37.791Z" }, + { url = "https://files.pythonhosted.org/packages/8f/7a/ea0947aadc1d9f72d4be00d2e19939611ec17363bcb5e6eb9ec7d8221c34/pydantic_core-2.50.1-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:5f3cae32fc46121f787cb2486de9cf95a8bf72aec5cc78f64c606fa1735a6ef5", size = 2481777, upload-time = "2026-10-11T18:35:40.287Z" }, + { url = "https://files.pythonhosted.org/packages/24/f3/d15bc0b1fb0c4f1e07b3326ffb7489f7ae70da2b56a0884d22641b0eb47c/pydantic_core-2.50.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:7f476456ac2bb0d937f75191494a09c83a30765fea4f70f3b404942fe25f6cdf", size = 2336787, upload-time = "2026-10-11T18:35:42.558Z" }, +] + +[[package]] +name = "pygments" +version = "2.21.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, +] + +[[package]] +name = "pytest" +version = "9.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" }, +] + +[[package]] +name = "python-dotenv" +version = "1.2.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/74/26/2fbeedb218a787a5eea551c7532cac4e009f83d689dd2faa0d0353473f86/python_dotenv-1.2.4.tar.gz", hash = "sha256:f0d53e69935a851c0dcc78f3ab7aaccd8cabef0b92382b576b824212902873c0", size = 60824, upload-time = "2026-10-01T05:36:10Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", size = 23266, upload-time = "2026-10-01T05:36:08.633Z" }, +] + +[[package]] +name = "python-fastapi-sample" +version = "1.0.0" +source = { editable = "." } +dependencies = [ + { name = "fastapi" }, + { name = "uvicorn" }, +] + +[package.dev-dependencies] +dev = [ + { name = "httpx2" }, + { name = "pytest" }, + { name = "ruff" }, + { name = "testcontainers" }, +] + +[package.metadata] +requires-dist = [ + { name = "fastapi", specifier = ">=0.143.3" }, + { name = "uvicorn", specifier = ">=0.54.0" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "httpx2", specifier = ">=2.13.1" }, + { name = "pytest", specifier = ">=9.1.1" }, + { name = "ruff", specifier = ">=0.17.1" }, + { name = "testcontainers", specifier = ">=4.15.0" }, +] + +[[package]] +name = "pywin32" +version = "312" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1f/f5/10a6e845a00fc5e7afd0a988b744f403d4d57162a28d160a093c4d9322f0/pywin32-312-cp311-cp311-win32.whl", hash = "sha256:17948aeadbdb091f0ced6ef0841620794e68327b94ee415571c1203594b7215c", size = 6362659, upload-time = "2026-06-04T07:49:21.349Z" }, + { url = "https://files.pythonhosted.org/packages/35/c4/dcd2d62b5944b6d5db53413a5899016ccd57ffcb7278f3f81655d25d2027/pywin32-312-cp311-cp311-win_amd64.whl", hash = "sha256:d11417d84412f859b722fad0841b3614459ed0047f7542d8362e77884f6b6e8a", size = 6928825, upload-time = "2026-06-04T07:49:23.934Z" }, + { url = "https://files.pythonhosted.org/packages/b7/56/3cbb433fe4501cdba2eb9040f56a4e1a8243faa4186b25295564d1a7a79d/pywin32-312-cp311-cp311-win_arm64.whl", hash = "sha256:b2200a054ca6d6625c4842fc56a4976a4b47f96b73dbe5538c3f813a80359f47", size = 6721875, upload-time = "2026-06-04T07:49:26.416Z" }, + { url = "https://files.pythonhosted.org/packages/83/ff/32aa7d2ed0ab12b323aaa64f9b75e6ad4f8fd09f9ccfc28c79414d46838d/pywin32-312-cp312-cp312-win32.whl", hash = "sha256:dab4f65ac9c4e48400a2a0530c46c3c579cd5905ecd11b80692373915269208b", size = 6371877, upload-time = "2026-06-04T07:49:28.836Z" }, + { url = "https://files.pythonhosted.org/packages/03/d9/77040d3b43df3f3be32ea289433d660d2727f5ba327bc73be835127d9d60/pywin32-312-cp312-cp312-win_amd64.whl", hash = "sha256:b457f6d628a47e8a7346ce22acb7e1a46a4a78b52e1d17e1af56871bd19a93bc", size = 6914841, upload-time = "2026-06-04T07:49:31.85Z" }, + { url = "https://files.pythonhosted.org/packages/e3/cc/7b1ec671775756020a0ee7f4feeaf3c568f0ab86bd3900088cf986937a92/pywin32-312-cp312-cp312-win_arm64.whl", hash = "sha256:6017c58e12f6809fbb0555b75df144c2922a9ffd18e4b9b5afa863b6c1a9d950", size = 6727901, upload-time = "2026-06-04T07:49:34.244Z" }, + { url = "https://files.pythonhosted.org/packages/2d/41/12fbfd7f36ed2146d8bc9de96c2741296bf0d490b98508496cff322e274c/pywin32-312-cp313-cp313-win32.whl", hash = "sha256:7a27df850933d16a8eabfbaeb73d52b273e2da667f80d70b01a89d1f6828d02c", size = 6370184, upload-time = "2026-06-04T07:49:36.253Z" }, + { url = "https://files.pythonhosted.org/packages/ba/db/36a78e3403099d31d9746d13fdcde5accc43c1155f375a34d15983a479a7/pywin32-312-cp313-cp313-win_amd64.whl", hash = "sha256:c53e878d15a1c44788082bfe712a905433473aa38f86375b7cf8b45e3acbaaf9", size = 6914298, upload-time = "2026-06-04T07:49:38.876Z" }, + { url = "https://files.pythonhosted.org/packages/84/37/c1697194092b76de9ed47ca124323f02c57ffc8a45c06f88a3d5acaf01eb/pywin32-312-cp313-cp313-win_arm64.whl", hash = "sha256:59aba5d5940842075343a5ddc6b11f1cdf0d1567fe745290359dfbcc7c2eb831", size = 6727640, upload-time = "2026-06-04T07:49:41.083Z" }, + { url = "https://files.pythonhosted.org/packages/fc/2b/1f3cded5822fd49c02f40544cbb5f58c7cfd6b1694869fd476cb6170ee97/pywin32-312-cp314-cp314-win32.whl", hash = "sha256:a77a90fbb6881238d2ca9c6fd797b25817f3768fe78d214a90137ff055a75f5b", size = 6468928, upload-time = "2026-06-04T07:49:43.188Z" }, + { url = "https://files.pythonhosted.org/packages/21/82/3bf86d2e2808902013132e1ce905a7da0da53790f3836c64bf44d55e24f3/pywin32-312-cp314-cp314-win_amd64.whl", hash = "sha256:a4dd3a848290ef724347b19f301045831d8e802fa4464f491b98b1e0a081432e", size = 7024157, upload-time = "2026-06-04T07:49:45.34Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0e/73f6d6800b4f27655abd9e9f6aaeaefcddb2b946e4674efa2bab184a7f7b/pywin32-312-cp314-cp314-win_arm64.whl", hash = "sha256:9fce94568364e0155e6dfb781ac5d95903be8baf28670632beab1b523f300daa", size = 6839598, upload-time = "2026-06-04T07:49:47.613Z" }, + { url = "https://files.pythonhosted.org/packages/eb/61/caa39686032d2ebdd04ff0ab5cbe163126c0066d98e00c9018646e42393b/pywin32-312-cp315-cp315-win32.whl", hash = "sha256:5c1fbe4a937a73ae9297384a3da38518cbc694c68ad8a809b2e19acd350f03ed", size = 6471159, upload-time = "2026-06-04T07:49:50.035Z" }, + { url = "https://files.pythonhosted.org/packages/0f/cd/7e1de64a4a6f69c04214169657ccab0d93a670ea50e35eb8f489d7378249/pywin32-312-cp315-cp315-win_amd64.whl", hash = "sha256:c2f03a0f73f804a13c2735b99392b0cd426bb4f2c4d0178e5ac966a0f21618d5", size = 7025293, upload-time = "2026-06-04T07:49:54.857Z" }, + { url = "https://files.pythonhosted.org/packages/23/ed/4532e9388e65fa16b46776ef47ad631a64eda1631884488af707666350ed/pywin32-312-cp315-cp315-win_arm64.whl", hash = "sha256:a8597d28f267b39074aef51fa593530082b39cbe5a074226096857b1fed2dfb9", size = 6840337, upload-time = "2026-06-04T07:49:57.531Z" }, +] + +[[package]] +name = "requests" +version = "2.34.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "charset-normalizer" }, + { name = "idna" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ac/c3/e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0cc209f48b39d00cbf/requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed", size = 142856, upload-time = "2026-05-14T19:25:27.735Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a/requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0", size = 73075, upload-time = "2026-05-14T19:25:26.443Z" }, +] + +[[package]] +name = "ruff" +version = "0.17.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e7/e6d5749983b020e6cb1055abec0a6f361a8e94f0184cdcf56d4760995f02/ruff-0.17.1.tar.gz", hash = "sha256:5bb796c5112e9fb9527f2ef2faa0a130d6312d19de92bcfaddd70dbb2d41020f", size = 5323349, upload-time = "2026-10-15T15:23:18.64Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/78/90c46ca6250709f7c37e397b60d06061adee8d0f7d13959ed6a8e49b14fd/ruff-0.17.1-py3-none-linux_armv6l.whl", hash = "sha256:1796c41eafec66f4635125dd1e074a7aa27b8d20c187d484360acf11d247fc4a", size = 10147528, upload-time = "2026-10-15T15:22:33.667Z" }, + { url = "https://files.pythonhosted.org/packages/aa/d2/a2e28bc35b083ae51fa07dfba5280a667c8b01ecaee7802fc8849dcd5c46/ruff-0.17.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8eadb09a788010be29c895418bdfa513e4e1c65e64b94e5b19e4cd381f6cc7fb", size = 10225974, upload-time = "2026-10-15T15:22:36.328Z" }, + { url = "https://files.pythonhosted.org/packages/8e/71/7a9029a81c8206ee01a98f6cfeeb56e6c095af86857581a37045c46d7e94/ruff-0.17.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:29b454f18ca3eeaf37fbf140841dcf27d36109e29dee9aae8acecb68c26c6f74", size = 9270361, upload-time = "2026-10-15T15:22:38.651Z" }, + { url = "https://files.pythonhosted.org/packages/c0/8c/e075e9c917cb0575297880c96768304e881240171c870cbd8d9b7b54bec2/ruff-0.17.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:872e03dd231744d6c5ec5c8af6be52b71323fc6ee096e4c8b34d9f844ee3b978", size = 9938300, upload-time = "2026-10-15T15:22:41.284Z" }, + { url = "https://files.pythonhosted.org/packages/87/27/0b4bb926a49de2383f161272b4d863571a4c7ecdbf595a6bc58813a13367/ruff-0.17.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4c0d6cb5f8fbac77eec9af49f4fc0eaf856b05545e372b0694d24b4e76b1c640", size = 9948464, upload-time = "2026-10-15T15:22:43.681Z" }, + { url = "https://files.pythonhosted.org/packages/14/27/518d57e0e02aecb8ea4acac6b57b51a53173d25fa734952bfdd7d531e88e/ruff-0.17.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78beced4a3c94dfedbee4b999b95b6a27b35820fdc0afbacc6d37a8da26c1cd1", size = 10638639, upload-time = "2026-10-15T15:22:46.081Z" }, + { url = "https://files.pythonhosted.org/packages/01/82/d89a4e498ade59e6cee52d67f8da569019372212b87468c1fdeae884601c/ruff-0.17.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7feefc63921202894f0e158b0e32f45a5950d70a7fb693ccb9264816c25b1c05", size = 11337238, upload-time = "2026-10-15T15:22:48.894Z" }, + { url = "https://files.pythonhosted.org/packages/a2/7c/3b0fdef9352656317c977086fe1d802902406e4f2a0d8578da90c0e6d1c5/ruff-0.17.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684154861a819bf1f433669d2a0ce9c3e54677c65b8ebb866cc2a7ec86345785", size = 10896327, upload-time = "2026-10-15T15:22:51.45Z" }, + { url = "https://files.pythonhosted.org/packages/62/86/5566290219708ce2928f3a29c4f843a1185b341ec6111c4631a33c5ceced/ruff-0.17.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6ef98e51de8ef38082f90653ceeb84944bd7673783eea13e1647c5b9b064189", size = 10350811, upload-time = "2026-10-15T15:22:54.401Z" }, + { url = "https://files.pythonhosted.org/packages/ad/d2/ca8462dabb3c413990d49703ba306c30c862195a75448d080fa8fcce9775/ruff-0.17.1-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:8f9aa5b5bd5fa1937803ea609c8f153b8de39bf3e0e149897ae34b0c5b52f467", size = 10569994, upload-time = "2026-10-15T15:22:57.142Z" }, + { url = "https://files.pythonhosted.org/packages/e3/ad/dd1864c1f1db17c8cfb297ce70b352388e6977620f66f7182c52855407df/ruff-0.17.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:80e53b0e5faa3c5667f035daaa032893ae42b7cfe708c886d39ed131e54688ab", size = 10059672, upload-time = "2026-10-15T15:23:00.084Z" }, + { url = "https://files.pythonhosted.org/packages/65/45/3f56cf1d2168c2165cdd5ac6f9668aee66a4cfdd4caf2b2cc5ccb2b1d568/ruff-0.17.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:056c5d5fa0ac790051ae165d7035c7bf956d02de2db557f2e9b31d877a505fca", size = 9947803, upload-time = "2026-10-15T15:23:03.132Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4b/5457cb2be4c1d1ea5e919558131a0f197a4a454a0530d9e30820e8206e4c/ruff-0.17.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bd8f5a55b10f371642eacd0e8665a42a8b97da15c9a7187c79e697b77b5e0ce4", size = 10351807, upload-time = "2026-10-15T15:23:05.628Z" }, + { url = "https://files.pythonhosted.org/packages/49/fb/db15b4f8fa24a1e36b99e1401f42ef6df16ee299a48670d5d262b771e7d7/ruff-0.17.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ce05e6f3973611d9550a600e04bb531061e368baba31610eb57c1509a8f21a0a", size = 10765716, upload-time = "2026-10-15T15:23:08.092Z" }, + { url = "https://files.pythonhosted.org/packages/0a/e8/1e186578076aff7a80735f625005fde678412ab609cd323ed182eb7d6b87/ruff-0.17.1-py3-none-win32.whl", hash = "sha256:1de0030a8aa78c65c5fecb84b2e5c390ac684c0452875a02afc7c083d49a496a", size = 9895093, upload-time = "2026-10-15T15:23:10.582Z" }, + { url = "https://files.pythonhosted.org/packages/6a/2e/da3d9589bae8e8b58f3a48bd5bc0b980232fb14a83bf02c3be7660f87c1b/ruff-0.17.1-py3-none-win_amd64.whl", hash = "sha256:5df76f16580fab58d0f6c98a3ac254a4abceb7b2489b8b678335869cff77b3d7", size = 10097955, upload-time = "2026-10-15T15:23:13.309Z" }, + { url = "https://files.pythonhosted.org/packages/df/c9/0f2a4dea06a5e12c1191ee3d96b1e1233797d0d5e18f97a2b909a95a9836/ruff-0.17.1-py3-none-win_arm64.whl", hash = "sha256:42400b9a6ff8515ff27796f07f92e0195be011c86e81e381606f58ea5502fef4", size = 9853542, upload-time = "2026-10-15T15:23:16.05Z" }, +] + +[[package]] +name = "starlette" +version = "1.8.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e9/0c/6efb252d091ecccd7d62048ae11f0ea35cd75a4fbaeea5e30f9c3bf91d10/starlette-1.8.0.tar.gz", hash = "sha256:1565dc0b35d5737a271ed1e0e04e949f4e81198799f216d2667b0a0fb9cf9522", size = 2730457, upload-time = "2026-10-13T07:54:39.53Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c1/b0/5742e4ac7af5eb58ec3470a537a49d7aa507e5539413e504b3a65ef50ba8/starlette-1.8.0-py3-none-any.whl", hash = "sha256:dfdd6b29c26483288088d990eee59631dedadd66ce20d203402a7ca8e3c4656f", size = 79612, upload-time = "2026-10-13T07:54:38.019Z" }, +] + +[[package]] +name = "testcontainers" +version = "4.15.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "docker" }, + { name = "python-dotenv" }, + { name = "typing-extensions" }, + { name = "urllib3" }, + { name = "wrapt" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/4b/13/2cc466bddf26d0085f30a2b2bd56b7f8708b54a54db833eec97c5c69129b/testcontainers-4.15.0.tar.gz", hash = "sha256:085cde086337632e19002719460b7b80bbab2bdd51bb3ea04f77d0de96504706", size = 95340, upload-time = "2026-07-24T23:08:01.731Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/00/7e/424aac8b355597835deb333e757a0e94b5ccf38ad00f07fe6ed1f4e17c88/testcontainers-4.15.0-py3-none-any.whl", hash = "sha256:8796c14e76604031ad39cf0ed3b8e9806283a1fbf5270965c2b1c594caa31b74", size = 160771, upload-time = "2026-07-24T23:08:00.13Z" }, +] + +[[package]] +name = "truststore" +version = "0.10.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/9f/c5201d42a484c061e528825fc8e2d565f5abd50a4ced6fb7d29c4ec99b2b/truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd", size = 28091, upload-time = "2026-10-12T22:27:31.808Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/51/e9/3a7820be2bb0fe53b6bc9c3be26d3d1158004e4c3ab953aa6840b955b1e9/truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c", size = 19017, upload-time = "2026-10-12T22:27:30.377Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, +] + +[[package]] +name = "typing-inspection" +version = "0.4.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/26/b09b8010994eccc3c09092e6b34058f36a460eea2d4c3e8b910c695975a0/typing_inspection-0.4.4.tar.gz", hash = "sha256:547274fa6b0a561ccf549cc9524b999a578e737d015d8709d021f9d0d13bea47", size = 76928, upload-time = "2026-08-12T12:37:25.997Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/67/81/4add07e5172b7ac40d8ed5ff580409a7801a4fe26d529bdd915401dabfbe/typing_inspection-0.4.4-py3-none-any.whl", hash = "sha256:65b8397ba37ccbce054456aaccddfc91e6e3083c92824df348d96ca832f3f147", size = 14750, upload-time = "2026-08-12T12:37:24.648Z" }, +] + +[[package]] +name = "urllib3" +version = "2.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e3/05/b17359e1cefb4f909b5e40b1b90a496d987258916dbbf88e842c729f510e/urllib3-2.8.0.tar.gz", hash = "sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63", size = 458972, upload-time = "2026-09-15T19:29:36.253Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/92/9d/c4e665119135114480843e7ab388fa94d8480650450e6f8e26b70d323a4c/urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3", size = 135717, upload-time = "2026-09-15T19:29:34.577Z" }, +] + +[[package]] +name = "uvicorn" +version = "0.54.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/da/34/30e9280707135d2cfc589dfff3cb796bd07a3aeb1a3e415ba09dd89d7bb4/uvicorn-0.54.0.tar.gz", hash = "sha256:a2e33cbfaa0306f8e6b0c13e0cb89d7d7a2da3e62b90c66e18c33d9807b28620", size = 112283, upload-time = "2026-09-25T06:52:37.601Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/38/0c/b54a4fdd7f90a3af8b02ebc9ce6712c2c208b7926a2f7bad95c33ebbe943/uvicorn-0.54.0-py3-none-any.whl", hash = "sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf", size = 87427, upload-time = "2026-09-25T06:52:35.829Z" }, +] + +[[package]] +name = "wrapt" +version = "2.5.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/04/22/89e2f3bdae5cb34e0cab0cd86d7172dbf418de4b46c9b17b9c7a560dfa44/wrapt-2.5.1.tar.gz", hash = "sha256:f595bb0185aab3e9dc31950c95d914f56ea8278810c3b928f3426e12ed6d27bc", size = 184455, upload-time = "2026-10-14T00:39:39.24Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c4/2b/0f2ae9e355a0491c202a1331ec405d794c249f4fe9b4db952c0246909786/wrapt-2.5.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:aed178902c2386d7c5d3d23eb96d32c100e34cb8c2390e7ece0e4901ae43f0e7", size = 105587, upload-time = "2026-10-14T00:37:01.614Z" }, + { url = "https://files.pythonhosted.org/packages/0a/54/a5b9904d341ae255bc5618ac43830ab68ed6420dac62af9a305a6191062a/wrapt-2.5.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1910be5adc0232cc6e8c0673bf3f41c2ee724547543526bed8d00734458e7bc5", size = 105759, upload-time = "2026-10-14T00:37:03.02Z" }, + { url = "https://files.pythonhosted.org/packages/2b/bf/8edaec939d7411a58bccb4dc4310246caea5050576ff91b5f5abf6079a9c/wrapt-2.5.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c25c594f58ecb676358d6d6b0ff068b8bbbc506dc831c6d17876460c66ce39c2", size = 240110, upload-time = "2026-10-14T00:37:04.448Z" }, + { url = "https://files.pythonhosted.org/packages/9e/8c/18ad7f24c82cbf689324521abe4dc90078d20a5498d991ec83e03dc60c85/wrapt-2.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e85a9db9e5a5ccc326edb19e35a5106ba16e451d570a2ec8ea9deb1ea52a3c42", size = 241618, upload-time = "2026-10-14T00:37:06.1Z" }, + { url = "https://files.pythonhosted.org/packages/d2/1b/607e1fc9a8e8838f1a8516f5b87565c9dc415b474ec09479f9443a5a7305/wrapt-2.5.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:2c642a83b6703804b571caa3b8b205aacd341b1b37e2b2d89cd70e03e0e9caa6", size = 226604, upload-time = "2026-10-14T00:37:07.899Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fb/6f637ca3e71ea046148dd17622e023df159a16d99762aad4bbdbac11c76e/wrapt-2.5.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:920f700ef41ee774a1e4778c1f4295e117f1ff3435a7e0cd3e997d10da819d32", size = 239265, upload-time = "2026-10-14T00:37:09.45Z" }, + { url = "https://files.pythonhosted.org/packages/f3/fc/b746f3a72ee7f56d238debeb3842b2569511cf357f5a35f455e24258dc4f/wrapt-2.5.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:3f93ceb0ac4896de45d5a45a8f4e69474da583440589de10b362ddc1db4691ed", size = 223864, upload-time = "2026-10-14T00:37:11.363Z" }, + { url = "https://files.pythonhosted.org/packages/97/12/290a6385393fddcb01bcc83d78c16a24c50a392fe72fb4936999bfe573ec/wrapt-2.5.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a88370a7d89fcb1c4953a87673fdd7b4a0eb14a1a4dfce49771f0c827ef44893", size = 229426, upload-time = "2026-10-14T00:37:12.868Z" }, + { url = "https://files.pythonhosted.org/packages/29/af/b52bb81d4217ed7f0fe285de6754e44cb5e6a8b316fc78c605743f463709/wrapt-2.5.1-cp311-cp311-win32.whl", hash = "sha256:12bee472452019706fa1d4ead093f52a9683b4fe6617953e15bab9acdfdc013f", size = 100684, upload-time = "2026-10-14T00:37:14.59Z" }, + { url = "https://files.pythonhosted.org/packages/e6/d4/ae9ca837038a7a9aadb906eeca76b42df54e299edb29f8ac2cbad1d55b4f/wrapt-2.5.1-cp311-cp311-win_amd64.whl", hash = "sha256:ce3889e3815f97d46414eb574bffdd9bdb41ff70f503097e2707615a87d4e92c", size = 105878, upload-time = "2026-10-14T00:37:16.057Z" }, + { url = "https://files.pythonhosted.org/packages/15/5e/0605567a81c7105446cec682bc2235172a37e2bc817e2de3f5bad95ee969/wrapt-2.5.1-cp311-cp311-win_arm64.whl", hash = "sha256:ca7b967e96384abdf7e7182c79f71529997981ece8169f8a8ddb31bc5b57cbec", size = 102825, upload-time = "2026-10-14T00:37:17.492Z" }, + { url = "https://files.pythonhosted.org/packages/66/9b/c7f97d5493a33b5ed01d3c85745f9bdfdd2e5c2785471b8d8b55a3c273d6/wrapt-2.5.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6e3eff05ae616671b40d7ad0a504210329e4adc9fb91415663570aca93c5f5cc", size = 106452, upload-time = "2026-10-14T00:37:18.951Z" }, + { url = "https://files.pythonhosted.org/packages/7f/b0/335b0af2930938678fcde954b29780b26308961b93df5e0192fc182e8b7e/wrapt-2.5.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c44dd9881626da7d621c23805f26726f6b023cf3e9755f48d092bc9cbef4a8e7", size = 106087, upload-time = "2026-10-14T00:37:20.392Z" }, + { url = "https://files.pythonhosted.org/packages/4a/5a/2a34ba5a468e9d3d6e5b0733280e1ae3c850bfc5f1d681fc0e97f564d1f2/wrapt-2.5.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bfaa998ceeea4d0aa72b40cdd0023d19409504e244b439ff2aa9f01729341c5f", size = 250438, upload-time = "2026-10-14T00:37:21.882Z" }, + { url = "https://files.pythonhosted.org/packages/b3/d5/3d4ad322af74d3ab2a14f69ba844cdd3edefb555edfc1c1976ec0112d5c4/wrapt-2.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d6d274ec50a5b208be75596dc44ea253e65deaa6ee3a600babc86dafbb957dfc", size = 250594, upload-time = "2026-10-14T00:37:23.497Z" }, + { url = "https://files.pythonhosted.org/packages/37/1a/3cbf48425ec2c66aa9645218458da1e19e315abb9766604d3c49e579076c/wrapt-2.5.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1a96e2671c60f9f09ae547b5a815cecb29af16caa68d73693387d0028788cb32", size = 229856, upload-time = "2026-10-14T00:37:25.029Z" }, + { url = "https://files.pythonhosted.org/packages/cc/e7/b2ea57f4c51258659200565af8617d76992b0fe65e6aad7162dd5720ef05/wrapt-2.5.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:729d644b6acaf4846a4ef81b037857b66a01dea6d227f827c6d71c0b6d656d6c", size = 247153, upload-time = "2026-10-14T00:37:26.67Z" }, + { url = "https://files.pythonhosted.org/packages/9d/c1/4714743e672ed1084a035a2a4f0edeef7838399753b4856a0dc46ef9487d/wrapt-2.5.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:859f67bfc31eb7ab55f237b629cd4ab0441b075912446481f910f7d02066811e", size = 226726, upload-time = "2026-10-14T00:37:28.425Z" }, + { url = "https://files.pythonhosted.org/packages/91/e3/c00401bcc3485eb9937c3fe4a1cc8fc3b61800b1378ea3a143ea1c30f6f6/wrapt-2.5.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:29b62e87fcd6a1893f669abfd02a596a7fc5cfa79fa57e42c4e650a6c170c67b", size = 238843, upload-time = "2026-10-14T00:37:30.075Z" }, + { url = "https://files.pythonhosted.org/packages/76/b5/c16759fb0721e63df92b576c2222ce1f11690a8b300fd91b49c55436865c/wrapt-2.5.1-cp312-cp312-win32.whl", hash = "sha256:f1c911818fb076910ef509f2298dfcb966a54a6ff068eebd459632102cf589fb", size = 100488, upload-time = "2026-10-14T00:37:31.625Z" }, + { url = "https://files.pythonhosted.org/packages/22/d5/39d5a704650f18799f37841442b464edb81cf2015f006eaef26068acc6ea/wrapt-2.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:c39c7130ea0702c4ab0faf12da1df1e02d5174305c17edf02309e2f058c4114f", size = 106048, upload-time = "2026-10-14T00:37:33.188Z" }, + { url = "https://files.pythonhosted.org/packages/21/bf/65743adeeb5476920c62dad6cded7bc8789e19bd4f9a336d4ac812adb8de/wrapt-2.5.1-cp312-cp312-win_arm64.whl", hash = "sha256:e089a22ff5af1290b8c759a610830bdb2a829ef9c3d7797e4ee32c2f795ed482", size = 103200, upload-time = "2026-10-14T00:37:34.673Z" }, + { url = "https://files.pythonhosted.org/packages/e4/6d/cfe55762435f36107815d56a2cfbebe7e3129b593c47a670c6eb1d7917d3/wrapt-2.5.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f98eaf784cd12bc69c77af398084174531007cd81849c962163ccfc6e791f3ea", size = 106068, upload-time = "2026-10-14T00:37:36.087Z" }, + { url = "https://files.pythonhosted.org/packages/01/b9/41642877fe741db56d240833c8822188b663c4c5d52beb087964774035d4/wrapt-2.5.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ab6db7d2a18d366cc57c2228253cf26443190aba0a6dd0939b3c1e8ac6e29e2c", size = 106190, upload-time = "2026-10-14T00:37:37.768Z" }, + { url = "https://files.pythonhosted.org/packages/37/62/20edad100b93552ec5c172e509a9db898a73d5043ae701fcb6e9986f9d33/wrapt-2.5.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f1630201b0e2a96bb26304b7adfbd91a4ef486abb5a4c48377444a0bed749f37", size = 248519, upload-time = "2026-10-14T00:37:39.321Z" }, + { url = "https://files.pythonhosted.org/packages/3d/e9/8d81185bc9a40cfb43d91fc70a1e80ecde752c95dc98f5452cae82037976/wrapt-2.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d800c7689154622b0ba2922ceca44a3cf2ef61c3b9a4c4eeb1d8b3050d7ededa", size = 248488, upload-time = "2026-10-14T00:37:40.96Z" }, + { url = "https://files.pythonhosted.org/packages/8a/88/8431df4fd81f0dfa83e8ede463eed311d083c5a279a56891dc0396b07b0e/wrapt-2.5.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5b53000b424dc2133eaaf22838a2352d3497f5d7c2e7d9a2acfe675ab7225bb1", size = 227392, upload-time = "2026-10-14T00:37:42.599Z" }, + { url = "https://files.pythonhosted.org/packages/db/8a/ee6f8542eeccad6874faf0b7b2e129952c527a482f1d28940e2111fec2d6/wrapt-2.5.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:76f230a9b07e3cb66646d265398f579abb6128b1bb4cb97c74b1ae5d09e96f31", size = 244972, upload-time = "2026-10-14T00:37:44.209Z" }, + { url = "https://files.pythonhosted.org/packages/4d/1f/32c59e7fd522409f3863dfecdab5315ee9ba37f96020b6f0adee9d223310/wrapt-2.5.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:fd3f878a4aac3c262447ddf43c5f4c18fc67dfc3ba69c4fb1c7a4c4af96abe7e", size = 225316, upload-time = "2026-10-14T00:37:45.948Z" }, + { url = "https://files.pythonhosted.org/packages/ae/d6/1b9abc1244592034c5db744571e17d663f0f1b0ce6c8ba279c60f6f9c3a8/wrapt-2.5.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:0c9480bdee340a1602cae5a777146ab4be3e384fdcb569fffdf8721032314645", size = 237145, upload-time = "2026-10-14T00:37:47.535Z" }, + { url = "https://files.pythonhosted.org/packages/f0/ce/8f3b5482f768c1d60fd2557d049c766543fef5ec707037cb410a57eb65ee/wrapt-2.5.1-cp313-cp313-win32.whl", hash = "sha256:dc401274fcc7b15b3b2c12df2ff34024a11925243a7d3daee91c6d7d14f9addf", size = 100462, upload-time = "2026-10-14T00:37:49.21Z" }, + { url = "https://files.pythonhosted.org/packages/7b/dc/6a5735874ea79816f85c1ec9d92139d7073c20d1881c15ff2108c211354b/wrapt-2.5.1-cp313-cp313-win_amd64.whl", hash = "sha256:09b1893ee4063706574c1813abf479b8b51926633fbdb6f96aab8dc7b0976668", size = 105870, upload-time = "2026-10-14T00:37:50.745Z" }, + { url = "https://files.pythonhosted.org/packages/08/83/a4e8b5a5a32f8dfc5dad8344f1e2b908f7d8d84b11c3c336bf7f79a5144a/wrapt-2.5.1-cp313-cp313-win_arm64.whl", hash = "sha256:f280c115ea64eff3dcbd68a668ce3f63476a4ba386bbabb318017e286196ea2c", size = 102903, upload-time = "2026-10-14T00:37:52.323Z" }, + { url = "https://files.pythonhosted.org/packages/25/3d/ec1937283863bbe0d90528e09f2b27cfc0dd7e608fc2b65c804967dee369/wrapt-2.5.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:cf63fffcdcd8c60f223d3967bb92cc4fc2e8b46f09e75b67a6a75e6f47c0fc43", size = 106439, upload-time = "2026-10-14T00:37:53.853Z" }, + { url = "https://files.pythonhosted.org/packages/93/39/cca8afb80dbb9fce6103e59db507a9415291c4dbe97ea055875ff62901fb/wrapt-2.5.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:9f0750cbc2e29e4f3c9529d3587d4e7ed8f60638ceafb80b87a95833b0c5acd9", size = 106378, upload-time = "2026-10-14T00:37:55.386Z" }, + { url = "https://files.pythonhosted.org/packages/aa/a0/e784d7a9fd277a2ee395490ec4df96608b7fe218bb1ef7dced2a1caea490/wrapt-2.5.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3cf273b7e8d2038abb7f0a8c6550aff4f617b9d486a9965c8e8acc96a3a04de9", size = 251505, upload-time = "2026-10-14T00:37:57.022Z" }, + { url = "https://files.pythonhosted.org/packages/81/56/01ebc86b88056f5782b9d50f962fb398c6b82aa11efc98f50c64896d94e3/wrapt-2.5.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:380f72610181883f66b41442cfc7c0f7552b42169efb2113def26e6380013d37", size = 250744, upload-time = "2026-10-14T00:37:58.652Z" }, + { url = "https://files.pythonhosted.org/packages/5f/5c/0e8eaaf31e2d6e7bf13c6eae2fd5b85eaa24e21e06466e6e7a0f35532689/wrapt-2.5.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cef2a8f006410b6134a0d273ec037fea8cc7a6a914f1bd7555ad9788ad788c6e", size = 231598, upload-time = "2026-10-14T00:38:00.505Z" }, + { url = "https://files.pythonhosted.org/packages/6a/6b/6a3e257e65de6cc0027e78b423942697c74451520ba3797fd86455ec4df8/wrapt-2.5.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:9bad4dbb4e61624fcce5f301e37f9e743ecae4f1259a3777b3207eb7eba3dccd", size = 247998, upload-time = "2026-10-14T00:38:02.63Z" }, + { url = "https://files.pythonhosted.org/packages/22/38/b2b8f3ee22b05f33f5aefb052844a36a0d7edd1eaff2ff4249f97792bea8/wrapt-2.5.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:9a34640eb6295f33ca23462977de275fe8f3a50ab339b8918b96d69a7451e2e1", size = 228795, upload-time = "2026-10-14T00:38:04.317Z" }, + { url = "https://files.pythonhosted.org/packages/29/39/e6c86552286ac27b855042fb9c229c580ed2d4c3ced5d0a1dad5f5ee8c11/wrapt-2.5.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:26313f38d18d40a9975123a4ebff9da125ec63ab9ece4f05320a3d8d37d2c1fe", size = 239090, upload-time = "2026-10-14T00:38:06.119Z" }, + { url = "https://files.pythonhosted.org/packages/e7/7a/aea209f64e894573935b17de26ecfa0efe139b63f170a60be9f13734e0f5/wrapt-2.5.1-cp314-cp314-win32.whl", hash = "sha256:0591e6eace0d186c9ef1ecd1244be5a04e98041424cfca425b684ffe4f0d8030", size = 100919, upload-time = "2026-10-14T00:38:07.874Z" }, + { url = "https://files.pythonhosted.org/packages/57/24/847096aa49d42990137ed3b940743c8a6da806d39f6c455317114e8ebfde/wrapt-2.5.1-cp314-cp314-win_amd64.whl", hash = "sha256:25ed8b1b39234140d5b5c6a273130c7595e0abece417c3ca3cb378fcea5cd0fe", size = 106243, upload-time = "2026-10-14T00:38:09.49Z" }, + { url = "https://files.pythonhosted.org/packages/9c/ff/1cdc742133b9fb8558cdf42b2a6c2699bd7c72f7d0606286ec2f9142e20a/wrapt-2.5.1-cp314-cp314-win_arm64.whl", hash = "sha256:6201c7e122f40060a9b50696d80deec8f93b1a235ec0443f51d7a8a42f7044a6", size = 103974, upload-time = "2026-10-14T00:38:11.354Z" }, + { url = "https://files.pythonhosted.org/packages/fc/6f/c32dc64900f1970a7f991ff5d06788cd636ca2f3ee2f99709d82577ca198/wrapt-2.5.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:da847332447db5505162759a4cd5ac374eb8b74841fe97a98ef3de14edd2586d", size = 109552, upload-time = "2026-10-14T00:38:12.965Z" }, + { url = "https://files.pythonhosted.org/packages/e9/73/a9c8cc82b166e3de42f5fbd88089d2ef9b72e87aac7d6cdddb070335c20b/wrapt-2.5.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:9f437dd704abc4ee1bd03bb2d796d362d0e75915e8f3113a7900b3b7ec5f8b47", size = 109853, upload-time = "2026-10-14T00:38:14.565Z" }, + { url = "https://files.pythonhosted.org/packages/f6/48/f341d82e69ae47df2755847af1c744ff0732543482dbc2373e5e57676621/wrapt-2.5.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:03aa7d2256309b57ddbf317bff2cae5f47e50ea9ae8d582780ebe0b554347b42", size = 284103, upload-time = "2026-10-14T00:38:16.23Z" }, + { url = "https://files.pythonhosted.org/packages/fd/50/b87c6374377b08ee0783b6c5c31cd41a5e103bc54e7e857e800a0a965550/wrapt-2.5.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fcccaa1484f7dd1091602970988ab741491f9f974013c844f70e45ac1196b80d", size = 293883, upload-time = "2026-10-14T00:38:17.986Z" }, + { url = "https://files.pythonhosted.org/packages/38/e0/6d0810ae73f7a5180ec366577588ab3ad55fc1bc7e3623e82d5f8528dd2a/wrapt-2.5.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8078186f719a92693199f1e06c4ec72e1e6d374c2e459da18ed5c39d6966d727", size = 263097, upload-time = "2026-10-14T00:38:20.107Z" }, + { url = "https://files.pythonhosted.org/packages/d6/d3/c890a46f4d395a7935e5a7436f374ceefa362eb612fdd39376dd775e0283/wrapt-2.5.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:1425fcf0e70b27053bd610d57bae975856e7897e3f6ba1456d2b80b9d7fd15d1", size = 289045, upload-time = "2026-10-14T00:38:21.913Z" }, + { url = "https://files.pythonhosted.org/packages/e5/c6/042e30e0d851ca6ea743e6978902527f9166da42d736f074245d1cc54c8f/wrapt-2.5.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:b238e955ba34ef2b8897f358b7b868b41b9a02ffd338014b62985fa91898cc4a", size = 260378, upload-time = "2026-10-14T00:38:23.662Z" }, + { url = "https://files.pythonhosted.org/packages/31/a4/5e65f90bf414c2f1c7eefc3d26c33af01d87ba33c4b879db4e1d4ba7fc3b/wrapt-2.5.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:25eb4d928a9abeaf70ca786a35861b46d1ab37cc4ce49ea70a070dacdead4dfe", size = 278746, upload-time = "2026-10-14T00:38:25.523Z" }, + { url = "https://files.pythonhosted.org/packages/4b/86/17a85475e218e05225a4f6d65237b12b280596e04520df0e3d8841c4eae3/wrapt-2.5.1-cp314-cp314t-win32.whl", hash = "sha256:df6e3a36170cda0d313be50fe5065948e7f12f3a181b38cbc262e9f2ee4824e1", size = 103415, upload-time = "2026-10-14T00:38:27.409Z" }, + { url = "https://files.pythonhosted.org/packages/27/1c/495b3aebbbe5aebf52ae5f9e8ddd0e072a412b9f5a9bc68e5eba43fa26ba/wrapt-2.5.1-cp314-cp314t-win_amd64.whl", hash = "sha256:bc5c0203d383403043fb86c964bd0bab4fcbfb26004ff4bb9c6d02ebc1d608ae", size = 109940, upload-time = "2026-10-14T00:38:29.145Z" }, + { url = "https://files.pythonhosted.org/packages/28/4d/030ecd98da4d052c264290c4fb9f984706c9a19026154c833580e8624a05/wrapt-2.5.1-cp314-cp314t-win_arm64.whl", hash = "sha256:a424e8a9776c06aef6313af1d0e3fe6e0838af4241d0c09eb0a3b46f2c9a5ff3", size = 106214, upload-time = "2026-10-14T00:38:30.795Z" }, + { url = "https://files.pythonhosted.org/packages/90/2b/eec5745baaad284fa19232f47796914134e1ea2dd21e289b012aa7981323/wrapt-2.5.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:a18e63910252eb75d8806b4baefbc3a03612502f63eab042e3741b00b719f043", size = 106441, upload-time = "2026-10-14T00:38:32.504Z" }, + { url = "https://files.pythonhosted.org/packages/29/f3/976b0f014a08654289358d41a799c2d24642151b091cfe18a8b91766ee28/wrapt-2.5.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:183bf0bb893f783c9d22f953cb01fababb9f618e098763f8e66337b575b0647a", size = 106411, upload-time = "2026-10-14T00:38:34.338Z" }, + { url = "https://files.pythonhosted.org/packages/c7/f4/4b94583d9bec0ff0573a5f10fab295675e3b9a64b701c4609b1a1982c390/wrapt-2.5.1-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a1e823aecb3746b8f9e0aee2e1413887871ee2f5c502a3e0ef8d466dbd4adde1", size = 252017, upload-time = "2026-10-14T00:38:36.142Z" }, + { url = "https://files.pythonhosted.org/packages/5e/3c/4f9ba033343b2935a453188f97866f0bd4f7748748ab307aaefb18be3a0a/wrapt-2.5.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bde5d1b37101b1e9dd3da1f35072e2e7028e9c5e3511f7d76d3fdd4d071b7663", size = 251030, upload-time = "2026-10-14T00:38:38.003Z" }, + { url = "https://files.pythonhosted.org/packages/69/a1/704c761913be404ed893d05702eeda5ff96c5d8448271c28b80101202bcb/wrapt-2.5.1-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:12d3d2b9d6553df6e2421ab99e1cc5413509076788f57fcb3169f5ce100a19d1", size = 232875, upload-time = "2026-10-14T00:38:40.124Z" }, + { url = "https://files.pythonhosted.org/packages/f0/3a/779ca20fb8c70238069efd0a2b60ea3da450e57c4f103748db0247f52f3a/wrapt-2.5.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:521bd5ef2a33171fac08a0a302d51a983c19c3519406c1ee8da7ce29285488da", size = 248302, upload-time = "2026-10-14T00:38:42.138Z" }, + { url = "https://files.pythonhosted.org/packages/03/02/80e13786204ce8e1002edb66d06a3194906c0dbbc038bce7bbda426d0f2b/wrapt-2.5.1-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:129cab3c7b21e68e693c2819a95c47f3b1c41a834b931154688c83b6aef6bdab", size = 229839, upload-time = "2026-10-14T00:38:44.039Z" }, + { url = "https://files.pythonhosted.org/packages/9d/d1/14c0d041375ae5d0a12445b5c5bc61b109df954cd5bfb852736cd4281cbd/wrapt-2.5.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:8a7c078323e6e1534968cb85488c5eb7ee2b9bbd0f8a291095213a763da40dab", size = 239634, upload-time = "2026-10-14T00:38:45.896Z" }, + { url = "https://files.pythonhosted.org/packages/97/6e/dacc92526fbed1013eb903406ce961da6ff2a1e66b7349a253f439b979aa/wrapt-2.5.1-cp315-cp315-win32.whl", hash = "sha256:736c1de0230c6d24327b14684794214167b2c5ebb6332e28a10f504641b600df", size = 100931, upload-time = "2026-10-14T00:38:47.718Z" }, + { url = "https://files.pythonhosted.org/packages/e8/e4/84bbd88554052958ecbbb481a75559b1e40753aba52ec86e3e1efb50ccf0/wrapt-2.5.1-cp315-cp315-win_amd64.whl", hash = "sha256:69fd0fbb3daf7c8c6f5e062847a0061f880f347374d74cf1daba57220fb64cd0", size = 106252, upload-time = "2026-10-14T00:38:49.511Z" }, + { url = "https://files.pythonhosted.org/packages/b7/98/98d4c4524e8af70ccf35b66864be29ea9d232e5a918efc1dbcf5c87a039d/wrapt-2.5.1-cp315-cp315-win_arm64.whl", hash = "sha256:051220e5071fdfb1a6678707c8abb7bbf4824d40f99758394b2b4d64855fb284", size = 103980, upload-time = "2026-10-14T00:38:51.384Z" }, + { url = "https://files.pythonhosted.org/packages/75/d9/4b242519d6d29eabb73cb9e50e645e014eb2c13f022601151953b3e81946/wrapt-2.5.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:711e73da3d7983547fc9dd208973b6b0c52640822f5d477910ba24622df6ba64", size = 109538, upload-time = "2026-10-14T00:38:53.124Z" }, + { url = "https://files.pythonhosted.org/packages/58/05/e434f56fcceaafb251cc56c03107ae278e99158466b49f4146f7b33a2532/wrapt-2.5.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:5be9816d9de88f02fce23cf55f392403411d9bd9c7ae57fdc965a43b22e2de5e", size = 109874, upload-time = "2026-10-14T00:38:54.941Z" }, + { url = "https://files.pythonhosted.org/packages/23/09/d2c0b34d02804018225279a157307b873c8d0f8452790efdd7f0004387a8/wrapt-2.5.1-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:4b3f410c416752e1dba53d361e2e6562f22c2c3ec855740dfa5836e061b22571", size = 284866, upload-time = "2026-10-14T00:38:57.081Z" }, + { url = "https://files.pythonhosted.org/packages/71/6f/2b56319c0565d9a6b63eeba2f11f3e699dc324aaa460f1aae079bd4507b0/wrapt-2.5.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:094b847491b813b6e6c1775e03770930d75078c0821adf929ac712830951ef25", size = 295154, upload-time = "2026-10-14T00:38:59.007Z" }, + { url = "https://files.pythonhosted.org/packages/3c/1b/9ac4238a1a839457d6b687b9e9c35d57ba1b2050a42d6bf8c93176bc1bdf/wrapt-2.5.1-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:26d8ea2ec6818aeb656bd8a9e745a6f1fb0edfcd8f54291ccd94f62eb5f5e3bd", size = 264914, upload-time = "2026-10-14T00:39:01.154Z" }, + { url = "https://files.pythonhosted.org/packages/4f/95/9faed8e5f6e5431edd36b2cfb4f305df520c197ba3639e1c78d11c70a068/wrapt-2.5.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:0a526227efe17dd94bd16b123d170f879bce42c15f10eb92495a745f54caa943", size = 290238, upload-time = "2026-10-14T00:39:03.052Z" }, + { url = "https://files.pythonhosted.org/packages/b5/52/cae26590ef8ee46b55aa8b211c507f6e5ec0fbd241a6730bf7da024b5dab/wrapt-2.5.1-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:36d7d0ad593c4f1a651e4032de834db59aee1a929ee396cd483895b673328e51", size = 262208, upload-time = "2026-10-14T00:39:05.008Z" }, + { url = "https://files.pythonhosted.org/packages/00/f3/34e5008307be4169592e99de52946cd8800b98097e2a145da11484c7b3e4/wrapt-2.5.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:89d9a8607b7028054bb6fd01d437f205534a5d59d53c3665d15949a99a2fce0d", size = 280005, upload-time = "2026-10-14T00:39:07.048Z" }, + { url = "https://files.pythonhosted.org/packages/f3/f9/64e000aa84a88c52a481c7c8b011c80a8ae60bd5f68598e567a918a624a0/wrapt-2.5.1-cp315-cp315t-win32.whl", hash = "sha256:ad81bf81b0a0b6c6ec74169638202851962843e86749570c463eecc55072f93b", size = 103378, upload-time = "2026-10-14T00:39:09.336Z" }, + { url = "https://files.pythonhosted.org/packages/2f/e4/69efa7c6e8535c5188e041ac278079949fb2daaa97e6f08beb91cf31b3d1/wrapt-2.5.1-cp315-cp315t-win_amd64.whl", hash = "sha256:d5b665a43fe0d3b390cbdd3c003d61c92fa07bd5e3fb1ed3f47920c2d03cd9fd", size = 109928, upload-time = "2026-10-14T00:39:11.156Z" }, + { url = "https://files.pythonhosted.org/packages/13/77/6e414b3388b9f1ecb76107ef4a2aae501f1bdfcab85c8e34ef78f7db22db/wrapt-2.5.1-cp315-cp315t-win_arm64.whl", hash = "sha256:6405ff2160af9d59132ebb076eda0304db44d9d09809582932412ef7c0788a36", size = 106226, upload-time = "2026-10-14T00:39:13.061Z" }, + { url = "https://files.pythonhosted.org/packages/bc/0c/7da7513ddcc8f1d831ec4bfbedc9f7f174ecb91042bc16916fc1e0d06b22/wrapt-2.5.1-py3-none-any.whl", hash = "sha256:c6e6c226b1ca5402d7ae5fb34a0d21f1b49124fe4200e5884d1e19e53c47ac1d", size = 81849, upload-time = "2026-10-14T00:39:37.441Z" }, +] diff --git a/polyglot/rust-axum-sample/Cargo.lock b/polyglot/rust-axum-sample/Cargo.lock new file mode 100644 index 00000000..69b32380 --- /dev/null +++ b/polyglot/rust-axum-sample/Cargo.lock @@ -0,0 +1,2431 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "astral-tokio-tar" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b18457efd137254e016bbde5e1d88df61c4e1a5ae2223746e56123bac6af2463" +dependencies = [ + "futures-core", + "libc", + "portable-atomic", + "rustc-hash", + "rustix", + "tokio", + "tokio-stream", + "xattr", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bollard" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee04c4c84f1f811b017f2fbb7dd8815c976e7ca98593de9c1e2afad0f636bff4" +dependencies = [ + "async-stream", + "base64 0.22.1", + "bitflags", + "bollard-buildkit-proto", + "bollard-stubs", + "bytes", + "futures-core", + "futures-util", + "hex", + "home", + "http", + "http-body-util", + "hyper", + "hyper-named-pipe", + "hyper-rustls", + "hyper-util", + "hyperlocal", + "log", + "num", + "pin-project-lite", + "rand 0.9.5", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "serde", + "serde_derive", + "serde_json", + "serde_urlencoded", + "thiserror", + "time", + "tokio", + "tokio-stream", + "tokio-util", + "tonic", + "tower-service", + "url", + "winapi", +] + +[[package]] +name = "bollard-buildkit-proto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a885520bf6249ab931a764ffdb87b0ceef48e6e7d807cfdb21b751e086e1ad" +dependencies = [ + "prost", + "prost-types", + "tonic", + "tonic-prost", + "ureq", +] + +[[package]] +name = "bollard-stubs" +version = "1.52.1-rc.29.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0a8ca8799131c1837d1282c3f81f31e76ceb0ce426e04a7fe1ccee3287c066" +dependencies = [ + "base64 0.22.1", + "bollard-buildkit-proto", + "bytes", + "prost", + "serde", + "serde_json", + "serde_repr", + "time", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "docker_credential" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29547a1dc60885a552306986316bc9701ba120c1a8db6769fa68691529ad373d" +dependencies = [ + "base64 0.22.1", + "serde", + "serde_json", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "etcetera" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de48cc4d1c1d97a20fd819def54b890cadde72ed3ad0c614822a0a433361be96" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "ferroid" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee93edf3c501f0035bbeffeccfed0b79e14c311f12195ec0e661e114a0f60da4" +dependencies = [ + "portable-atomic", + "rand 0.10.3", + "web-time", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.14.2", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-named-pipe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fab3637d6b04a8037af8a266fdf6cf92ea957e8c53981a2bf6136572531025bf" +dependencies = [ + "hex", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "hyperlocal" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" +dependencies = [ + "hex", + "http-body-util", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "parse-display" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a1c2265c98e2446911282c6ac86d8524f495792c38c5bd884f80499c7538a" +dependencies = [ + "parse-display-derive", + "regex", + "regex-syntax", +] + +[[package]] +name = "parse-display-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae7800a4c974efd12df917266338e79a7a74415173caf7e70aa0a0707345281" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "regex-syntax", + "structmeta", + "syn 2.0.119", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "prost-types" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a" +dependencies = [ + "prost", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rust-axum-sample" +version = "1.0.0" +dependencies = [ + "axum", + "serde", + "serde_json", + "testcontainers-modules", + "tokio", + "tower", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "structmeta" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1575d8d40908d70f6fd05537266b90ae71b15dbbe7a8b7dffa2b759306d329" +dependencies = [ + "proc-macro2", + "quote", + "structmeta-derive", + "syn 2.0.119", +] + +[[package]] +name = "structmeta-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "testcontainers" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd5785b5483672915ed5fe3cddf9f546802779fc1eceff0a6fb7321fac81c1e" +dependencies = [ + "astral-tokio-tar", + "async-trait", + "bollard", + "bytes", + "docker_credential", + "either", + "etcetera", + "ferroid", + "futures", + "http", + "itertools", + "log", + "memchr", + "parse-display", + "pin-project-lite", + "serde", + "serde_json", + "serde_with", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "url", +] + +[[package]] +name = "testcontainers-modules" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5985fde5befe4ffa77a052e035e16c2da86e8bae301baa9f9904ad3c494d357" +dependencies = [ + "testcontainers", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "time" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" + +[[package]] +name = "time-macros" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec" +dependencies = [ + "async-trait", + "axum", + "base64 0.22.1", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "socket2", + "sync_wrapper", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-prost" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55376a0bbaa4975a3f10d009ad763d8f4108f067c7c2e74f3001fb49778d309" +dependencies = [ + "bytes", + "prost", + "tonic", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 2.14.2", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7ac20be9b7726e0bbdbf974c059676d9acb1cd414961f570a4e8231cacd7fc" +dependencies = [ + "base64 0.23.1", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "ureq-proto", + "utf8-zero", +] + +[[package]] +name = "ureq-proto" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" +dependencies = [ + "base64 0.23.1", + "http", + "httparse", + "log", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/polyglot/rust-axum-sample/Cargo.toml b/polyglot/rust-axum-sample/Cargo.toml new file mode 100644 index 00000000..b1beb2fc --- /dev/null +++ b/polyglot/rust-axum-sample/Cargo.toml @@ -0,0 +1,34 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[package] +name = "rust-axum-sample" +version = "1.0.0" +edition = "2024" +rust-version = "1.88" +license = "Apache-2.0" +publish = false + +[dependencies] +axum = "0.8.9" +serde = { version = "1.0.229", features = ["derive"] } +serde_json = "1.0.154" +tokio = { version = "1.53.3", features = ["macros", "rt-multi-thread", "signal"] } + +[dev-dependencies] +testcontainers-modules = { version = "0.15.0", features = ["postgres"] } +tokio = { version = "1.53.3", features = ["sync"] } +tower = { version = "0.5.3", features = ["util"] } diff --git a/polyglot/rust-axum-sample/build.rs b/polyglot/rust-axum-sample/build.rs new file mode 100644 index 00000000..d34f10ad --- /dev/null +++ b/polyglot/rust-axum-sample/build.rs @@ -0,0 +1,73 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! 链接 libdynamicds。没有用 DYNAMIC_DATASOURCE_LIB_DIR 指定现成的共享库时,先用 +//! `../build-libdynamicds.sh` 构建它:共享库已是最新时脚本什么也不做,Java 源码或 pom 变化后 +//! cargo 会重新执行本脚本。 + +use std::env; +use std::io; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + println!("cargo::rerun-if-env-changed=DYNAMIC_DATASOURCE_LIB_DIR"); + let dir = match env::var_os("DYNAMIC_DATASOURCE_LIB_DIR") { + Some(dir) => PathBuf::from(dir), + None => build_library(), + }; + let library = dir.join("libdynamicds.so"); + println!("cargo::rerun-if-changed={}", library.display()); + if !library.exists() { + // 没有 GraalVM 时脚本只警告:cargo check / clippy 不链接,用不到共享库;cargo build / test 会在链接时失败 + println!( + "cargo::warning={} 不存在:构建它需要 GraalVM 25(JAVA_HOME 或 GRAALVM_HOME 指向它),\ + 也可以用 DYNAMIC_DATASOURCE_LIB_DIR 指向现成的 libdynamicds.so 所在的目录", + library.display() + ); + } + let dir = dir.canonicalize().unwrap_or(dir); + println!("cargo::rustc-link-search=native={}", dir.display()); + println!("cargo::rustc-link-lib=dylib=dynamicds"); + // 写入 rpath,`cargo run` / `cargo test` 不必再设置 LD_LIBRARY_PATH + println!("cargo::rustc-link-arg=-Wl,-rpath,{}", dir.display()); +} + +/// 按需构建 `../dynamic-datasource-ffi` 里的 libdynamicds,返回它所在的目录。 +fn build_library() -> PathBuf { + let polyglot = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join(".."); + let module = polyglot.join("dynamic-datasource-ffi"); + for input in [ + module.join("src/main"), + module.join("pom.xml"), + polyglot.join("pom.xml"), + polyglot.join("../pom.xml"), + ] { + println!("cargo::rerun-if-changed={}", input.display()); + } + let script = polyglot.join("build-libdynamicds.sh"); + println!("cargo::rerun-if-changed={}", script.display()); + // Maven 的输出转到 stderr:cargo 只在构建失败时显示它,stdout 留给 cargo:: 指令 + let status = Command::new("sh") + .arg(script) + .stdout(io::stderr()) + .status() + .expect("无法执行 build-libdynamicds.sh"); + assert!( + status.success(), + "构建 libdynamicds 失败({status}),见上面的 Maven 输出" + ); + module.join("target") +} diff --git a/polyglot/rust-axum-sample/config/h2.json b/polyglot/rust-axum-sample/config/h2.json new file mode 100644 index 00000000..8f1ba376 --- /dev/null +++ b/polyglot/rust-axum-sample/config/h2.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:h2:mem:ds_master;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:h2:mem:ds_slave_1;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:h2:mem:ds_slave_2;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:h2:mem:ds_order;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:h2:mem:ds_product;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:h2:mem:ds_account;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/rust-axum-sample/config/postgresql.json b/polyglot/rust-axum-sample/config/postgresql.json new file mode 100644 index 00000000..17dc5d6c --- /dev/null +++ b/polyglot/rust-axum-sample/config/postgresql.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_master", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_1", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_2", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_order", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_product", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_account", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/rust-axum-sample/db/order/data-account.sql b/polyglot/rust-axum-sample/db/order/data-account.sql new file mode 100644 index 00000000..f4542f38 --- /dev/null +++ b/polyglot/rust-axum-sample/db/order/data-account.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:余额 50 +INSERT INTO account (id, balance) VALUES (1, 50); diff --git a/polyglot/rust-axum-sample/db/order/data-product.sql b/polyglot/rust-axum-sample/db/order/data-product.sql new file mode 100644 index 00000000..29e2c949 --- /dev/null +++ b/polyglot/rust-axum-sample/db/order/data-product.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:单价 10,库存 20 +INSERT INTO product (id, price, stock) VALUES (1, 10, 20); diff --git a/polyglot/rust-axum-sample/db/order/schema-account.sql b/polyglot/rust-axum-sample/db/order/schema-account.sql new file mode 100644 index 00000000..e57a9a0c --- /dev/null +++ b/polyglot/rust-axum-sample/db/order/schema-account.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS account; +CREATE TABLE account +( + id BIGINT PRIMARY KEY, + balance DOUBLE PRECISION NOT NULL, + -- 余额不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_account_balance CHECK (balance >= 0) +); diff --git a/polyglot/rust-axum-sample/db/order/schema-order.sql b/polyglot/rust-axum-sample/db/order/schema-order.sql new file mode 100644 index 00000000..162129d7 --- /dev/null +++ b/polyglot/rust-axum-sample/db/order/schema-order.sql @@ -0,0 +1,27 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS p_order; +CREATE TABLE p_order +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + user_id BIGINT NOT NULL, + product_id BIGINT NOT NULL, + amount INT NOT NULL, + total_price DOUBLE PRECISION, + status VARCHAR(16) NOT NULL, + add_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/polyglot/rust-axum-sample/db/order/schema-product.sql b/polyglot/rust-axum-sample/db/order/schema-product.sql new file mode 100644 index 00000000..c00a5370 --- /dev/null +++ b/polyglot/rust-axum-sample/db/order/schema-product.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS product; +CREATE TABLE product +( + id BIGINT PRIMARY KEY, + price DOUBLE PRECISION NOT NULL, + stock INT NOT NULL, + -- 库存不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_product_stock CHECK (stock >= 0) +); diff --git a/polyglot/rust-axum-sample/db/postgresql/init-databases.sql b/polyglot/rust-axum-sample/db/postgresql/init-databases.sql new file mode 100644 index 00000000..06d5ce5d --- /dev/null +++ b/polyglot/rust-axum-sample/db/postgresql/init-databases.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- PostgreSQL 变体里每个数据源各用一个数据库,ds_slave_3 留给 POST /datasources 的动态添加演示。 +-- compose.yaml 把本文件挂载到 /docker-entrypoint-initdb.d/,CI 与 JVM 单测也执行同一份脚本。 +CREATE DATABASE ds_master; +CREATE DATABASE ds_slave_1; +CREATE DATABASE ds_slave_2; +CREATE DATABASE ds_slave_3; +CREATE DATABASE ds_order; +CREATE DATABASE ds_product; +CREATE DATABASE ds_account; diff --git a/polyglot/rust-axum-sample/db/user/data-master.sql b/polyglot/rust-axum-sample/db/user/data-master.sql new file mode 100644 index 00000000..f5cb5ac2 --- /dev/null +++ b/polyglot/rust-axum-sample/db/user/data-master.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('master-张三', 18); diff --git a/polyglot/rust-axum-sample/db/user/data-slave_1.sql b/polyglot/rust-axum-sample/db/user/data-slave_1.sql new file mode 100644 index 00000000..382c7266 --- /dev/null +++ b/polyglot/rust-axum-sample/db/user/data-slave_1.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_1-张三', 18); diff --git a/polyglot/rust-axum-sample/db/user/data-slave_2.sql b/polyglot/rust-axum-sample/db/user/data-slave_2.sql new file mode 100644 index 00000000..98208519 --- /dev/null +++ b/polyglot/rust-axum-sample/db/user/data-slave_2.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_2-张三', 18); diff --git a/polyglot/rust-axum-sample/db/user/schema.sql b/polyglot/rust-axum-sample/db/user/schema.sql new file mode 100644 index 00000000..029bc1ff --- /dev/null +++ b/polyglot/rust-axum-sample/db/user/schema.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- master / slave_1 / slave_2(以及动态添加的 slave_3)共用的表结构,H2 与 PostgreSQL 通用 +DROP TABLE IF EXISTS t_user; +CREATE TABLE t_user +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + name VARCHAR(64) NOT NULL, + age INT +); diff --git a/polyglot/rust-axum-sample/src/config.rs b/polyglot/rust-axum-sample/src/config.rs new file mode 100644 index 00000000..d440b136 --- /dev/null +++ b/polyglot/rust-axum-sample/src/config.rs @@ -0,0 +1,39 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! 本示例自带的数据源配置与 SQL 脚本:crate 根目录下的 `config/` 与 `db/`。 + +use serde_json::{Value, json}; +use std::path::{Path, PathBuf}; +use std::{env, fs}; + +/// 存放 `config/` 与 `db/` 的目录:默认是 crate 根目录,容器里用 `SAMPLE_DIR` 指定。 +pub fn sample_dir() -> PathBuf { + env::var_os("SAMPLE_DIR") + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR"))) + .canonicalize() + .expect("sample directory exists") +} + +/// 读取 `config/.json`,并通过 `variables` 告诉 dd_open 建表脚本的位置。 +pub fn load_config(sample: &Path, profile: &str) -> Value { + let path = sample.join("config").join(format!("{profile}.json")); + let text = + fs::read_to_string(&path).unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display())); + let mut config: Value = serde_json::from_str(&text).expect("configuration is valid JSON"); + config["variables"] = json!({ "DB_DIR": sample.join("db") }); + config +} diff --git a/polyglot/rust-axum-sample/src/dynamic_datasource.rs b/polyglot/rust-axum-sample/src/dynamic_datasource.rs new file mode 100644 index 00000000..1dcc9001 --- /dev/null +++ b/polyglot/rust-axum-sample/src/dynamic_datasource.rs @@ -0,0 +1,262 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! libdynamicds(dynamic-datasource 的 GraalVM native 共享库)的安全封装。 +//! +//! GraalVM 要求调用入口的 OS 线程已经 attach 到 isolate:每个线程第一次调用时 attach,线程退出时由 +//! 线程局部变量的析构函数 detach。C 函数都是阻塞调用,这里一律经 [`tokio::task::spawn_blocking`] +//! 放到 blocking 线程池执行,不占用 tokio 的工作线程。 + +use serde::Deserialize; +use serde_json::{Value, json}; +use std::ffi::{CStr, CString, c_char, c_int}; +use std::fmt; +use std::sync::OnceLock; + +#[repr(C)] +struct GraalIsolate { + _private: [u8; 0], +} + +#[repr(C)] +struct GraalIsolateThread { + _private: [u8; 0], +} + +/// 业务函数的统一签名:`char* dd_xxx(graal_isolatethread_t* thread, const char* request)`。 +type Operation = unsafe extern "C" fn(*mut GraalIsolateThread, *const c_char) -> *mut c_char; + +#[link(name = "dynamicds")] +unsafe extern "C" { + fn dd_create_isolate() -> *mut GraalIsolateThread; + fn dd_get_isolate(thread: *mut GraalIsolateThread) -> *mut GraalIsolate; + fn dd_attach_thread(isolate: *mut GraalIsolate) -> *mut GraalIsolateThread; + fn dd_detach_thread(thread: *mut GraalIsolateThread) -> c_int; + fn dd_open(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_close(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_execute(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_transaction(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_add_datasource(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_remove_datasource(thread: *mut GraalIsolateThread, request: *const c_char) + -> *mut c_char; + fn dd_list_datasources(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_tx_begin(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_tx_execute(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_tx_commit(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_tx_rollback(thread: *mut GraalIsolateThread, request: *const c_char) -> *mut c_char; + fn dd_free(thread: *mut GraalIsolateThread, pointer: *mut c_char); +} + +/// isolate 的地址。裸指针既不是 `Send` 也不是 `Sync`,存成 usize 才能放进全局变量。 +static ISOLATE: OnceLock = OnceLock::new(); + +fn isolate() -> *mut GraalIsolate { + // 创建 isolate 的线程随之 attach,之后它与其他线程一样经由 ATTACHED 取得自己的 isolate 线程 + *ISOLATE.get_or_init(|| unsafe { dd_get_isolate(dd_create_isolate()) } as usize) + as *mut GraalIsolate +} + +struct AttachedThread(*mut GraalIsolateThread); + +impl Drop for AttachedThread { + fn drop(&mut self) { + unsafe { dd_detach_thread(self.0) }; + } +} + +thread_local! { + static ATTACHED: AttachedThread = AttachedThread(unsafe { dd_attach_thread(isolate()) }); +} + +fn call(operation: Operation, request: &Value) -> Result { + let request = CString::new(request.to_string()).expect("serialized JSON never contains NUL"); + let response = ATTACHED.with(|thread| unsafe { + let pointer = operation(thread.0, request.as_ptr()); + let response = CStr::from_ptr(pointer).to_string_lossy().into_owned(); + dd_free(thread.0, pointer); + response + }); + let mut response: Value = + serde_json::from_str(&response).expect("libdynamicds always answers JSON"); + if response["ok"] == true { + Ok(response["data"].take()) + } else { + Err(serde_json::from_value(response["error"].take()).expect("error has code and message")) + } +} + +async fn call_blocking(operation: Operation, request: Value) -> Result { + tokio::task::spawn_blocking(move || call(operation, &request)) + .await + .expect("libdynamicds call panicked") +} + +/// 与 Java 侧 `ErrorCode` 一一对应。 +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ErrorCode { + BadRequest, + NotOpen, + AlreadyOpen, + DatasourceNotFound, + UpdateCountMismatch, + TransactionNotFound, + ConstraintViolation, + SqlError, + #[serde(other)] + Internal, +} + +impl ErrorCode { + pub fn as_str(self) -> &'static str { + match self { + Self::BadRequest => "BAD_REQUEST", + Self::NotOpen => "NOT_OPEN", + Self::AlreadyOpen => "ALREADY_OPEN", + Self::DatasourceNotFound => "DATASOURCE_NOT_FOUND", + Self::UpdateCountMismatch => "UPDATE_COUNT_MISMATCH", + Self::TransactionNotFound => "TRANSACTION_NOT_FOUND", + Self::ConstraintViolation => "CONSTRAINT_VIOLATION", + Self::SqlError => "SQL_ERROR", + Self::Internal => "INTERNAL", + } + } +} + +/// libdynamicds 返回的 `{"ok":false,"error":{...}}`。 +#[derive(Debug, Clone, Deserialize)] +pub struct Error { + pub code: ErrorCode, + pub message: String, + #[serde(rename = "sqlState")] + pub sql_state: Option, +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}: {}", self.code.as_str(), self.message) + } +} + +impl std::error::Error for Error {} + +/// 进程内只有一个 isolate,也只有一个打开的 DynamicRoutingDataSource,这个句柄可以随意复制。 +#[derive(Debug, Clone, Copy)] +pub struct DynamicDataSource(()); + +impl DynamicDataSource { + /// `dd_open`:config 的字段与 `spring.datasource.dynamic.*` 同名。 + pub async fn open(config: Value) -> Result { + call_blocking(dd_open, config).await.map(|_| Self(())) + } + + /// `dd_close`:回滚未结束的会话式事务并关闭所有连接池。 + pub async fn close(self) -> Result<(), Error> { + call_blocking(dd_close, json!({})).await.map(drop) + } + + /// `dd_execute`:在 `ds` 指定的数据源或分组上执行一条语句,相当于调用一个 `@DS(ds)` 方法。 + pub async fn execute(&self, statement: Value) -> Result { + call_blocking(dd_execute, statement).await + } + + /// `dd_transaction`:一次调用内把一批语句放进同一个本地事务。 + pub async fn transaction(&self, statements: Vec) -> Result { + call_blocking(dd_transaction, json!({ "statements": statements })).await + } + + pub async fn add_datasource(&self, property: Value) -> Result { + call_blocking(dd_add_datasource, property).await + } + + pub async fn remove_datasource(&self, name: &str) -> Result { + call_blocking(dd_remove_datasource, json!({ "name": name })).await + } + + pub async fn list_datasources(&self) -> Result { + call_blocking(dd_list_datasources, json!({})).await + } + + /// `dd_tx_begin`:开启跨多次调用的会话式事务。 + pub async fn begin(&self) -> Result { + let data = call_blocking(dd_tx_begin, json!({})).await?; + Ok(Transaction { + id: data["txId"] + .as_str() + .expect("dd_tx_begin returns txId") + .to_owned(), + }) + } + + /// 相当于 `@DSTransactional`:`work` 返回 `Ok` 时提交,返回 `Err` 时回滚。 + pub async fn transactional( + &self, + work: impl AsyncFnOnce(&Transaction) -> Result, + ) -> Result + where + E: From, + { + let transaction = self.begin().await?; + match work(&transaction).await { + Ok(value) => { + transaction.commit().await?; + Ok(value) + } + Err(error) => { + // 回滚失败时还有 Java 侧的空闲超时兜底,这里保留业务错误本身 + let _ = transaction.rollback().await; + Err(error) + } + } + } +} + +/// 会话式事务。语句可以从任意线程发出,Java 侧会交给该事务独占的线程执行。 +#[derive(Debug)] +pub struct Transaction { + id: String, +} + +impl Transaction { + pub fn id(&self) -> &str { + &self.id + } + + /// `dd_tx_execute`:请求与 [`DynamicDataSource::execute`] 相同。 + pub async fn execute(&self, mut statement: Value) -> Result { + statement["txId"] = json!(self.id); + call_blocking(dd_tx_execute, statement).await + } + + pub async fn commit(self) -> Result<(), Error> { + call_blocking(dd_tx_commit, json!({ "txId": self.id })) + .await + .map(drop) + } + + pub async fn rollback(self) -> Result<(), Error> { + call_blocking(dd_tx_rollback, json!({ "txId": self.id })) + .await + .map(drop) + } +} + +/// 查询结果 `{"datasource","rows"}` 的第一行。 +pub fn first_row(mut result: Value) -> Option { + match result["rows"].take() { + Value::Array(rows) => rows.into_iter().next(), + _ => None, + } +} diff --git a/polyglot/rust-axum-sample/src/error.rs b/polyglot/rust-axum-sample/src/error.rs new file mode 100644 index 00000000..c0d5bbb7 --- /dev/null +++ b/polyglot/rust-axum-sample/src/error.rs @@ -0,0 +1,72 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! 错误响应 `{"code","message"}`,三个示例的错误码一致;相当于 tx-local-sample 的 `GlobalExceptionHandler`。 + +use crate::dynamic_datasource::{Error, ErrorCode}; +use axum::Json; +use axum::http::StatusCode; +use axum::response::{IntoResponse, Response}; +use serde_json::json; + +pub struct ApiError { + status: StatusCode, + code: String, + message: String, +} + +impl ApiError { + pub fn new(status: StatusCode, code: &str, message: impl Into) -> Self { + Self { + status, + code: code.to_owned(), + message: message.into(), + } + } +} + +/// dynamic-datasource 的错误码到 HTTP 状态码,其余一律 500。 +impl From for ApiError { + fn from(error: Error) -> Self { + let message = error.message.to_lowercase(); + match error.code { + // 批量事务里库存、余额不足由 CHECK 约束兜底,按约束名还原成与会话式事务相同的业务错误 + ErrorCode::ConstraintViolation if message.contains("ck_product_stock") => { + Self::new(StatusCode::CONFLICT, "INSUFFICIENT_STOCK", "库存不足") + } + ErrorCode::ConstraintViolation if message.contains("ck_account_balance") => { + Self::new(StatusCode::CONFLICT, "INSUFFICIENT_BALANCE", "余额不足") + } + code => { + let status = match code { + ErrorCode::BadRequest => StatusCode::BAD_REQUEST, + ErrorCode::DatasourceNotFound => StatusCode::NOT_FOUND, + ErrorCode::ConstraintViolation | ErrorCode::UpdateCountMismatch => { + StatusCode::CONFLICT + } + _ => StatusCode::INTERNAL_SERVER_ERROR, + }; + Self::new(status, code.as_str(), error.message) + } + } + } +} + +impl IntoResponse for ApiError { + fn into_response(self) -> Response { + let body = json!({ "code": self.code, "message": self.message }); + (self.status, Json(body)).into_response() + } +} diff --git a/polyglot/rust-axum-sample/src/lib.rs b/polyglot/rust-axum-sample/src/lib.rs new file mode 100644 index 00000000..ca2a5d6e --- /dev/null +++ b/polyglot/rust-axum-sample/src/lib.rs @@ -0,0 +1,22 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! 在 axum 里使用 dynamic-datasource:数据源路由、分组负载均衡与本地事务都由 libdynamicds +//! (dynamic-datasource 的 GraalVM native 共享库)完成。C ABI 与 HTTP 接口约定见 `../README.md`。 + +pub mod config; +pub mod dynamic_datasource; +mod error; +pub mod routes; diff --git a/polyglot/rust-axum-sample/src/main.rs b/polyglot/rust-axum-sample/src/main.rs new file mode 100644 index 00000000..3eae7ad1 --- /dev/null +++ b/polyglot/rust-axum-sample/src/main.rs @@ -0,0 +1,53 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use rust_axum_sample::config::{load_config, sample_dir}; +use rust_axum_sample::dynamic_datasource::DynamicDataSource; +use rust_axum_sample::routes; +use std::env; +use tokio::net::TcpListener; +use tokio::signal::unix::{SignalKind, signal}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let sample = sample_dir(); + let profile = env::var("DD_PROFILE").unwrap_or_else(|_| "h2".to_owned()); + let dd = DynamicDataSource::open(load_config(&sample, &profile)).await?; + println!( + "dynamic-datasource is open: {}", + dd.list_datasources().await? + ); + + let port = env::var("PORT") + .ok() + .and_then(|port| port.parse().ok()) + .unwrap_or(8081); + let listener = TcpListener::bind(("0.0.0.0", port)).await?; + println!("rust-axum-sample listening on {}", listener.local_addr()?); + axum::serve(listener, routes::router(dd, &sample.join("db"))) + .with_graceful_shutdown(shutdown_signal()) + .await?; + + dd.close().await?; + Ok(()) +} + +async fn shutdown_signal() { + let mut terminate = signal(SignalKind::terminate()).expect("install SIGTERM handler"); + tokio::select! { + _ = tokio::signal::ctrl_c() => {} + _ = terminate.recv() => {} + } +} diff --git a/polyglot/rust-axum-sample/src/routes.rs b/polyglot/rust-axum-sample/src/routes.rs new file mode 100644 index 00000000..6b8623bb --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes.rs @@ -0,0 +1,47 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! HTTP 接口,与 python-fastapi-sample、typescript-hono-sample 完全一致,约定见 `../README.md`。 +//! +//! 每个资源一个子模块,各自用 `router()` 声明路由;这里把它们合并起来,并注入共享的状态。 + +mod accounts; +mod datasources; +mod orders; +mod products; +mod users; + +use crate::dynamic_datasource::DynamicDataSource; +use axum::Router; +use std::path::Path; +use std::sync::Arc; + +#[derive(Clone)] +struct AppState { + dd: DynamicDataSource, + /// 新加入的从库沿用 t_user 的建表脚本:脚本路径由服务端决定,不接受客户端传入。 + user_schema: Arc, +} + +pub fn router(dd: DynamicDataSource, db_dir: &Path) -> Router { + let user_schema = format!("file:{}", db_dir.join("user/schema.sql").display()).into(); + Router::new() + .merge(users::router()) + .merge(datasources::router()) + .merge(orders::router()) + .merge(products::router()) + .merge(accounts::router()) + .with_state(AppState { dd, user_schema }) +} diff --git a/polyglot/rust-axum-sample/src/routes/accounts.rs b/polyglot/rust-axum-sample/src/routes/accounts.rs new file mode 100644 index 00000000..4237e51e --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes/accounts.rs @@ -0,0 +1,80 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! `/accounts`,以及下单时扣减余额,对应 tx-local-sample 的 `AccountService`。 + +use super::AppState; +use crate::dynamic_datasource::{Transaction, first_row}; +use crate::error::ApiError; +use axum::extract::{Path, State}; +use axum::http::StatusCode; +use axum::routing::get; +use axum::{Json, Router}; +use serde_json::{Value, json}; + +pub(super) fn router() -> Router { + Router::new().route("/accounts/{id}", get(get_account)) +} + +/// GET /accounts/{id} +async fn get_account( + State(state): State, + Path(id): Path, +) -> Result, ApiError> { + let result = state + .dd + .execute(json!({ + "ds": "account", + "sql": "select id, balance from account where id = ?", + "params": [id], + })) + .await?; + first_row(result).map(Json).ok_or_else(not_found) +} + +/// 对应 `AccountService#reduceBalance`:检查并扣减余额。 +pub(super) async fn reduce_balance( + tx: &Transaction, + user_id: i64, + total_price: f64, +) -> Result<(), ApiError> { + let account = first_row( + tx.execute(json!({ + "ds": "account", + "sql": "select balance from account where id = ? for update", + "params": [user_id], + })) + .await?, + ) + .ok_or_else(not_found)?; + if account["balance"].as_f64().unwrap_or_default() < total_price { + return Err(ApiError::new( + StatusCode::CONFLICT, + "INSUFFICIENT_BALANCE", + "余额不足", + )); + } + tx.execute(json!({ + "ds": "account", + "sql": "update account set balance = balance - ? where id = ?", + "params": [total_price, user_id], + })) + .await?; + Ok(()) +} + +fn not_found() -> ApiError { + ApiError::new(StatusCode::NOT_FOUND, "ACCOUNT_NOT_FOUND", "用户不存在") +} diff --git a/polyglot/rust-axum-sample/src/routes/datasources.rs b/polyglot/rust-axum-sample/src/routes/datasources.rs new file mode 100644 index 00000000..3ac58667 --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes/datasources.rs @@ -0,0 +1,72 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! `/datasources`:运行时增删数据源,对应 add-remove-datasource-sample。 + +use super::AppState; +use crate::error::ApiError; +use axum::extract::{Path, State}; +use axum::http::StatusCode; +use axum::routing::{delete, get}; +use axum::{Json, Router}; +use serde::Deserialize; +use serde_json::{Value, json}; + +pub(super) fn router() -> Router { + Router::new() + .route("/datasources", get(list_datasources).post(add_datasource)) + .route("/datasources/{name}", delete(remove_datasource)) +} + +/// GET /datasources:当前的数据源与分组。 +async fn list_datasources(State(state): State) -> Result, ApiError> { + Ok(Json(state.dd.list_datasources().await?)) +} + +#[derive(Deserialize)] +struct NewDatasource { + name: String, + url: String, + username: Option, + password: Option, + driver_class_name: Option, +} + +/// POST /datasources:名称带下划线时自动入组(slave_3 → slave)。 +async fn add_datasource( + State(state): State, + Json(datasource): Json, +) -> Result<(StatusCode, Json), ApiError> { + let result = state + .dd + .add_datasource(json!({ + "name": datasource.name, + "url": datasource.url, + "username": datasource.username, + "password": datasource.password, + "driverClassName": datasource.driver_class_name, + "init": { "schema": &*state.user_schema }, + })) + .await?; + Ok((StatusCode::CREATED, Json(result))) +} + +/// DELETE /datasources/{name}:删除数据源并关闭它的连接池,primary 不能删除。 +async fn remove_datasource( + State(state): State, + Path(name): Path, +) -> Result, ApiError> { + Ok(Json(state.dd.remove_datasource(&name).await?)) +} diff --git a/polyglot/rust-axum-sample/src/routes/orders.rs b/polyglot/rust-axum-sample/src/routes/orders.rs new file mode 100644 index 00000000..521edb9e --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes/orders.rs @@ -0,0 +1,161 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! `/orders`:多数据源本地事务,对应 tx-local-sample 的 `OrderController` 与 `OrderService`。 + +use super::AppState; +use super::accounts::reduce_balance; +use super::products::reduce_stock; +use crate::dynamic_datasource::{Transaction, first_row}; +use crate::error::ApiError; +use axum::extract::State; +use axum::http::StatusCode; +use axum::routing::{get, post}; +use axum::{Json, Router}; +use serde::Deserialize; +use serde_json::{Value, json}; + +pub(super) fn router() -> Router { + Router::new() + .route("/orders", get(list_orders).post(place_order)) + .route("/orders/batch", post(place_order_batch)) +} + +#[derive(Deserialize)] +struct PlaceOrder { + user_id: i64, + product_id: i64, + amount: i64, +} + +impl PlaceOrder { + fn validate(&self) -> Result<(), ApiError> { + if self.amount > 0 { + Ok(()) + } else { + Err(ApiError::new( + StatusCode::BAD_REQUEST, + "BAD_REQUEST", + "amount 必须大于 0", + )) + } + } + + fn placed(&self, id: Value, total_price: f64) -> Value { + json!({ + "id": id, + "user_id": self.user_id, + "product_id": self.product_id, + "amount": self.amount, + "total_price": total_price, + "status": "SUCCESS", + }) + } +} + +/// POST /orders:与 `OrderService#placeOrder` 逐行对应, +/// 一个会话式事务跨 order、product、account 三个库,任何一步失败都整体回滚。 +async fn place_order( + State(state): State, + Json(order): Json, +) -> Result<(StatusCode, Json), ApiError> { + order.validate()?; + let placed = state + .dd + .transactional(async |tx: &Transaction| -> Result { + let inserted = tx + .execute(json!({ + "ds": "order", + "sql": "insert into p_order (user_id, product_id, amount, status) values (?, ?, ?, 'INIT')", + "params": [order.user_id, order.product_id, order.amount], + "generatedKeys": ["id"], + })) + .await?; + let order_id = inserted["generatedKeys"][0]["id"].clone(); + let total_price = reduce_stock(tx, order.product_id, order.amount).await?; + reduce_balance(tx, order.user_id, total_price).await?; + tx.execute(json!({ + "ds": "order", + "sql": "update p_order set status = 'SUCCESS', total_price = ? where id = ?", + "params": [total_price, order_id], + })) + .await?; + Ok(order.placed(order_id, total_price)) + }) + .await?; + Ok((StatusCode::CREATED, Json(placed))) +} + +/// POST /orders/batch:先在事务外读单价,再把三条写语句一次交给 `dd_transaction`。 +/// 库存、余额不足由 CHECK 约束兜底;单价在下单期间被改过则 `expectUpdateCount` 不满足,同样整体回滚。 +async fn place_order_batch( + State(state): State, + Json(order): Json, +) -> Result<(StatusCode, Json), ApiError> { + order.validate()?; + let product = first_row( + state + .dd + .execute(json!({ + "ds": "product", + "sql": "select price from product where id = ?", + "params": [order.product_id], + })) + .await?, + ) + .ok_or_else(|| ApiError::new(StatusCode::NOT_FOUND, "PRODUCT_NOT_FOUND", "商品不存在"))?; + let price = product["price"].as_f64().unwrap_or_default(); + let total_price = price * order.amount as f64; + let result = state + .dd + .transaction(vec![ + json!({ + "ds": "order", + "sql": "insert into p_order (user_id, product_id, amount, total_price, status) values (?, ?, ?, ?, 'SUCCESS')", + "params": [order.user_id, order.product_id, order.amount, total_price], + "generatedKeys": ["id"], + }), + json!({ + "ds": "product", + "sql": "update product set stock = stock - ? where id = ? and price = ?", + "params": [order.amount, order.product_id, price], + "expectUpdateCount": 1, + }), + json!({ + "ds": "account", + "sql": "update account set balance = balance - ? where id = ?", + "params": [total_price, order.user_id], + "expectUpdateCount": 1, + }), + ]) + .await?; + let order_id = result["results"][0]["generatedKeys"][0]["id"].clone(); + Ok(( + StatusCode::CREATED, + Json(order.placed(order_id, total_price)), + )) +} + +/// GET /orders +async fn list_orders(State(state): State) -> Result, ApiError> { + let mut result = state + .dd + .execute(json!({ + "ds": "order", + "sql": "select id, user_id, product_id, amount, total_price, status from p_order order by id", + })) + .await?; + Ok(Json(result["rows"].take())) +} diff --git a/polyglot/rust-axum-sample/src/routes/products.rs b/polyglot/rust-axum-sample/src/routes/products.rs new file mode 100644 index 00000000..09d81468 --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes/products.rs @@ -0,0 +1,80 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! `/products`,以及下单时扣减库存,对应 tx-local-sample 的 `ProductService`。 + +use super::AppState; +use crate::dynamic_datasource::{Transaction, first_row}; +use crate::error::ApiError; +use axum::extract::{Path, State}; +use axum::http::StatusCode; +use axum::routing::get; +use axum::{Json, Router}; +use serde_json::{Value, json}; + +pub(super) fn router() -> Router { + Router::new().route("/products/{id}", get(get_product)) +} + +/// GET /products/{id} +async fn get_product( + State(state): State, + Path(id): Path, +) -> Result, ApiError> { + let result = state + .dd + .execute(json!({ + "ds": "product", + "sql": "select id, price, stock from product where id = ?", + "params": [id], + })) + .await?; + first_row(result).map(Json).ok_or_else(not_found) +} + +/// 对应 `ProductService#reduceStock`:检查并扣减库存,返回总价。 +pub(super) async fn reduce_stock( + tx: &Transaction, + product_id: i64, + amount: i64, +) -> Result { + let product = first_row( + tx.execute(json!({ + "ds": "product", + "sql": "select price, stock from product where id = ? for update", + "params": [product_id], + })) + .await?, + ) + .ok_or_else(not_found)?; + if product["stock"].as_i64().unwrap_or_default() < amount { + return Err(ApiError::new( + StatusCode::CONFLICT, + "INSUFFICIENT_STOCK", + "库存不足", + )); + } + tx.execute(json!({ + "ds": "product", + "sql": "update product set stock = stock - ? where id = ?", + "params": [amount, product_id], + })) + .await?; + Ok(product["price"].as_f64().unwrap_or_default() * amount as f64) +} + +fn not_found() -> ApiError { + ApiError::new(StatusCode::NOT_FOUND, "PRODUCT_NOT_FOUND", "商品不存在") +} diff --git a/polyglot/rust-axum-sample/src/routes/users.rs b/polyglot/rust-axum-sample/src/routes/users.rs new file mode 100644 index 00000000..9847bb25 --- /dev/null +++ b/polyglot/rust-axum-sample/src/routes/users.rs @@ -0,0 +1,98 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! `/users`:读写分离与按请求头切换数据源,对应 jdbc-template-sample 与 spel-sample。 + +use super::AppState; +use crate::error::ApiError; +use axum::extract::{FromRequestParts, State}; +use axum::http::StatusCode; +use axum::http::request::Parts; +use axum::response::{IntoResponse, Response}; +use axum::routing::get; +use axum::{Json, Router}; +use serde::Deserialize; +use serde_json::{Value, json}; +use std::convert::Infallible; + +pub(super) fn router() -> Router { + Router::new().route("/users", get(list_users).post(create_user)) +} + +/// 请求头 `X-Datasource`,相当于 spel-sample 里的 `@DS("#header.xxx")`。 +struct RequestedDatasource(Option); + +impl FromRequestParts for RequestedDatasource { + type Rejection = Infallible; + + async fn from_request_parts(parts: &mut Parts, _: &S) -> Result { + let datasource = parts.headers.get("x-datasource"); + Ok(Self( + datasource + .and_then(|value| value.to_str().ok()) + .map(str::to_owned), + )) + } +} + +/// GET /users:默认读 slave 组(相当于 `@DS("slave")`),响应头回显实际命中的成员。 +async fn list_users( + State(state): State, + RequestedDatasource(datasource): RequestedDatasource, +) -> Result { + let mut result = state + .dd + .execute(json!({ + "ds": datasource.as_deref().unwrap_or("slave"), + "sql": "select id, name, age from t_user order by id", + })) + .await?; + let served = result["datasource"].as_str().unwrap_or_default().to_owned(); + Ok(( + [("x-datasource-served", served)], + Json(result["rows"].take()), + ) + .into_response()) +} + +#[derive(Deserialize)] +struct NewUser { + name: String, + age: Option, +} + +/// POST /users:不指定数据源时写 primary,也就是 master。 +async fn create_user( + State(state): State, + Json(user): Json, +) -> Result<(StatusCode, Json), ApiError> { + let result = state + .dd + .execute(json!({ + "sql": "insert into t_user (name, age) values (?, ?)", + "params": [user.name, user.age], + "generatedKeys": ["id"], + })) + .await?; + Ok(( + StatusCode::CREATED, + Json(json!({ + "id": result["generatedKeys"][0]["id"], + "name": user.name, + "age": user.age, + "datasource": result["datasource"], + })), + )) +} diff --git a/polyglot/rust-axum-sample/tests/api.rs b/polyglot/rust-axum-sample/tests/api.rs new file mode 100644 index 00000000..dbb28c19 --- /dev/null +++ b/polyglot/rust-axum-sample/tests/api.rs @@ -0,0 +1,248 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//! 与 python-fastapi-sample、typescript-hono-sample 相同的一组场景,分别跑在 H2 与 +//! Testcontainers 启动的 PostgreSQL 上。 + +use axum::Router; +use axum::body::{Body, to_bytes}; +use axum::http::{Method, Request, StatusCode}; +use rust_axum_sample::config::{load_config, sample_dir}; +use rust_axum_sample::dynamic_datasource::DynamicDataSource; +use rust_axum_sample::routes; +use serde_json::{Value, json}; +use std::collections::BTreeSet; +use testcontainers_modules::postgres::Postgres; +use testcontainers_modules::testcontainers::ImageExt; +use testcontainers_modules::testcontainers::runners::AsyncRunner; +use tokio::sync::Mutex; +use tokio::task::JoinSet; +use tower::ServiceExt; + +/// isolate 与 dd_open 都是进程级单例,两个测试不能同时打开。 +static OPEN: Mutex<()> = Mutex::const_new(()); + +#[tokio::test(flavor = "multi_thread")] +async fn h2() { + let _open = OPEN.lock().await; + let slave_3 = json!({ + "name": "slave_3", + "url": "jdbc:h2:mem:ds_slave_3;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driver_class_name": "org.h2.Driver", + }); + run_scenarios(load_config(&sample_dir(), "h2"), slave_3).await; +} + +#[tokio::test(flavor = "multi_thread")] +async fn postgresql() { + let _open = OPEN.lock().await; + let sample = sample_dir(); + // 与 compose.yaml 一样,initdb 阶段执行 init-databases.sql,为每个数据源建一个数据库 + let postgres = Postgres::default() + .with_init_sql(sample.join("db/postgresql/init-databases.sql")) + .with_tag("18.6-trixie") + .start() + .await + .unwrap(); + // 在容器里跑测试时 testcontainers-rs 会改用 bridge 网关,rootless Docker 下它连不到映射端口; + // 与 Python、Node 的 Testcontainers 一样认 TESTCONTAINERS_HOST_OVERRIDE(见 compose.yaml 的 rust-test) + let host = match std::env::var("TESTCONTAINERS_HOST_OVERRIDE") { + Ok(host) => host, + Err(_) => postgres.get_host().await.unwrap().to_string(), + }; + let port = postgres.get_host_port_ipv4(5432).await.unwrap().to_string(); + let mut config = load_config(&sample, "postgresql"); + config["variables"]["POSTGRES_HOST"] = json!(host); + config["variables"]["POSTGRES_PORT"] = json!(port); + config["variables"]["POSTGRES_USER"] = json!("postgres"); + config["variables"]["POSTGRES_PASSWORD"] = json!("postgres"); + let slave_3 = json!({ + "name": "slave_3", + "url": format!("jdbc:postgresql://{host}:{port}/ds_slave_3"), + "username": "postgres", + "password": "postgres", + "driver_class_name": "org.postgresql.Driver", + }); + run_scenarios(config, slave_3).await; +} + +/// 动态添加的 slave_3 由调用方给出,因为它的连接信息随数据库不同。 +async fn run_scenarios(config: Value, slave_3: Value) { + let dd = DynamicDataSource::open(config).await.unwrap(); + let app = routes::router(dd, &sample_dir().join("db")); + + // 读请求默认走 slave 组,两次请求轮询到两个成员 + let mut served = BTreeSet::new(); + for _ in 0..2 { + let reply = get(&app, "/users", None).await; + assert_eq!(reply.status, StatusCode::OK); + let datasource = reply.served.unwrap(); + assert_eq!(reply.body[0]["name"], format!("{datasource}-张三")); + served.insert(datasource); + } + assert_eq!( + served, + BTreeSet::from(["slave_1".to_owned(), "slave_2".to_owned()]) + ); + + // 请求头指定数据源;strict 模式下未知数据源直接报错 + let reply = get(&app, "/users", Some("master")).await; + assert_eq!(reply.served.as_deref(), Some("master")); + assert_eq!(reply.body[0]["name"], "master-张三"); + let reply = get(&app, "/users", Some("nope")).await; + assert_eq!(reply.status, StatusCode::NOT_FOUND); + assert_eq!(reply.body["code"], "DATASOURCE_NOT_FOUND"); + + // 写请求走 primary + let reply = post(&app, "/users", json!({ "name": "李四", "age": 20 })).await; + assert_eq!(reply.status, StatusCode::CREATED); + assert_eq!(reply.body["datasource"], "master"); + assert!(reply.body["id"].is_i64()); + assert!(names(&get(&app, "/users", Some("master")).await).contains(&"李四".to_owned())); + assert!(!names(&get(&app, "/users", Some("slave_1")).await).contains(&"李四".to_owned())); + + // 运行时增删数据源,slave_3 自动进入 slave 组 + let reply = post(&app, "/datasources", slave_3).await; + assert_eq!(reply.status, StatusCode::CREATED, "{}", reply.body); + assert_eq!( + reply.body["groups"]["slave"], + json!(["slave_1", "slave_2", "slave_3"]) + ); + let mut served = BTreeSet::new(); + for _ in 0..3 { + served.insert(get(&app, "/users", None).await.served.unwrap()); + } + assert_eq!(served.len(), 3); + let reply = send(&app, Method::DELETE, "/datasources/slave_3", None, None).await; + assert_eq!(reply.status, StatusCode::OK); + assert_eq!(reply.body["groups"]["slave"], json!(["slave_1", "slave_2"])); + let reply = send(&app, Method::DELETE, "/datasources/master", None, None).await; + assert_eq!(reply.status, StatusCode::BAD_REQUEST); + + // 会话式事务下单:与 tx-local-sample 相同的流程,失败时三个库一起回滚 + let reply = post(&app, "/orders", order(1, 1)).await; + assert_eq!(reply.status, StatusCode::CREATED, "{}", reply.body); + assert_eq!(reply.body["total_price"], 10.0); + assert_order_state(&app, 1, 19, 40.0).await; + let reply = post(&app, "/orders", order(1, 6)).await; + assert_eq!(reply.status, StatusCode::CONFLICT); + assert_eq!(reply.body["code"], "INSUFFICIENT_BALANCE"); + let reply = post(&app, "/orders", order(1, 30)).await; + assert_eq!(reply.body["code"], "INSUFFICIENT_STOCK"); + let reply = post(&app, "/orders", order(999, 1)).await; + assert_eq!(reply.status, StatusCode::NOT_FOUND); + assert_order_state(&app, 1, 19, 40.0).await; + + // 批量事务下单:一次 dd_transaction,CHECK 约束兜底 + let reply = post(&app, "/orders/batch", order(1, 1)).await; + assert_eq!(reply.status, StatusCode::CREATED, "{}", reply.body); + assert_order_state(&app, 2, 18, 30.0).await; + let reply = post(&app, "/orders/batch", order(1, 6)).await; + assert_eq!(reply.status, StatusCode::CONFLICT); + assert_eq!(reply.body["code"], "INSUFFICIENT_BALANCE"); + let reply = post(&app, "/orders/batch", order(1, 30)).await; + assert_eq!(reply.body["code"], "INSUFFICIENT_STOCK"); + assert_order_state(&app, 2, 18, 30.0).await; + + // 并发请求分散到 blocking 线程池的多个线程上,各自 attach 到 isolate + let mut requests = JoinSet::new(); + for _ in 0..20 { + let app = app.clone(); + requests.spawn(async move { get(&app, "/users", None).await.status }); + } + while let Some(status) = requests.join_next().await { + assert_eq!(status.unwrap(), StatusCode::OK); + } + + dd.close().await.unwrap(); +} + +struct Reply { + status: StatusCode, + served: Option, + body: Value, +} + +async fn send( + app: &Router, + method: Method, + uri: &str, + datasource: Option<&str>, + body: Option, +) -> Reply { + let mut request = Request::builder().method(method).uri(uri); + if let Some(datasource) = datasource { + request = request.header("x-datasource", datasource); + } + let request = match body { + Some(body) => request + .header("content-type", "application/json") + .body(Body::from(body.to_string())), + None => request.body(Body::empty()), + } + .unwrap(); + let response = app.clone().oneshot(request).await.unwrap(); + let status = response.status(); + let served = response + .headers() + .get("x-datasource-served") + .map(|value| value.to_str().unwrap().to_owned()); + let bytes = to_bytes(response.into_body(), usize::MAX).await.unwrap(); + let body = serde_json::from_slice(&bytes) + .unwrap_or_else(|_| Value::String(String::from_utf8_lossy(&bytes).into_owned())); + Reply { + status, + served, + body, + } +} + +async fn get(app: &Router, uri: &str, datasource: Option<&str>) -> Reply { + send(app, Method::GET, uri, datasource, None).await +} + +async fn post(app: &Router, uri: &str, body: Value) -> Reply { + send(app, Method::POST, uri, None, Some(body)).await +} + +fn names(reply: &Reply) -> Vec { + reply + .body + .as_array() + .unwrap() + .iter() + .map(|user| user["name"].as_str().unwrap().to_owned()) + .collect() +} + +fn order(product_id: i64, amount: i64) -> Value { + json!({ "user_id": 1, "product_id": product_id, "amount": amount }) +} + +async fn assert_order_state(app: &Router, orders: usize, stock: i64, balance: f64) { + assert_eq!( + get(app, "/orders", None) + .await + .body + .as_array() + .unwrap() + .len(), + orders + ); + assert_eq!(get(app, "/products/1", None).await.body["stock"], stock); + assert_eq!(get(app, "/accounts/1", None).await.body["balance"], balance); +} diff --git a/polyglot/typescript-hono-sample/.prettierignore b/polyglot/typescript-hono-sample/.prettierignore new file mode 100644 index 00000000..9ca0c326 --- /dev/null +++ b/polyglot/typescript-hono-sample/.prettierignore @@ -0,0 +1,17 @@ +# +# Copyright © ${project.inceptionYear} organization baomidou +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package-lock.json diff --git a/polyglot/typescript-hono-sample/config/h2.json b/polyglot/typescript-hono-sample/config/h2.json new file mode 100644 index 00000000..8f1ba376 --- /dev/null +++ b/polyglot/typescript-hono-sample/config/h2.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:h2:mem:ds_master;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:h2:mem:ds_slave_1;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:h2:mem:ds_slave_2;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:h2:mem:ds_order;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:h2:mem:ds_product;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:h2:mem:ds_account;DB_CLOSE_DELAY=-1", + "username": "sa", + "password": "", + "driverClassName": "org.h2.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/typescript-hono-sample/config/postgresql.json b/polyglot/typescript-hono-sample/config/postgresql.json new file mode 100644 index 00000000..17dc5d6c --- /dev/null +++ b/polyglot/typescript-hono-sample/config/postgresql.json @@ -0,0 +1,65 @@ +{ + "primary": "master", + "strict": true, + "datasource": { + "master": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_master", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-master.sql" + } + }, + "slave_1": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_1", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_1.sql" + } + }, + "slave_2": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_slave_2", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/user/schema.sql", + "data": "file:${DB_DIR}/user/data-slave_2.sql" + } + }, + "order": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_order", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-order.sql" + } + }, + "product": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_product", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-product.sql", + "data": "file:${DB_DIR}/order/data-product.sql" + } + }, + "account": { + "url": "jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/ds_account", + "username": "${POSTGRES_USER:postgres}", + "password": "${POSTGRES_PASSWORD:postgres}", + "driverClassName": "org.postgresql.Driver", + "init": { + "schema": "file:${DB_DIR}/order/schema-account.sql", + "data": "file:${DB_DIR}/order/data-account.sql" + } + } + } +} diff --git a/polyglot/typescript-hono-sample/db/order/data-account.sql b/polyglot/typescript-hono-sample/db/order/data-account.sql new file mode 100644 index 00000000..f4542f38 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/order/data-account.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:余额 50 +INSERT INTO account (id, balance) VALUES (1, 50); diff --git a/polyglot/typescript-hono-sample/db/order/data-product.sql b/polyglot/typescript-hono-sample/db/order/data-product.sql new file mode 100644 index 00000000..29e2c949 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/order/data-product.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 与 spring-boot-4/tx-local-sample 一致:单价 10,库存 20 +INSERT INTO product (id, price, stock) VALUES (1, 10, 20); diff --git a/polyglot/typescript-hono-sample/db/order/schema-account.sql b/polyglot/typescript-hono-sample/db/order/schema-account.sql new file mode 100644 index 00000000..e57a9a0c --- /dev/null +++ b/polyglot/typescript-hono-sample/db/order/schema-account.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS account; +CREATE TABLE account +( + id BIGINT PRIMARY KEY, + balance DOUBLE PRECISION NOT NULL, + -- 余额不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_account_balance CHECK (balance >= 0) +); diff --git a/polyglot/typescript-hono-sample/db/order/schema-order.sql b/polyglot/typescript-hono-sample/db/order/schema-order.sql new file mode 100644 index 00000000..162129d7 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/order/schema-order.sql @@ -0,0 +1,27 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS p_order; +CREATE TABLE p_order +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + user_id BIGINT NOT NULL, + product_id BIGINT NOT NULL, + amount INT NOT NULL, + total_price DOUBLE PRECISION, + status VARCHAR(16) NOT NULL, + add_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/polyglot/typescript-hono-sample/db/order/schema-product.sql b/polyglot/typescript-hono-sample/db/order/schema-product.sql new file mode 100644 index 00000000..c00a5370 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/order/schema-product.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +DROP TABLE IF EXISTS product; +CREATE TABLE product +( + id BIGINT PRIMARY KEY, + price DOUBLE PRECISION NOT NULL, + stock INT NOT NULL, + -- 库存不足时让扣减语句在数据库层失败,批量事务(POST /orders/batch)据此整体回滚 + CONSTRAINT ck_product_stock CHECK (stock >= 0) +); diff --git a/polyglot/typescript-hono-sample/db/postgresql/init-databases.sql b/polyglot/typescript-hono-sample/db/postgresql/init-databases.sql new file mode 100644 index 00000000..06d5ce5d --- /dev/null +++ b/polyglot/typescript-hono-sample/db/postgresql/init-databases.sql @@ -0,0 +1,25 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- PostgreSQL 变体里每个数据源各用一个数据库,ds_slave_3 留给 POST /datasources 的动态添加演示。 +-- compose.yaml 把本文件挂载到 /docker-entrypoint-initdb.d/,CI 与 JVM 单测也执行同一份脚本。 +CREATE DATABASE ds_master; +CREATE DATABASE ds_slave_1; +CREATE DATABASE ds_slave_2; +CREATE DATABASE ds_slave_3; +CREATE DATABASE ds_order; +CREATE DATABASE ds_product; +CREATE DATABASE ds_account; diff --git a/polyglot/typescript-hono-sample/db/user/data-master.sql b/polyglot/typescript-hono-sample/db/user/data-master.sql new file mode 100644 index 00000000..f5cb5ac2 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/user/data-master.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('master-张三', 18); diff --git a/polyglot/typescript-hono-sample/db/user/data-slave_1.sql b/polyglot/typescript-hono-sample/db/user/data-slave_1.sql new file mode 100644 index 00000000..382c7266 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/user/data-slave_1.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_1-张三', 18); diff --git a/polyglot/typescript-hono-sample/db/user/data-slave_2.sql b/polyglot/typescript-hono-sample/db/user/data-slave_2.sql new file mode 100644 index 00000000..98208519 --- /dev/null +++ b/polyglot/typescript-hono-sample/db/user/data-slave_2.sql @@ -0,0 +1,18 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- 每个库的初始数据带上库名,读请求命中哪个数据源一目了然 +INSERT INTO t_user (name, age) VALUES ('slave_2-张三', 18); diff --git a/polyglot/typescript-hono-sample/db/user/schema.sql b/polyglot/typescript-hono-sample/db/user/schema.sql new file mode 100644 index 00000000..029bc1ff --- /dev/null +++ b/polyglot/typescript-hono-sample/db/user/schema.sql @@ -0,0 +1,24 @@ +-- +-- Copyright © ${project.inceptionYear} organization baomidou +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- master / slave_1 / slave_2(以及动态添加的 slave_3)共用的表结构,H2 与 PostgreSQL 通用 +DROP TABLE IF EXISTS t_user; +CREATE TABLE t_user +( + id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + name VARCHAR(64) NOT NULL, + age INT +); diff --git a/polyglot/typescript-hono-sample/package-lock.json b/polyglot/typescript-hono-sample/package-lock.json new file mode 100644 index 00000000..1be85ecd --- /dev/null +++ b/polyglot/typescript-hono-sample/package-lock.json @@ -0,0 +1,2534 @@ +{ + "name": "typescript-hono-sample", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "typescript-hono-sample", + "version": "1.0.0", + "license": "Apache-2.0", + "dependencies": { + "@hono/node-server": "^2.1.5", + "hono": "^4.13.13" + }, + "devDependencies": { + "@testcontainers/postgresql": "^12.2.1", + "@types/node": "^26.6.5", + "prettier": "^3.9.10", + "testcontainers": "^12.2.1", + "typescript": "^7.0.2" + }, + "engines": { + "node": ">=26.9" + } + }, + "node_modules/@balena/dockerignore": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/@balena/dockerignore/-/dockerignore-1.0.2.tgz", + "integrity": "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.6", + "resolved": "https://registry.npmmirror.com/@grpc/grpc-js/-/grpc-js-1.14.6.tgz", + "integrity": "sha512-SgC/B3/VZ8lTyOZ4Cwk6f1skWhmkNAaVfiX90qd5u1rRXGKk1//8FTUEN9GvOUq7rfWIqAYkA3CoyumYVpOS6g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/grpc-js/node_modules/@grpc/proto-loader": { + "version": "0.8.1", + "resolved": "https://registry.npmmirror.com/@grpc/proto-loader/-/proto-loader-0.8.1.tgz", + "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmmirror.com/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@hono/node-server": { + "version": "2.1.5", + "resolved": "https://registry.npmmirror.com/@hono/node-server/-/node-server-2.1.5.tgz", + "integrity": "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q==", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "hono": "^4 || ^5.0.0-0" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmmirror.com/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/@protobufjs/utf8/-/utf8-1.1.2.tgz", + "integrity": "sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@testcontainers/postgresql": { + "version": "12.2.1", + "resolved": "https://registry.npmmirror.com/@testcontainers/postgresql/-/postgresql-12.2.1.tgz", + "integrity": "sha512-MIbI5KjZ9M4SY4+xzxg/w4ZLBeV+Jd6ognXoWn7dh/mhIhBbn7ss0MiZHNg2XbCbu03BW9YQ9+H9xW8PFkJWaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "testcontainers": "^12.2.1" + } + }, + "node_modules/@types/docker-modem": { + "version": "3.0.6", + "resolved": "https://registry.npmmirror.com/@types/docker-modem/-/docker-modem-3.0.6.tgz", + "integrity": "sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/ssh2": "*" + } + }, + "node_modules/@types/dockerode": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/@types/dockerode/-/dockerode-4.0.2.tgz", + "integrity": "sha512-hA4myZ0XzwHG/p/eCLElYsQS3y1XZfvi6AfLFKVp1SNpPkO6J3xLatacAFVkReTxXRoIa3eHJmhJi9w6I3+zNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/docker-modem": "*", + "@types/node": "*", + "@types/ssh2": "*" + } + }, + "node_modules/@types/node": { + "version": "26.6.5", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-26.6.5.tgz", + "integrity": "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/ssh2": { + "version": "1.15.6", + "resolved": "https://registry.npmmirror.com/@types/ssh2/-/ssh2-1.15.6.tgz", + "integrity": "sha512-oGdxhBqcRTwSTKFm+9EiKzkNVYRLEFkcW44lhguvBalGJbWfGnDt/ezwSUZc+SF9m9bMc3VyklNAtp7zICjS5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "^18.11.18" + } + }, + "node_modules/@types/ssh2-streams": { + "version": "0.1.13", + "resolved": "https://registry.npmmirror.com/@types/ssh2-streams/-/ssh2-streams-0.1.13.tgz", + "integrity": "sha512-faHyY3brO9oLEA0QlcO8N2wT7R0+1sHWZvQ+y3rMLwdY1ZyS1z0W3t65j9PqT4HmQ6ALzNe7RZlNuCNE0wBSWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ssh2/node_modules/@types/node": { + "version": "18.19.130", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-18.19.130.tgz", + "integrity": "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/ssh2/node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-regex": { + "version": "6.4.0", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.4.0.tgz", + "integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/archiver": { + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/archiver/-/archiver-7.0.1.tgz", + "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^5.0.2", + "async": "^3.2.4", + "buffer-crc32": "^1.0.0", + "readable-stream": "^4.0.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^3.0.0", + "zip-stream": "^6.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/archiver-utils": { + "version": "5.0.2", + "resolved": "https://registry.npmmirror.com/archiver-utils/-/archiver-utils-5.0.2.tgz", + "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^10.0.0", + "graceful-fs": "^4.2.0", + "is-stream": "^2.0.1", + "lazystream": "^1.0.0", + "lodash": "^4.17.15", + "normalize-path": "^3.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmmirror.com/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, + "node_modules/async-lock": { + "version": "1.4.1", + "resolved": "https://registry.npmmirror.com/async-lock/-/async-lock-1.4.1.tgz", + "integrity": "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/b4a": { + "version": "1.9.0", + "resolved": "https://registry.npmmirror.com/b4a/-/b4a-1.9.0.tgz", + "integrity": "sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/bare-events": { + "version": "2.9.2", + "resolved": "https://registry.npmmirror.com/bare-events/-/bare-events-2.9.2.tgz", + "integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/bare-fs": { + "version": "4.8.4", + "resolved": "https://registry.npmmirror.com/bare-fs/-/bare-fs-4.8.4.tgz", + "integrity": "sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.28.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-path": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/bare-path/-/bare-path-3.1.2.tgz", + "integrity": "sha512-ZyKbsuuqK6Ag0K8pX6V5Txq6XeJRvY+wXucnFGRjiyVYP9YWDpIQugk/b+enRYrEYBJaqLzghRQpXPMR7341Nw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bare-stream": { + "version": "2.13.4", + "resolved": "https://registry.npmmirror.com/bare-stream/-/bare-stream-2.13.4.tgz", + "integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.8.1", + "streamx": "^2.25.0", + "teex": "^1.0.1" + }, + "peerDependencies": { + "bare-abort-controller": "*", + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + }, + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.5.5", + "resolved": "https://registry.npmmirror.com/bare-url/-/bare-url-2.5.5.tgz", + "integrity": "sha512-iM9qJCruvpt2rPaLsrumVDru9pogI7PHziHIa9kTNRFt8C8HuSa+kI9kFezK+NvHEFnnz71rKGZ1EAilq/3V/Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-path": "^3.0.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/brace-expansion": { + "version": "2.1.7", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.1.7.tgz", + "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-crc32": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/buildcheck": { + "version": "0.0.7", + "resolved": "https://registry.npmmirror.com/buildcheck/-/buildcheck-0.0.7.tgz", + "integrity": "sha512-lHblz4ahamxpTmnsk+MNTRWsjYKv965MwOrSJyeD588rR3Jcu7swE+0wN5F+PbL5cjgu/9ObkhfzEPuofEMwLA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/byline": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/byline/-/byline-5.0.0.tgz", + "integrity": "sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true, + "license": "ISC" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmmirror.com/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/compress-commons": { + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/compress-commons/-/compress-commons-6.0.2.tgz", + "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "crc32-stream": "^6.0.0", + "is-stream": "^2.0.1", + "normalize-path": "^3.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cpu-features": { + "version": "0.0.10", + "resolved": "https://registry.npmmirror.com/cpu-features/-/cpu-features-0.0.10.tgz", + "integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "dependencies": { + "buildcheck": "~0.0.6", + "nan": "^2.19.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/crc32-stream/-/crc32-stream-6.0.0.tgz", + "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==", + "dev": true, + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/docker-compose": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/docker-compose/-/docker-compose-1.5.0.tgz", + "integrity": "sha512-O+eD6c63+BJORUWddXA7uAlI6H1KLDPd/aS14k73nXYpFliM48C3xrrKB3sXsR1Fp/rHUZQe7+fJ+QA7+jepyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "yaml": "^2.2.2" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/docker-modem": { + "version": "5.0.7", + "resolved": "https://registry.npmmirror.com/docker-modem/-/docker-modem-5.0.7.tgz", + "integrity": "sha512-XJgGhoR/CLpqshm4d3L7rzH6t8NgDFUIIpztYlLHIApeJjMZKYJMz2zxPsYxnejq5h3ELYSw/RBsi3t5h7gNTA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.1", + "readable-stream": "^3.5.0", + "split-ca": "^1.0.1", + "ssh2": "^1.15.0" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/docker-modem/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/dockerode": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/dockerode/-/dockerode-5.0.1.tgz", + "integrity": "sha512-avsq/xk4YPIrn0CgleX5bjT9Y8IT1p9PxrNQ++RBQ2WEyFfHCTDsT9kmyxz+H/axnjAwg8wJWEIuPGOUuNupiA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@balena/dockerignore": "^1.0.2", + "@grpc/grpc-js": "^1.11.1", + "@grpc/proto-loader": "^0.7.13", + "docker-modem": "^5.0.7", + "protobufjs": "^7.3.2", + "tar-fs": "^2.1.4" + }, + "engines": { + "node": ">= 14.17" + } + }, + "node_modules/dockerode/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/dockerode/node_modules/tar-fs": { + "version": "2.1.5", + "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-2.1.5.tgz", + "integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/dockerode/node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmmirror.com/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true, + "license": "MIT" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-port": { + "version": "5.1.1", + "resolved": "https://registry.npmmirror.com/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmmirror.com/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/hono": { + "version": "4.13.13", + "resolved": "https://registry.npmmirror.com/hono/-/hono-4.13.13.tgz", + "integrity": "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lazystream/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/lazystream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmmirror.com/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmmirror.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nan": { + "version": "2.29.0", + "resolved": "https://registry.npmmirror.com/nan/-/nan-2.29.0.tgz", + "integrity": "sha512-GlGk3HIvitbvs+LT3g6XUP1kpirKNvmDFwF/bmo6XNWSb/eYEs/O4bfgIEIXCZ+lIOTS5xNwDvSGMw6FJdAhtA==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmmirror.com/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/prettier": { + "version": "3.9.10", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.9.10.tgz", + "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmmirror.com/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmmirror.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/proper-lockfile/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/properties-reader": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/properties-reader/-/properties-reader-3.0.1.tgz", + "integrity": "sha512-WPn+h9RGEExOKdu4bsF4HksG/uzd3cFq3MFtq8PsFeExPse5Ha/VOjQNyHhjboBFwGXGev6muJYTSPAOkROq2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "mkdirp": "^3.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/properties?sponsor=1" + } + }, + "node_modules/protobufjs": { + "version": "7.6.6", + "resolved": "https://registry.npmmirror.com/protobufjs/-/protobufjs-7.6.6.tgz", + "integrity": "sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==", + "dev": true, + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", + "@protobufjs/float": "^1.0.2", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", + "@types/node": ">=13.7.0", + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/readable-stream": { + "version": "4.8.0", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-4.8.0.tgz", + "integrity": "sha512-2jhTTU3Eilp/2DMT71gbcoqC35eQHasMJH0RHkYxwlxIv3+FR6Y5xAFZIwEGLxKkjZYEFlsiMNIdwUqjK2lLHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmmirror.com/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.9", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.9.tgz", + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmmirror.com/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/split-ca/-/split-ca-1.0.1.tgz", + "integrity": "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ssh-remote-port-forward": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/ssh-remote-port-forward/-/ssh-remote-port-forward-1.0.4.tgz", + "integrity": "sha512-x0LV1eVDwjf1gmG7TTnfqIzf+3VPRz7vrNIjX6oYLbeCrf/PeVY6hkT68Mg+q02qXxQhrLjB0jfgvhevoCRmLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ssh2": "^0.5.48", + "ssh2": "^1.4.0" + } + }, + "node_modules/ssh-remote-port-forward/node_modules/@types/ssh2": { + "version": "0.5.52", + "resolved": "https://registry.npmmirror.com/@types/ssh2/-/ssh2-0.5.52.tgz", + "integrity": "sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/ssh2-streams": "*" + } + }, + "node_modules/ssh2": { + "version": "1.17.0", + "resolved": "https://registry.npmmirror.com/ssh2/-/ssh2-1.17.0.tgz", + "integrity": "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2" + }, + "engines": { + "node": ">=10.16.0" + }, + "optionalDependencies": { + "cpu-features": "~0.0.10", + "nan": "^2.23.0" + } + }, + "node_modules/streamx": { + "version": "2.28.1", + "resolved": "https://registry.npmmirror.com/streamx/-/streamx-2.28.1.tgz", + "integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar-fs": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-3.1.3.tgz", + "integrity": "sha512-/hU4AXnIdZu+Gvl1pk0oI5f5HxWsCJRtY2aFaJdk9VvyL48DWU6iU5WAIPG+wIi1YvWA6eTJvIviP/tMAZZNwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^4.0.1", + "bare-path": "^3.0.0" + } + }, + "node_modules/tar-stream": { + "version": "3.2.2", + "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-3.2.2.tgz", + "integrity": "sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.9.0", + "bare-fs": "^4.8.2", + "fast-fifo": "^1.3.2", + "streamx": "^2.28.1" + } + }, + "node_modules/teex": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/teex/-/teex-1.0.1.tgz", + "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "streamx": "^2.12.5" + } + }, + "node_modules/testcontainers": { + "version": "12.2.1", + "resolved": "https://registry.npmmirror.com/testcontainers/-/testcontainers-12.2.1.tgz", + "integrity": "sha512-JfbCyOvLdzatwgqUI3AvYCwRW0P5mCkKQVBPO8U5qSH1efC2kHvnfWmi9VHloy1rAFG2MEqWZObRH4bq0gU1kQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@balena/dockerignore": "^1.0.2", + "@types/dockerode": "^4.0.1", + "archiver": "^7.0.1", + "async-lock": "^1.4.1", + "byline": "^5.0.0", + "debug": "^4.4.3", + "docker-compose": "^1.5.0", + "dockerode": "^5.0.1", + "get-port": "^5.1.1", + "proper-lockfile": "^4.1.2", + "properties-reader": "^3.0.1", + "ssh-remote-port-forward": "^1.0.4", + "tar-fs": "^3.1.3", + "tmp": "^0.2.7", + "undici": "^8.11.2" + }, + "engines": { + "node": ">= 22.22" + } + }, + "node_modules/text-decoder": { + "version": "1.2.7", + "resolved": "https://registry.npmmirror.com/text-decoder/-/text-decoder-1.2.7.tgz", + "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/tmp": { + "version": "0.2.7", + "resolved": "https://registry.npmmirror.com/tmp/-/tmp-0.2.7.tgz", + "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmmirror.com/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", + "dev": true, + "license": "Unlicense" + }, + "node_modules/typescript": { + "version": "7.0.2", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/undici": { + "version": "8.12.2", + "resolved": "https://registry.npmmirror.com/undici/-/undici-8.12.2.tgz", + "integrity": "sha512-XtuDWVdqTLr3NAxm2ly9/hU6kUsJOgGh1RASzMBbsw6aWCOaQzHdW+QQDfdERjfJ2V5vL5pRPa4RetO9UfivDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yaml": { + "version": "2.9.1", + "resolved": "https://registry.npmmirror.com/yaml/-/yaml-2.9.1.tgz", + "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/zip-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/zip-stream/-/zip-stream-6.0.1.tgz", + "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "archiver-utils": "^5.0.0", + "compress-commons": "^6.0.2", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + } + } +} diff --git a/polyglot/typescript-hono-sample/package.json b/polyglot/typescript-hono-sample/package.json new file mode 100644 index 00000000..a9465634 --- /dev/null +++ b/polyglot/typescript-hono-sample/package.json @@ -0,0 +1,35 @@ +{ + "name": "typescript-hono-sample", + "version": "1.0.0", + "private": true, + "description": "在 Hono 里通过 libdynamicds 使用 dynamic-datasource", + "license": "Apache-2.0", + "type": "module", + "engines": { + "node": ">=26.9" + }, + "scripts": { + "prestart": "node scripts/build-libdynamicds.ts", + "start": "node --disable-warning=ExperimentalWarning src/server.ts", + "pretest": "node scripts/build-libdynamicds.ts", + "test": "node --disable-warning=ExperimentalWarning --test \"test/**/*.test.ts\"", + "typecheck": "tsc", + "format": "prettier --write .", + "format:check": "prettier --check ." + }, + "dependencies": { + "@hono/node-server": "^2.1.5", + "hono": "^4.13.13" + }, + "devDependencies": { + "@testcontainers/postgresql": "^12.2.1", + "@types/node": "^26.6.5", + "prettier": "^3.9.10", + "testcontainers": "^12.2.1", + "typescript": "^7.0.2" + }, + "prettier": { + "printWidth": 120, + "singleQuote": true + } +} diff --git a/polyglot/typescript-hono-sample/scripts/build-libdynamicds.ts b/polyglot/typescript-hono-sample/scripts/build-libdynamicds.ts new file mode 100644 index 00000000..a90e8206 --- /dev/null +++ b/polyglot/typescript-hono-sample/scripts/build-libdynamicds.ts @@ -0,0 +1,26 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * npm start / npm test 之前按需构建 libdynamicds:共享库已是最新时 build-libdynamicds.sh 什么也不做。 + * 用 DYNAMIC_DATASOURCE_LIB 指定了现成的共享库时不构建。 + */ +import { spawnSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; + +if (!process.env.DYNAMIC_DATASOURCE_LIB) { + const script = fileURLToPath(new URL('../../build-libdynamicds.sh', import.meta.url)); + process.exitCode = spawnSync('sh', [script], { stdio: 'inherit' }).status ?? 1; +} diff --git a/polyglot/typescript-hono-sample/src/app.ts b/polyglot/typescript-hono-sample/src/app.ts new file mode 100644 index 00000000..4e92271c --- /dev/null +++ b/polyglot/typescript-hono-sample/src/app.ts @@ -0,0 +1,39 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * HTTP 接口,与 rust-axum-sample、python-fastapi-sample 完全一致,约定见 ../README.md。 + * + * 按 Hono 文档的 Best Practices 组织:每个资源一个子应用(routes/),这里用 app.route() 挂载它们。 + */ +import { Hono } from 'hono'; +import type { DynamicDataSource } from './dynamic-datasource.ts'; +import { handleError } from './errors.ts'; +import { accounts } from './routes/accounts.ts'; +import { datasources } from './routes/datasources.ts'; +import { orders } from './routes/orders.ts'; +import { products } from './routes/products.ts'; +import { users } from './routes/users.ts'; + +export function createApp(dd: DynamicDataSource, dbDir: string): Hono { + const app = new Hono(); + app.onError(handleError); + app.route('/users', users(dd)); + app.route('/datasources', datasources(dd, dbDir)); + app.route('/orders', orders(dd)); + app.route('/products', products(dd)); + app.route('/accounts', accounts(dd)); + return app; +} diff --git a/polyglot/typescript-hono-sample/src/config.ts b/polyglot/typescript-hono-sample/src/config.ts new file mode 100644 index 00000000..239872d1 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/config.ts @@ -0,0 +1,37 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { readFileSync } from 'node:fs'; +import { join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +/** 存放本示例自带的 config/ 与 db/ 的目录:默认是本项目的根目录,也可以用 SAMPLE_DIR 指定。 */ +export const SAMPLE_DIR = resolve(process.env.SAMPLE_DIR ?? fileURLToPath(new URL('..', import.meta.url))); + +export const DB_DIR = join(SAMPLE_DIR, 'db'); + +/** 默认用 ../dynamic-datasource-ffi 构建出的共享库。 */ +export const LIBRARY = + process.env.DYNAMIC_DATASOURCE_LIB ?? + fileURLToPath(new URL('../../dynamic-datasource-ffi/target/libdynamicds.so', import.meta.url)); + +/** 读取 config/.json(默认取 DD_PROFILE,再默认 h2),并通过 variables 告诉 dd_open 建表脚本的位置。 */ +export function loadConfig( + profile = process.env.DD_PROFILE ?? 'h2', + variables: Record = {}, +): Record { + const config = JSON.parse(readFileSync(join(SAMPLE_DIR, 'config', `${profile}.json`), 'utf8')); + return { ...config, variables: { DB_DIR, ...variables } }; +} diff --git a/polyglot/typescript-hono-sample/src/dynamic-datasource.ts b/polyglot/typescript-hono-sample/src/dynamic-datasource.ts new file mode 100644 index 00000000..05262b07 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/dynamic-datasource.ts @@ -0,0 +1,248 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * libdynamicds(dynamic-datasource 的 GraalVM native 共享库)在 Node.js 里的封装。 + * + * node:ffi 只有同步调用:主线程只负责创建 isolate,所有业务调用都交给固定大小的 worker 池。 + * 每个 worker 独占一个 OS 线程并在启动时 attach 一次,数据库调用因此不会阻塞事件循环。 + */ +import { existsSync } from 'node:fs'; +import { availableParallelism } from 'node:os'; +import { Worker } from 'node:worker_threads'; +import { load, type Operation } from './native.ts'; +import type { WorkerData, WorkerRequest } from './worker.ts'; + +/** 一条语句;ds 为空时走 primary,相当于不标 @DS 的方法。 */ +export interface Statement { + ds?: string; + sql: string; + params?: unknown[]; + generatedKeys?: string[]; + expectUpdateCount?: number; +} + +export type Row = Record; + +export interface ExecuteResult { + /** 实际命中的数据源:分组请求时是被负载均衡选中的成员。 */ + datasource: string; + rows?: Row[]; + updateCount?: number; + generatedKeys?: Row[]; +} + +/** 查询结果的第一行。 */ +export function firstRow(result: ExecuteResult): Row | undefined { + return result.rows?.[0]; +} + +export interface Datasources { + datasources: string[]; + groups: Record; +} + +/** libdynamicds 返回的 {"ok":false,"error":{...}},code 与 Java 侧的 ErrorCode 一一对应。 */ +export class DynamicDataSourceError extends Error { + readonly code: string; + readonly sqlState: string | undefined; + + constructor(error: { code: string; message: string; sqlState?: string }) { + super(error.message); + this.name = 'DynamicDataSourceError'; + this.code = error.code; + this.sqlState = error.sqlState; + } +} + +interface Job { + request: WorkerRequest; + resolve: (response: string) => void; + reject: (error: unknown) => void; +} + +/** 每个 worker 同时只处理一个请求,其余请求排队等空闲的 worker。 */ +class WorkerPool { + readonly #workers: Worker[] = []; + readonly #idle: Worker[] = []; + readonly #queue: Job[] = []; + readonly #running = new Map(); + + constructor(data: WorkerData, size: number) { + for (let i = 0; i < size; i++) { + const worker = new Worker(new URL('./worker.ts', import.meta.url), { workerData: data }); + worker.on('message', (response: string) => this.#finish(worker, response)); + // 出错的 worker 随即退出:只让当前请求失败,不再给它派活 + worker.on('error', (error) => { + this.#running.get(worker)?.reject(error); + this.#running.delete(worker); + }); + this.#workers.push(worker); + this.#idle.push(worker); + } + } + + call(operation: Operation, request: unknown): Promise { + return new Promise((resolve, reject) => { + this.#queue.push({ request: { operation, request: JSON.stringify(request) }, resolve, reject }); + this.#dispatch(); + }); + } + + async close(): Promise { + await Promise.all( + this.#workers.map( + (worker) => + new Promise((resolve) => { + worker.once('exit', () => resolve()); + worker.postMessage('close'); + }), + ), + ); + } + + #finish(worker: Worker, response: string): void { + const job = this.#running.get(worker); + this.#running.delete(worker); + this.#idle.push(worker); + job?.resolve(response); + this.#dispatch(); + } + + #dispatch(): void { + while (this.#idle.length > 0 && this.#queue.length > 0) { + const worker = this.#idle.pop()!; + const job = this.#queue.shift()!; + this.#running.set(worker, job); + worker.postMessage(job.request); + } + } +} + +type Call = (operation: Operation, request: unknown) => Promise; + +/** 会话式事务。语句可以由任意 worker 发出,Java 侧会交给该事务独占的线程执行。 */ +export class Transaction { + readonly id: string; + readonly #call: Call; + + constructor(id: string, call: Call) { + this.id = id; + this.#call = call; + } + + /** dd_tx_execute,请求与 DynamicDataSource#execute 相同。 */ + execute(statement: Statement): Promise { + return this.#call('dd_tx_execute', { ...statement, txId: this.id }); + } + + async commit(): Promise { + await this.#call('dd_tx_commit', { txId: this.id }); + } + + async rollback(): Promise { + await this.#call('dd_tx_rollback', { txId: this.id }); + } +} + +/** + * 进程内只有一个 isolate,多次 open 也共用它。主线程一直持有库的句柄:否则 close 之后 worker 全部退出, + * 库会被 dlclose 卸载,而 isolate 里的 Java 线程(连接池等)仍在运行,再次 open 时进程直接崩溃。 + */ +let shared: { native: ReturnType; isolate: bigint } | undefined; + +/** 进程内唯一的 DynamicRoutingDataSource。 */ +export class DynamicDataSource { + readonly #pool: WorkerPool; + + private constructor(pool: WorkerPool) { + this.#pool = pool; + } + + /** 创建 isolate、启动 worker 池,然后 dd_open;config 的字段与 spring.datasource.dynamic.* 同名。 */ + static async open(config: object, options: { library: string; workers?: number }): Promise { + if (!existsSync(options.library)) { + throw new Error( + `${options.library} 不存在:npm start / npm test 之前会用 GraalVM 构建它,请安装 GraalVM 25 并让 JAVA_HOME ` + + '或 GRAALVM_HOME 指向它;或用 DYNAMIC_DATASOURCE_LIB 指向 libdynamicds.so', + ); + } + if (!shared) { + const native = load(options.library); + shared = { native, isolate: native.createIsolate() }; + } + const workers = options.workers ?? Math.min(4, availableParallelism()); + const dd = new DynamicDataSource(new WorkerPool({ library: options.library, isolate: shared.isolate }, workers)); + await dd.#call('dd_open', config); + return dd; + } + + /** dd_close:回滚未结束的会话式事务、关闭所有连接池,再停掉 worker。 */ + async close(): Promise { + await this.#call('dd_close', {}); + await this.#pool.close(); + } + + /** dd_execute:在 ds 指定的数据源或分组上执行一条语句,相当于调用一个 @DS(ds) 方法。 */ + execute(statement: Statement): Promise { + return this.#call('dd_execute', statement); + } + + /** dd_transaction:一次调用内把一批语句放进同一个本地事务。 */ + transaction(statements: Statement[]): Promise<{ xid: string; results: ExecuteResult[] }> { + return this.#call('dd_transaction', { statements }); + } + + addDatasource(property: { name: string; url: string } & Record): Promise { + return this.#call('dd_add_datasource', property); + } + + removeDatasource(name: string): Promise { + return this.#call('dd_remove_datasource', { name }); + } + + listDatasources(): Promise { + return this.#call('dd_list_datasources', {}); + } + + /** dd_tx_begin:开启跨多次调用的会话式事务。 */ + async begin(): Promise { + const { txId } = await this.#call<{ txId: string }>('dd_tx_begin', {}); + return new Transaction(txId, this.#call); + } + + /** 相当于 @DSTransactional:work 正常返回时提交,抛出异常时回滚。 */ + async transactional(work: (tx: Transaction) => Promise): Promise { + const tx = await this.begin(); + let result: T; + try { + result = await work(tx); + } catch (error) { + // 回滚失败时还有 Java 侧的空闲超时兜底,这里保留业务错误本身 + await tx.rollback().catch(() => {}); + throw error; + } + await tx.commit(); + return result; + } + + readonly #call: Call = async (operation: Operation, request: unknown): Promise => { + const response = JSON.parse(await this.#pool.call(operation, request)); + if (!response.ok) { + throw new DynamicDataSourceError(response.error); + } + return response.data as T; + }; +} diff --git a/polyglot/typescript-hono-sample/src/errors.ts b/polyglot/typescript-hono-sample/src/errors.ts new file mode 100644 index 00000000..71f6c7c2 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/errors.ts @@ -0,0 +1,63 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** 错误响应 {"code","message"},三个示例的错误码一致;相当于 tx-local-sample 的 GlobalExceptionHandler。 */ +import type { ErrorHandler } from 'hono'; +import type { ContentfulStatusCode } from 'hono/utils/http-status'; +import { DynamicDataSourceError } from './dynamic-datasource.ts'; + +/** dynamic-datasource 的错误码到 HTTP 状态码,其余一律 500。 */ +const STATUSES: Record = { + BAD_REQUEST: 400, + DATASOURCE_NOT_FOUND: 404, + CONSTRAINT_VIOLATION: 409, + UPDATE_COUNT_MISMATCH: 409, +}; + +export class ApiError extends Error { + readonly status: ContentfulStatusCode; + readonly code: string; + + constructor(status: ContentfulStatusCode, code: string, message: string) { + super(message); + this.status = status; + this.code = code; + } + + static of(error: DynamicDataSourceError): ApiError { + const message = error.message.toLowerCase(); + // 批量事务里库存、余额不足由 CHECK 约束兜底,按约束名还原成与会话式事务相同的业务错误 + if (error.code === 'CONSTRAINT_VIOLATION' && message.includes('ck_product_stock')) { + return new ApiError(409, 'INSUFFICIENT_STOCK', '库存不足'); + } + if (error.code === 'CONSTRAINT_VIOLATION' && message.includes('ck_account_balance')) { + return new ApiError(409, 'INSUFFICIENT_BALANCE', '余额不足'); + } + return new ApiError(STATUSES[error.code] ?? 500, error.code, error.message); + } +} + +/** 交给 app.onError:子应用里抛出的错误也由它统一转换成错误响应。 */ +export const handleError: ErrorHandler = (error, c) => { + if (error instanceof SyntaxError) { + return c.json({ code: 'BAD_REQUEST', message: error.message }, 400); + } + const apiError = error instanceof DynamicDataSourceError ? ApiError.of(error) : error; + if (apiError instanceof ApiError) { + return c.json({ code: apiError.code, message: apiError.message }, apiError.status); + } + console.error(error); + return c.json({ code: 'INTERNAL', message: String(error) }, 500); +}; diff --git a/polyglot/typescript-hono-sample/src/native.ts b/polyglot/typescript-hono-sample/src/native.ts new file mode 100644 index 00000000..92c70de8 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/native.ts @@ -0,0 +1,81 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * libdynamicds 的 node:ffi 绑定,主线程与 worker 共用。node:ffi 只有同步调用, + * 所以真正的业务调用都放在 worker 里执行,见 dynamic-datasource.ts。 + */ +import { dlopen, toString } from 'node:ffi'; + +/** 业务函数的统一签名:char* dd_xxx(graal_isolatethread_t* thread, const char* request)。 */ +const OPERATION = { arguments: ['pointer', 'string'], return: 'pointer' } as const; + +export type Operation = + | 'dd_open' + | 'dd_close' + | 'dd_execute' + | 'dd_transaction' + | 'dd_add_datasource' + | 'dd_remove_datasource' + | 'dd_list_datasources' + | 'dd_tx_begin' + | 'dd_tx_execute' + | 'dd_tx_commit' + | 'dd_tx_rollback'; + +export function load(path: string) { + const { lib, functions } = dlopen(path, { + dd_create_isolate: { arguments: [], return: 'pointer' }, + dd_get_isolate: { arguments: ['pointer'], return: 'pointer' }, + dd_attach_thread: { arguments: ['pointer'], return: 'pointer' }, + dd_detach_thread: { arguments: ['pointer'], return: 'int32' }, + dd_free: { arguments: ['pointer', 'pointer'], return: 'void' }, + dd_open: OPERATION, + dd_close: OPERATION, + dd_execute: OPERATION, + dd_transaction: OPERATION, + dd_add_datasource: OPERATION, + dd_remove_datasource: OPERATION, + dd_list_datasources: OPERATION, + dd_tx_begin: OPERATION, + dd_tx_execute: OPERATION, + dd_tx_commit: OPERATION, + dd_tx_rollback: OPERATION, + }); + return { + /** 库的句柄:只要有人持有它,库就不会被 dlclose 卸载。 */ + lib, + /** 创建 isolate 并返回它的句柄;调用线程随之 attach。 */ + createIsolate(): bigint { + return functions.dd_get_isolate(functions.dd_create_isolate()); + }, + /** 把当前 OS 线程 attach 到 isolate,返回本线程的 isolate 线程。 */ + attach(isolate: bigint): bigint { + return functions.dd_attach_thread(isolate); + }, + detach(thread: bigint): void { + functions.dd_detach_thread(thread); + }, + /** 同步调用一个业务函数:请求与返回值都是 JSON,返回的字符串用 dd_free 释放。 */ + call(thread: bigint, operation: Operation, request: string): string { + const pointer = functions[operation](thread, request); + try { + return toString(pointer) ?? ''; + } finally { + functions.dd_free(thread, pointer); + } + }, + }; +} diff --git a/polyglot/typescript-hono-sample/src/routes/accounts.ts b/polyglot/typescript-hono-sample/src/routes/accounts.ts new file mode 100644 index 00000000..3c8da423 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/routes/accounts.ts @@ -0,0 +1,58 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** /accounts,以及下单时扣减余额,对应 tx-local-sample 的 AccountService。 */ +import { Hono } from 'hono'; +import { firstRow, type DynamicDataSource, type Transaction } from '../dynamic-datasource.ts'; +import { ApiError } from '../errors.ts'; + +export function accounts(dd: DynamicDataSource): Hono { + const app = new Hono(); + + /** GET /accounts/:id */ + app.get('/:id', async (c) => { + const account = firstRow( + await dd.execute({ + ds: 'account', + sql: 'select id, balance from account where id = ?', + params: [Number(c.req.param('id'))], + }), + ); + if (!account) { + throw new ApiError(404, 'ACCOUNT_NOT_FOUND', '用户不存在'); + } + return c.json(account); + }); + + return app; +} + +/** 对应 AccountService#reduceBalance:检查并扣减余额。 */ +export async function reduceBalance(tx: Transaction, userId: number, totalPrice: number): Promise { + const account = firstRow( + await tx.execute({ ds: 'account', sql: 'select balance from account where id = ? for update', params: [userId] }), + ); + if (!account) { + throw new ApiError(404, 'ACCOUNT_NOT_FOUND', '用户不存在'); + } + if ((account.balance as number) < totalPrice) { + throw new ApiError(409, 'INSUFFICIENT_BALANCE', '余额不足'); + } + await tx.execute({ + ds: 'account', + sql: 'update account set balance = balance - ? where id = ?', + params: [totalPrice, userId], + }); +} diff --git a/polyglot/typescript-hono-sample/src/routes/datasources.ts b/polyglot/typescript-hono-sample/src/routes/datasources.ts new file mode 100644 index 00000000..4c48b243 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/routes/datasources.ts @@ -0,0 +1,54 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** /datasources:运行时增删数据源,对应 add-remove-datasource-sample。 */ +import { join } from 'node:path'; +import { Hono } from 'hono'; +import type { DynamicDataSource } from '../dynamic-datasource.ts'; + +export function datasources(dd: DynamicDataSource, dbDir: string): Hono { + const app = new Hono(); + + /** GET /datasources:当前的数据源与分组。 */ + app.get('/', async (c) => c.json(await dd.listDatasources())); + + /** + * POST /datasources:名称带下划线时自动入组(slave_3 → slave)。 + * 新从库沿用 t_user 的建表脚本:脚本路径由服务端决定,不接受客户端传入。 + */ + app.post('/', async (c) => { + const datasource = await c.req.json<{ + name: string; + url: string; + username?: string; + password?: string; + driver_class_name?: string; + }>(); + const result = await dd.addDatasource({ + name: datasource.name, + url: datasource.url, + username: datasource.username, + password: datasource.password, + driverClassName: datasource.driver_class_name, + init: { schema: `file:${join(dbDir, 'user', 'schema.sql')}` }, + }); + return c.json(result, 201); + }); + + /** DELETE /datasources/:name:删除数据源并关闭它的连接池,primary 不能删除。 */ + app.delete('/:name', async (c) => c.json(await dd.removeDatasource(c.req.param('name')))); + + return app; +} diff --git a/polyglot/typescript-hono-sample/src/routes/orders.ts b/polyglot/typescript-hono-sample/src/routes/orders.ts new file mode 100644 index 00000000..150e5370 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/routes/orders.ts @@ -0,0 +1,113 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** /orders:多数据源本地事务,对应 tx-local-sample 的 OrderController 与 OrderService。 */ +import { Hono } from 'hono'; +import { firstRow, type DynamicDataSource } from '../dynamic-datasource.ts'; +import { ApiError } from '../errors.ts'; +import { reduceBalance } from './accounts.ts'; +import { reduceStock } from './products.ts'; + +interface PlaceOrder { + user_id: number; + product_id: number; + amount: number; +} + +export function orders(dd: DynamicDataSource): Hono { + const app = new Hono(); + + /** + * POST /orders:与 OrderService#placeOrder 逐行对应, + * 一个会话式事务跨 order、product、account 三个库,任何一步失败都整体回滚。 + */ + app.post('/', async (c) => { + const order = checkAmount(await c.req.json()); + const placed = await dd.transactional(async (tx) => { + const inserted = await tx.execute({ + ds: 'order', + sql: "insert into p_order (user_id, product_id, amount, status) values (?, ?, ?, 'INIT')", + params: [order.user_id, order.product_id, order.amount], + generatedKeys: ['id'], + }); + const orderId = inserted.generatedKeys![0].id; + const totalPrice = await reduceStock(tx, order.product_id, order.amount); + await reduceBalance(tx, order.user_id, totalPrice); + await tx.execute({ + ds: 'order', + sql: "update p_order set status = 'SUCCESS', total_price = ? where id = ?", + params: [totalPrice, orderId], + }); + return { ...order, id: orderId, total_price: totalPrice, status: 'SUCCESS' }; + }); + return c.json(placed, 201); + }); + + /** + * POST /orders/batch:先在事务外读单价,再把三条写语句一次交给 dd_transaction。 + * 库存、余额不足由 CHECK 约束兜底;单价在下单期间被改过则 expectUpdateCount 不满足,同样整体回滚。 + */ + app.post('/batch', async (c) => { + const order = checkAmount(await c.req.json()); + const product = firstRow( + await dd.execute({ ds: 'product', sql: 'select price from product where id = ?', params: [order.product_id] }), + ); + if (!product) { + throw new ApiError(404, 'PRODUCT_NOT_FOUND', '商品不存在'); + } + const price = product.price as number; + const totalPrice = price * order.amount; + const result = await dd.transaction([ + { + ds: 'order', + sql: "insert into p_order (user_id, product_id, amount, total_price, status) values (?, ?, ?, ?, 'SUCCESS')", + params: [order.user_id, order.product_id, order.amount, totalPrice], + generatedKeys: ['id'], + }, + { + ds: 'product', + sql: 'update product set stock = stock - ? where id = ? and price = ?', + params: [order.amount, order.product_id, price], + expectUpdateCount: 1, + }, + { + ds: 'account', + sql: 'update account set balance = balance - ? where id = ?', + params: [totalPrice, order.user_id], + expectUpdateCount: 1, + }, + ]); + const orderId = result.results[0].generatedKeys![0].id; + return c.json({ ...order, id: orderId, total_price: totalPrice, status: 'SUCCESS' }, 201); + }); + + /** GET /orders */ + app.get('/', async (c) => { + const result = await dd.execute({ + ds: 'order', + sql: 'select id, user_id, product_id, amount, total_price, status from p_order order by id', + }); + return c.json(result.rows); + }); + + return app; +} + +function checkAmount(order: PlaceOrder): PlaceOrder { + if (!(order.amount > 0)) { + throw new ApiError(400, 'BAD_REQUEST', 'amount 必须大于 0'); + } + return order; +} diff --git a/polyglot/typescript-hono-sample/src/routes/products.ts b/polyglot/typescript-hono-sample/src/routes/products.ts new file mode 100644 index 00000000..afb41c57 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/routes/products.ts @@ -0,0 +1,63 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** /products,以及下单时扣减库存,对应 tx-local-sample 的 ProductService。 */ +import { Hono } from 'hono'; +import { firstRow, type DynamicDataSource, type Transaction } from '../dynamic-datasource.ts'; +import { ApiError } from '../errors.ts'; + +export function products(dd: DynamicDataSource): Hono { + const app = new Hono(); + + /** GET /products/:id */ + app.get('/:id', async (c) => { + const product = firstRow( + await dd.execute({ + ds: 'product', + sql: 'select id, price, stock from product where id = ?', + params: [Number(c.req.param('id'))], + }), + ); + if (!product) { + throw new ApiError(404, 'PRODUCT_NOT_FOUND', '商品不存在'); + } + return c.json(product); + }); + + return app; +} + +/** 对应 ProductService#reduceStock:检查并扣减库存,返回总价。 */ +export async function reduceStock(tx: Transaction, productId: number, amount: number): Promise { + const product = firstRow( + await tx.execute({ + ds: 'product', + sql: 'select price, stock from product where id = ? for update', + params: [productId], + }), + ); + if (!product) { + throw new ApiError(404, 'PRODUCT_NOT_FOUND', '商品不存在'); + } + if ((product.stock as number) < amount) { + throw new ApiError(409, 'INSUFFICIENT_STOCK', '库存不足'); + } + await tx.execute({ + ds: 'product', + sql: 'update product set stock = stock - ? where id = ?', + params: [amount, productId], + }); + return (product.price as number) * amount; +} diff --git a/polyglot/typescript-hono-sample/src/routes/users.ts b/polyglot/typescript-hono-sample/src/routes/users.ts new file mode 100644 index 00000000..41d432e3 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/routes/users.ts @@ -0,0 +1,51 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** /users:读写分离与按请求头切换数据源,对应 jdbc-template-sample 与 spel-sample。 */ +import { Hono } from 'hono'; +import type { DynamicDataSource } from '../dynamic-datasource.ts'; + +export function users(dd: DynamicDataSource): Hono { + const app = new Hono(); + + /** + * GET /users:默认读 slave 组(相当于 @DS("slave")),请求头 X-Datasource 相当于 spel-sample 的 + * @DS("#header.xxx");响应头回显实际命中的成员。 + */ + app.get('/', async (c) => { + const result = await dd.execute({ + ds: c.req.header('x-datasource') ?? 'slave', + sql: 'select id, name, age from t_user order by id', + }); + c.header('X-Datasource-Served', result.datasource); + return c.json(result.rows); + }); + + /** POST /users:不指定数据源时写 primary,也就是 master。 */ + app.post('/', async (c) => { + const user = await c.req.json<{ name: string; age?: number }>(); + const result = await dd.execute({ + sql: 'insert into t_user (name, age) values (?, ?)', + params: [user.name, user.age ?? null], + generatedKeys: ['id'], + }); + return c.json( + { id: result.generatedKeys![0].id, name: user.name, age: user.age ?? null, datasource: result.datasource }, + 201, + ); + }); + + return app; +} diff --git a/polyglot/typescript-hono-sample/src/server.ts b/polyglot/typescript-hono-sample/src/server.ts new file mode 100644 index 00000000..7d40869b --- /dev/null +++ b/polyglot/typescript-hono-sample/src/server.ts @@ -0,0 +1,31 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { serve } from '@hono/node-server'; +import { createApp } from './app.ts'; +import { DB_DIR, LIBRARY, loadConfig } from './config.ts'; +import { DynamicDataSource } from './dynamic-datasource.ts'; + +const dd = await DynamicDataSource.open(loadConfig(), { library: LIBRARY }); +console.log('dynamic-datasource is open:', JSON.stringify(await dd.listDatasources())); + +const port = Number(process.env.PORT ?? 8083); +const server = serve({ fetch: createApp(dd, DB_DIR).fetch, hostname: '0.0.0.0', port }, (info) => + console.log(`typescript-hono-sample listening on ${info.address}:${info.port}`), +); + +for (const signal of ['SIGINT', 'SIGTERM'] as const) { + process.once(signal, () => server.close(() => void dd.close())); +} diff --git a/polyglot/typescript-hono-sample/src/worker.ts b/polyglot/typescript-hono-sample/src/worker.ts new file mode 100644 index 00000000..e5d9f089 --- /dev/null +++ b/polyglot/typescript-hono-sample/src/worker.ts @@ -0,0 +1,45 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * worker 线程:每个 worker 独占一个 OS 线程,启动时 attach 到 isolate 一次, + * 之后在本线程里同步调用 libdynamicds,把结果发回主线程。 + */ +import { parentPort, workerData } from 'node:worker_threads'; +import { load, type Operation } from './native.ts'; + +export interface WorkerData { + library: string; + isolate: bigint; +} + +export interface WorkerRequest { + operation: Operation; + request: string; +} + +const { library, isolate } = workerData as WorkerData; +const native = load(library); +const thread = native.attach(isolate); +const port = parentPort!; + +port.on('message', (message: WorkerRequest | 'close') => { + if (message === 'close') { + native.detach(thread); + port.close(); + return; + } + port.postMessage(native.call(thread, message.operation, message.request)); +}); diff --git a/polyglot/typescript-hono-sample/test/api.test.ts b/polyglot/typescript-hono-sample/test/api.test.ts new file mode 100644 index 00000000..4fe4276a --- /dev/null +++ b/polyglot/typescript-hono-sample/test/api.test.ts @@ -0,0 +1,170 @@ +/* + * Copyright © ${project.inceptionYear} organization baomidou + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 与 rust-axum-sample、python-fastapi-sample 相同的一组场景,分别跑在 H2 与 Testcontainers 启动的 PostgreSQL 上。 + * + * isolate 与 dd_open 都是进程级单例;同一文件里的测试按顺序执行,依次打开、关闭各自的 DynamicRoutingDataSource。 + */ +import assert from 'node:assert/strict'; +import { join } from 'node:path'; +import { test } from 'node:test'; +import { PostgreSqlContainer } from '@testcontainers/postgresql'; +import { createApp } from '../src/app.ts'; +import { DB_DIR, LIBRARY, loadConfig, SAMPLE_DIR } from '../src/config.ts'; +import { DynamicDataSource } from '../src/dynamic-datasource.ts'; + +test('h2', async () => { + await runScenarios(loadConfig('h2'), { + name: 'slave_3', + url: 'jdbc:h2:mem:ds_slave_3;DB_CLOSE_DELAY=-1', + username: 'sa', + password: '', + driver_class_name: 'org.h2.Driver', + }); +}); + +test('postgresql', async () => { + // 与 compose.yaml 一样,initdb 阶段执行 init-databases.sql,为每个数据源建一个数据库 + const postgres = await new PostgreSqlContainer('postgres:18.6-trixie') + .withUsername('postgres') + .withPassword('postgres') + .withCopyFilesToContainer([ + { + source: join(SAMPLE_DIR, 'db', 'postgresql', 'init-databases.sql'), + target: '/docker-entrypoint-initdb.d/init-databases.sql', + }, + ]) + .start(); + try { + const host = postgres.getHost(); + const port = String(postgres.getPort()); + const variables = { + POSTGRES_HOST: host, + POSTGRES_PORT: port, + POSTGRES_USER: 'postgres', + POSTGRES_PASSWORD: 'postgres', + }; + await runScenarios(loadConfig('postgresql', variables), { + name: 'slave_3', + url: `jdbc:postgresql://${host}:${port}/ds_slave_3`, + username: 'postgres', + password: 'postgres', + driver_class_name: 'org.postgresql.Driver', + }); + } finally { + await postgres.stop(); + } +}); + +const order = (productId: number, amount: number) => ({ user_id: 1, product_id: productId, amount }); + +/** 动态添加的 slave_3 由调用方给出,因为它的连接信息随数据库不同。 */ +async function runScenarios(config: Record, slave3: Record): Promise { + const dd = await DynamicDataSource.open(config, { library: LIBRARY }); + const app = createApp(dd, DB_DIR); + const get = (path: string, datasource?: string) => + app.request(path, { headers: datasource ? { 'X-Datasource': datasource } : {} }); + const send = (method: string, path: string, body?: unknown) => + app.request(path, { + method, + body: body === undefined ? undefined : JSON.stringify(body), + headers: { 'Content-Type': 'application/json' }, + }); + const names = async (response: Response) => ((await response.json()) as { name: string }[]).map((u) => u.name); + const assertOrderState = async (orders: number, stock: number, balance: number) => { + assert.equal(((await (await get('/orders')).json()) as unknown[]).length, orders); + assert.equal(((await (await get('/products/1')).json()) as { stock: number }).stock, stock); + assert.equal(((await (await get('/accounts/1')).json()) as { balance: number }).balance, balance); + }; + + try { + // 读请求默认走 slave 组,两次请求轮询到两个成员 + const served = new Set(); + for (let i = 0; i < 2; i++) { + const response = await get('/users'); + assert.equal(response.status, 200); + const datasource = response.headers.get('X-Datasource-Served')!; + assert.equal(((await response.json()) as { name: string }[])[0].name, `${datasource}-张三`); + served.add(datasource); + } + assert.deepEqual([...served].sort(), ['slave_1', 'slave_2']); + + // 请求头指定数据源;strict 模式下未知数据源直接报错 + let response = await get('/users', 'master'); + assert.equal(response.headers.get('X-Datasource-Served'), 'master'); + assert.equal((await names(response))[0], 'master-张三'); + response = await get('/users', 'nope'); + assert.equal(response.status, 404); + assert.equal(((await response.json()) as { code: string }).code, 'DATASOURCE_NOT_FOUND'); + + // 写请求走 primary + response = await send('POST', '/users', { name: '李四', age: 20 }); + assert.equal(response.status, 201); + const created = (await response.json()) as { id: unknown; datasource: string }; + assert.equal(created.datasource, 'master'); + assert.equal(typeof created.id, 'number'); + assert.ok((await names(await get('/users', 'master'))).includes('李四')); + assert.ok(!(await names(await get('/users', 'slave_1'))).includes('李四')); + + // 运行时增删数据源,slave_3 自动进入 slave 组 + response = await send('POST', '/datasources', slave3); + assert.equal(response.status, 201, await response.clone().text()); + assert.deepEqual(((await response.json()) as { groups: { slave: string[] } }).groups.slave, [ + 'slave_1', + 'slave_2', + 'slave_3', + ]); + const servedAfterAdd = new Set(); + for (let i = 0; i < 3; i++) { + servedAfterAdd.add((await get('/users')).headers.get('X-Datasource-Served')!); + } + assert.equal(servedAfterAdd.size, 3); + response = await send('DELETE', '/datasources/slave_3'); + assert.equal(response.status, 200); + assert.deepEqual(((await response.json()) as { groups: { slave: string[] } }).groups.slave, ['slave_1', 'slave_2']); + assert.equal((await send('DELETE', '/datasources/master')).status, 400); + + // 会话式事务下单:与 tx-local-sample 相同的流程,失败时三个库一起回滚 + response = await send('POST', '/orders', order(1, 1)); + assert.equal(response.status, 201, await response.clone().text()); + assert.equal(((await response.json()) as { total_price: number }).total_price, 10); + await assertOrderState(1, 19, 40); + response = await send('POST', '/orders', order(1, 6)); + assert.equal(response.status, 409); + assert.equal(((await response.json()) as { code: string }).code, 'INSUFFICIENT_BALANCE'); + response = await send('POST', '/orders', order(1, 30)); + assert.equal(((await response.json()) as { code: string }).code, 'INSUFFICIENT_STOCK'); + assert.equal((await send('POST', '/orders', order(999, 1))).status, 404); + await assertOrderState(1, 19, 40); + + // 批量事务下单:一次 dd_transaction,CHECK 约束兜底 + response = await send('POST', '/orders/batch', order(1, 1)); + assert.equal(response.status, 201, await response.clone().text()); + await assertOrderState(2, 18, 30); + response = await send('POST', '/orders/batch', order(1, 6)); + assert.equal(response.status, 409); + assert.equal(((await response.json()) as { code: string }).code, 'INSUFFICIENT_BALANCE'); + response = await send('POST', '/orders/batch', order(1, 30)); + assert.equal(((await response.json()) as { code: string }).code, 'INSUFFICIENT_STOCK'); + await assertOrderState(2, 18, 30); + + // 并发请求分给 worker 池里的多个线程,各自 attach 到 isolate + const statuses = await Promise.all(Array.from({ length: 20 }, async () => (await get('/users')).status)); + assert.deepEqual(statuses, Array(20).fill(200)); + } finally { + await dd.close(); + } +} diff --git a/polyglot/typescript-hono-sample/tsconfig.json b/polyglot/typescript-hono-sample/tsconfig.json new file mode 100644 index 00000000..9f053d30 --- /dev/null +++ b/polyglot/typescript-hono-sample/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "nodenext", + "moduleResolution": "nodenext", + "types": ["node"], + "strict": true, + "noEmit": true, + "allowImportingTsExtensions": true, + "erasableSyntaxOnly": true, + "verbatimModuleSyntax": true, + "skipLibCheck": true + }, + "include": ["src", "test", "scripts"] +} diff --git a/pom.xml b/pom.xml index 99a466ec..58796d3d 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,18 @@ src/main/java/** src/test/java/** + + .devcontainer/** + config/license/** + + true + + ${maven.multiModuleProjectDirectory}/config/license/header-styles.xml + + + DOCKERFILE_STYLE + @@ -131,4 +142,18 @@ + + + + + polyglot + + [25,) + + + polyglot + + +