@inluxc/propmaster 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +696 -2
- package/dist/src/annotations/index.d.ts +11 -0
- package/dist/src/annotations/index.d.ts.map +1 -0
- package/dist/src/annotations/index.js +11 -0
- package/dist/src/annotations/index.js.map +1 -0
- package/dist/src/annotations/recorder.d.ts +57 -0
- package/dist/src/annotations/recorder.d.ts.map +1 -0
- package/dist/src/annotations/recorder.js +100 -0
- package/dist/src/annotations/recorder.js.map +1 -0
- package/dist/src/annotations/truncation.d.ts +34 -0
- package/dist/src/annotations/truncation.d.ts.map +1 -0
- package/dist/src/annotations/truncation.js +54 -0
- package/dist/src/annotations/truncation.js.map +1 -0
- package/dist/src/auth/apply.d.ts +15 -0
- package/dist/src/auth/apply.d.ts.map +1 -0
- package/dist/src/auth/apply.js +21 -0
- package/dist/src/auth/apply.js.map +1 -0
- package/dist/src/auth/setup.d.ts +56 -0
- package/dist/src/auth/setup.d.ts.map +1 -0
- package/dist/src/auth/setup.js +79 -0
- package/dist/src/auth/setup.js.map +1 -0
- package/dist/src/auth/state-file.d.ts +8 -0
- package/dist/src/auth/state-file.d.ts.map +1 -0
- package/dist/src/auth/state-file.js +13 -0
- package/dist/src/auth/state-file.js.map +1 -0
- package/dist/src/auth/token-manager.d.ts +61 -0
- package/dist/src/auth/token-manager.d.ts.map +1 -0
- package/dist/src/auth/token-manager.js +200 -0
- package/dist/src/auth/token-manager.js.map +1 -0
- package/dist/src/cli/banner.d.ts +23 -0
- package/dist/src/cli/banner.d.ts.map +1 -0
- package/dist/src/cli/banner.js +67 -0
- package/dist/src/cli/banner.js.map +1 -0
- package/dist/src/cli/check-tests.d.ts +143 -0
- package/dist/src/cli/check-tests.d.ts.map +1 -0
- package/dist/src/cli/check-tests.js +541 -0
- package/dist/src/cli/check-tests.js.map +1 -0
- package/dist/src/cli/coverage.d.ts +14 -0
- package/dist/src/cli/coverage.d.ts.map +1 -0
- package/dist/src/cli/coverage.js +97 -0
- package/dist/src/cli/coverage.js.map +1 -0
- package/dist/src/cli/doctor.d.ts +82 -0
- package/dist/src/cli/doctor.d.ts.map +1 -0
- package/dist/src/cli/doctor.js +656 -0
- package/dist/src/cli/doctor.js.map +1 -0
- package/dist/src/cli/env.d.ts +76 -0
- package/dist/src/cli/env.d.ts.map +1 -0
- package/dist/src/cli/env.js +344 -0
- package/dist/src/cli/env.js.map +1 -0
- package/dist/src/cli/failures.d.ts +29 -0
- package/dist/src/cli/failures.d.ts.map +1 -0
- package/dist/src/cli/failures.js +114 -0
- package/dist/src/cli/failures.js.map +1 -0
- package/dist/src/cli/fixture-catalog.d.ts +83 -0
- package/dist/src/cli/fixture-catalog.d.ts.map +1 -0
- package/dist/src/cli/fixture-catalog.js +773 -0
- package/dist/src/cli/fixture-catalog.js.map +1 -0
- package/dist/src/cli/fixture.d.ts +149 -0
- package/dist/src/cli/fixture.d.ts.map +1 -0
- package/dist/src/cli/fixture.js +742 -0
- package/dist/src/cli/fixture.js.map +1 -0
- package/dist/src/cli/flaky.d.ts +25 -0
- package/dist/src/cli/flaky.d.ts.map +1 -0
- package/dist/src/cli/flaky.js +96 -0
- package/dist/src/cli/flaky.js.map +1 -0
- package/dist/src/cli/generate.d.ts +37 -0
- package/dist/src/cli/generate.d.ts.map +1 -0
- package/dist/src/cli/generate.js +230 -0
- package/dist/src/cli/generate.js.map +1 -0
- package/dist/src/cli/init.d.ts +36 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +1039 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/json-edit.d.ts +58 -0
- package/dist/src/cli/json-edit.d.ts.map +1 -0
- package/dist/src/cli/json-edit.js +250 -0
- package/dist/src/cli/json-edit.js.map +1 -0
- package/dist/src/cli/layout.d.ts +31 -0
- package/dist/src/cli/layout.d.ts.map +1 -0
- package/dist/src/cli/layout.js +175 -0
- package/dist/src/cli/layout.js.map +1 -0
- package/dist/src/cli/mcp-setup.d.ts +141 -0
- package/dist/src/cli/mcp-setup.d.ts.map +1 -0
- package/dist/src/cli/mcp-setup.js +548 -0
- package/dist/src/cli/mcp-setup.js.map +1 -0
- package/dist/src/cli/organize.d.ts +136 -0
- package/dist/src/cli/organize.d.ts.map +1 -0
- package/dist/src/cli/organize.js +467 -0
- package/dist/src/cli/organize.js.map +1 -0
- package/dist/src/cli/prompts.d.ts +102 -0
- package/dist/src/cli/prompts.d.ts.map +1 -0
- package/dist/src/cli/prompts.js +346 -0
- package/dist/src/cli/prompts.js.map +1 -0
- package/dist/src/cli/standards.d.ts +160 -0
- package/dist/src/cli/standards.d.ts.map +1 -0
- package/dist/src/cli/standards.js +389 -0
- package/dist/src/cli/standards.js.map +1 -0
- package/dist/src/cli/style.d.ts +28 -0
- package/dist/src/cli/style.d.ts.map +1 -0
- package/dist/src/cli/style.js +57 -0
- package/dist/src/cli/style.js.map +1 -0
- package/dist/src/config/env-loader.d.ts +33 -0
- package/dist/src/config/env-loader.d.ts.map +1 -0
- package/dist/src/config/env-loader.js +72 -0
- package/dist/src/config/env-loader.js.map +1 -0
- package/dist/src/config/index.d.ts +10 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +10 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/loader.d.ts +66 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +810 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +596 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +9 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/containers/container-manager.d.ts +157 -0
- package/dist/src/containers/container-manager.d.ts.map +1 -0
- package/dist/src/containers/container-manager.js +627 -0
- package/dist/src/containers/container-manager.js.map +1 -0
- package/dist/src/coverage/code-coverage.d.ts +89 -0
- package/dist/src/coverage/code-coverage.d.ts.map +1 -0
- package/dist/src/coverage/code-coverage.js +395 -0
- package/dist/src/coverage/code-coverage.js.map +1 -0
- package/dist/src/coverage/inventory.d.ts +80 -0
- package/dist/src/coverage/inventory.d.ts.map +1 -0
- package/dist/src/coverage/inventory.js +417 -0
- package/dist/src/coverage/inventory.js.map +1 -0
- package/dist/src/coverage/languages.d.ts +34 -0
- package/dist/src/coverage/languages.d.ts.map +1 -0
- package/dist/src/coverage/languages.js +156 -0
- package/dist/src/coverage/languages.js.map +1 -0
- package/dist/src/coverage/report.d.ts +128 -0
- package/dist/src/coverage/report.d.ts.map +1 -0
- package/dist/src/coverage/report.js +472 -0
- package/dist/src/coverage/report.js.map +1 -0
- package/dist/src/errors.d.ts +164 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +267 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/fixtures/amqp.fixture.d.ts +163 -0
- package/dist/src/fixtures/amqp.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/amqp.fixture.js +494 -0
- package/dist/src/fixtures/amqp.fixture.js.map +1 -0
- package/dist/src/fixtures/appium.fixture.d.ts +112 -0
- package/dist/src/fixtures/appium.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/appium.fixture.js +309 -0
- package/dist/src/fixtures/appium.fixture.js.map +1 -0
- package/dist/src/fixtures/aws.d.ts +44 -0
- package/dist/src/fixtures/aws.d.ts.map +1 -0
- package/dist/src/fixtures/aws.js +93 -0
- package/dist/src/fixtures/aws.js.map +1 -0
- package/dist/src/fixtures/cassandra.fixture.d.ts +179 -0
- package/dist/src/fixtures/cassandra.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/cassandra.fixture.js +489 -0
- package/dist/src/fixtures/cassandra.fixture.js.map +1 -0
- package/dist/src/fixtures/clickhouse.fixture.d.ts +171 -0
- package/dist/src/fixtures/clickhouse.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/clickhouse.fixture.js +514 -0
- package/dist/src/fixtures/clickhouse.fixture.js.map +1 -0
- package/dist/src/fixtures/database.fixture.d.ts +63 -0
- package/dist/src/fixtures/database.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/database.fixture.js +407 -0
- package/dist/src/fixtures/database.fixture.js.map +1 -0
- package/dist/src/fixtures/dynamodb.fixture.d.ts +243 -0
- package/dist/src/fixtures/dynamodb.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/dynamodb.fixture.js +580 -0
- package/dist/src/fixtures/dynamodb.fixture.js.map +1 -0
- package/dist/src/fixtures/graphql.fixture.d.ts +107 -0
- package/dist/src/fixtures/graphql.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/graphql.fixture.js +158 -0
- package/dist/src/fixtures/graphql.fixture.js.map +1 -0
- package/dist/src/fixtures/grpc.fixture.d.ts +167 -0
- package/dist/src/fixtures/grpc.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/grpc.fixture.js +635 -0
- package/dist/src/fixtures/grpc.fixture.js.map +1 -0
- package/dist/src/fixtures/inbox.fixture.d.ts +136 -0
- package/dist/src/fixtures/inbox.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/inbox.fixture.js +239 -0
- package/dist/src/fixtures/inbox.fixture.js.map +1 -0
- package/dist/src/fixtures/index.d.ts +174 -0
- package/dist/src/fixtures/index.d.ts.map +1 -0
- package/dist/src/fixtures/index.js +370 -0
- package/dist/src/fixtures/index.js.map +1 -0
- package/dist/src/fixtures/kafka-driver.d.ts +108 -0
- package/dist/src/fixtures/kafka-driver.d.ts.map +1 -0
- package/dist/src/fixtures/kafka-driver.js +113 -0
- package/dist/src/fixtures/kafka-driver.js.map +1 -0
- package/dist/src/fixtures/kafka.fixture.d.ts +75 -0
- package/dist/src/fixtures/kafka.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/kafka.fixture.js +188 -0
- package/dist/src/fixtures/kafka.fixture.js.map +1 -0
- package/dist/src/fixtures/mock-server.fixture.d.ts +142 -0
- package/dist/src/fixtures/mock-server.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/mock-server.fixture.js +271 -0
- package/dist/src/fixtures/mock-server.fixture.js.map +1 -0
- package/dist/src/fixtures/mongodb.fixture.d.ts +121 -0
- package/dist/src/fixtures/mongodb.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/mongodb.fixture.js +258 -0
- package/dist/src/fixtures/mongodb.fixture.js.map +1 -0
- package/dist/src/fixtures/neo4j.fixture.d.ts +72 -0
- package/dist/src/fixtures/neo4j.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/neo4j.fixture.js +202 -0
- package/dist/src/fixtures/neo4j.fixture.js.map +1 -0
- package/dist/src/fixtures/openapi.fixture.d.ts +101 -0
- package/dist/src/fixtures/openapi.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/openapi.fixture.js +266 -0
- package/dist/src/fixtures/openapi.fixture.js.map +1 -0
- package/dist/src/fixtures/optional-package.d.ts +54 -0
- package/dist/src/fixtures/optional-package.d.ts.map +1 -0
- package/dist/src/fixtures/optional-package.js +79 -0
- package/dist/src/fixtures/optional-package.js.map +1 -0
- package/dist/src/fixtures/otp.fixture.d.ts +60 -0
- package/dist/src/fixtures/otp.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/otp.fixture.js +101 -0
- package/dist/src/fixtures/otp.fixture.js.map +1 -0
- package/dist/src/fixtures/realtime.fixture.d.ts +205 -0
- package/dist/src/fixtures/realtime.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/realtime.fixture.js +606 -0
- package/dist/src/fixtures/realtime.fixture.js.map +1 -0
- package/dist/src/fixtures/redis.fixture.d.ts +55 -0
- package/dist/src/fixtures/redis.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/redis.fixture.js +209 -0
- package/dist/src/fixtures/redis.fixture.js.map +1 -0
- package/dist/src/fixtures/s3.fixture.d.ts +126 -0
- package/dist/src/fixtures/s3.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/s3.fixture.js +296 -0
- package/dist/src/fixtures/s3.fixture.js.map +1 -0
- package/dist/src/fixtures/search.fixture.d.ts +178 -0
- package/dist/src/fixtures/search.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/search.fixture.js +472 -0
- package/dist/src/fixtures/search.fixture.js.map +1 -0
- package/dist/src/fixtures/sqs.fixture.d.ts +172 -0
- package/dist/src/fixtures/sqs.fixture.d.ts.map +1 -0
- package/dist/src/fixtures/sqs.fixture.js +428 -0
- package/dist/src/fixtures/sqs.fixture.js.map +1 -0
- package/dist/src/index.d.ts +43 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +48 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/guards.d.ts +21 -0
- package/dist/src/mcp/guards.d.ts.map +1 -0
- package/dist/src/mcp/guards.js +118 -0
- package/dist/src/mcp/guards.js.map +1 -0
- package/dist/src/mcp/project-tools.d.ts +14 -0
- package/dist/src/mcp/project-tools.d.ts.map +1 -0
- package/dist/src/mcp/project-tools.js +252 -0
- package/dist/src/mcp/project-tools.js.map +1 -0
- package/dist/src/mcp/protocol.d.ts +116 -0
- package/dist/src/mcp/protocol.d.ts.map +1 -0
- package/dist/src/mcp/protocol.js +199 -0
- package/dist/src/mcp/protocol.js.map +1 -0
- package/dist/src/mcp/server.d.ts +43 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +244 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/test-tools.d.ts +65 -0
- package/dist/src/mcp/test-tools.d.ts.map +1 -0
- package/dist/src/mcp/test-tools.js +380 -0
- package/dist/src/mcp/test-tools.js.map +1 -0
- package/dist/src/mcp/tools.d.ts +49 -0
- package/dist/src/mcp/tools.d.ts.map +1 -0
- package/dist/src/mcp/tools.js +726 -0
- package/dist/src/mcp/tools.js.map +1 -0
- package/dist/src/network-error.d.ts +11 -0
- package/dist/src/network-error.d.ts.map +1 -0
- package/dist/src/network-error.js +34 -0
- package/dist/src/network-error.js.map +1 -0
- package/dist/src/openapi/contract.d.ts +98 -0
- package/dist/src/openapi/contract.d.ts.map +1 -0
- package/dist/src/openapi/contract.js +407 -0
- package/dist/src/openapi/contract.js.map +1 -0
- package/dist/src/openapi/generate.d.ts +89 -0
- package/dist/src/openapi/generate.d.ts.map +1 -0
- package/dist/src/openapi/generate.js +607 -0
- package/dist/src/openapi/generate.js.map +1 -0
- package/dist/src/openapi/load.d.ts +8 -0
- package/dist/src/openapi/load.d.ts.map +1 -0
- package/dist/src/openapi/load.js +26 -0
- package/dist/src/openapi/load.js.map +1 -0
- package/dist/src/package-manager.d.ts +58 -0
- package/dist/src/package-manager.d.ts.map +1 -0
- package/dist/src/package-manager.js +137 -0
- package/dist/src/package-manager.js.map +1 -0
- package/dist/src/reporter/history.d.ts +85 -0
- package/dist/src/reporter/history.d.ts.map +1 -0
- package/dist/src/reporter/history.js +147 -0
- package/dist/src/reporter/history.js.map +1 -0
- package/dist/src/reporter/index.d.ts +59 -0
- package/dist/src/reporter/index.d.ts.map +1 -0
- package/dist/src/reporter/index.js +201 -0
- package/dist/src/reporter/index.js.map +1 -0
- package/dist/src/reporter/last-run.d.ts +88 -0
- package/dist/src/reporter/last-run.d.ts.map +1 -0
- package/dist/src/reporter/last-run.js +133 -0
- package/dist/src/reporter/last-run.js.map +1 -0
- package/dist/src/reporter/quarantine.d.ts +62 -0
- package/dist/src/reporter/quarantine.d.ts.map +1 -0
- package/dist/src/reporter/quarantine.js +148 -0
- package/dist/src/reporter/quarantine.js.map +1 -0
- package/dist/src/secrets/index.d.ts +4 -0
- package/dist/src/secrets/index.d.ts.map +1 -0
- package/dist/src/secrets/index.js +3 -0
- package/dist/src/secrets/index.js.map +1 -0
- package/dist/src/secrets/provider.interface.d.ts +30 -0
- package/dist/src/secrets/provider.interface.d.ts.map +1 -0
- package/dist/src/secrets/provider.interface.js +2 -0
- package/dist/src/secrets/provider.interface.js.map +1 -0
- package/dist/src/secrets/providers/aws.provider.d.ts +33 -0
- package/dist/src/secrets/providers/aws.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/aws.provider.js +88 -0
- package/dist/src/secrets/providers/aws.provider.js.map +1 -0
- package/dist/src/secrets/providers/azure.provider.d.ts +26 -0
- package/dist/src/secrets/providers/azure.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/azure.provider.js +71 -0
- package/dist/src/secrets/providers/azure.provider.js.map +1 -0
- package/dist/src/secrets/providers/env-file.provider.d.ts +29 -0
- package/dist/src/secrets/providers/env-file.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/env-file.provider.js +56 -0
- package/dist/src/secrets/providers/env-file.provider.js.map +1 -0
- package/dist/src/secrets/providers/gitlab.provider.d.ts +26 -0
- package/dist/src/secrets/providers/gitlab.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/gitlab.provider.js +67 -0
- package/dist/src/secrets/providers/gitlab.provider.js.map +1 -0
- package/dist/src/secrets/providers/index.d.ts +52 -0
- package/dist/src/secrets/providers/index.d.ts.map +1 -0
- package/dist/src/secrets/providers/index.js +81 -0
- package/dist/src/secrets/providers/index.js.map +1 -0
- package/dist/src/secrets/providers/openbao.provider.d.ts +28 -0
- package/dist/src/secrets/providers/openbao.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/openbao.provider.js +29 -0
- package/dist/src/secrets/providers/openbao.provider.js.map +1 -0
- package/dist/src/secrets/providers/vault-compatible.d.ts +140 -0
- package/dist/src/secrets/providers/vault-compatible.d.ts.map +1 -0
- package/dist/src/secrets/providers/vault-compatible.js +405 -0
- package/dist/src/secrets/providers/vault-compatible.js.map +1 -0
- package/dist/src/secrets/providers/vault.provider.d.ts +27 -0
- package/dist/src/secrets/providers/vault.provider.d.ts.map +1 -0
- package/dist/src/secrets/providers/vault.provider.js +23 -0
- package/dist/src/secrets/providers/vault.provider.js.map +1 -0
- package/dist/src/secrets/secrets-manager.d.ts +67 -0
- package/dist/src/secrets/secrets-manager.d.ts.map +1 -0
- package/dist/src/secrets/secrets-manager.js +255 -0
- package/dist/src/secrets/secrets-manager.js.map +1 -0
- package/dist/src/steps/amqp.steps.d.ts +37 -0
- package/dist/src/steps/amqp.steps.d.ts.map +1 -0
- package/dist/src/steps/amqp.steps.js +86 -0
- package/dist/src/steps/amqp.steps.js.map +1 -0
- package/dist/src/steps/appium.steps.d.ts +53 -0
- package/dist/src/steps/appium.steps.d.ts.map +1 -0
- package/dist/src/steps/appium.steps.js +109 -0
- package/dist/src/steps/appium.steps.js.map +1 -0
- package/dist/src/steps/aws.steps.d.ts +47 -0
- package/dist/src/steps/aws.steps.d.ts.map +1 -0
- package/dist/src/steps/aws.steps.js +116 -0
- package/dist/src/steps/aws.steps.js.map +1 -0
- package/dist/src/steps/browser.steps.d.ts +54 -0
- package/dist/src/steps/browser.steps.d.ts.map +1 -0
- package/dist/src/steps/browser.steps.js +102 -0
- package/dist/src/steps/browser.steps.js.map +1 -0
- package/dist/src/steps/cassandra.steps.d.ts +32 -0
- package/dist/src/steps/cassandra.steps.d.ts.map +1 -0
- package/dist/src/steps/cassandra.steps.js +81 -0
- package/dist/src/steps/cassandra.steps.js.map +1 -0
- package/dist/src/steps/clickhouse.steps.d.ts +30 -0
- package/dist/src/steps/clickhouse.steps.d.ts.map +1 -0
- package/dist/src/steps/clickhouse.steps.js +73 -0
- package/dist/src/steps/clickhouse.steps.js.map +1 -0
- package/dist/src/steps/database.steps.d.ts +43 -0
- package/dist/src/steps/database.steps.d.ts.map +1 -0
- package/dist/src/steps/database.steps.js +79 -0
- package/dist/src/steps/database.steps.js.map +1 -0
- package/dist/src/steps/dynamodb.steps.d.ts +32 -0
- package/dist/src/steps/dynamodb.steps.d.ts.map +1 -0
- package/dist/src/steps/dynamodb.steps.js +89 -0
- package/dist/src/steps/dynamodb.steps.js.map +1 -0
- package/dist/src/steps/graphql.steps.d.ts +60 -0
- package/dist/src/steps/graphql.steps.d.ts.map +1 -0
- package/dist/src/steps/graphql.steps.js +76 -0
- package/dist/src/steps/graphql.steps.js.map +1 -0
- package/dist/src/steps/grpc.steps.d.ts +29 -0
- package/dist/src/steps/grpc.steps.d.ts.map +1 -0
- package/dist/src/steps/grpc.steps.js +68 -0
- package/dist/src/steps/grpc.steps.js.map +1 -0
- package/dist/src/steps/inbox.steps.d.ts +30 -0
- package/dist/src/steps/inbox.steps.d.ts.map +1 -0
- package/dist/src/steps/inbox.steps.js +72 -0
- package/dist/src/steps/inbox.steps.js.map +1 -0
- package/dist/src/steps/index.d.ts +43 -0
- package/dist/src/steps/index.d.ts.map +1 -0
- package/dist/src/steps/index.js +26 -0
- package/dist/src/steps/index.js.map +1 -0
- package/dist/src/steps/kafka.steps.d.ts +56 -0
- package/dist/src/steps/kafka.steps.d.ts.map +1 -0
- package/dist/src/steps/kafka.steps.js +61 -0
- package/dist/src/steps/kafka.steps.js.map +1 -0
- package/dist/src/steps/mock-server.steps.d.ts +21 -0
- package/dist/src/steps/mock-server.steps.d.ts.map +1 -0
- package/dist/src/steps/mock-server.steps.js +45 -0
- package/dist/src/steps/mock-server.steps.js.map +1 -0
- package/dist/src/steps/mongodb.steps.d.ts +107 -0
- package/dist/src/steps/mongodb.steps.d.ts.map +1 -0
- package/dist/src/steps/mongodb.steps.js +117 -0
- package/dist/src/steps/mongodb.steps.js.map +1 -0
- package/dist/src/steps/openapi.steps.d.ts +49 -0
- package/dist/src/steps/openapi.steps.d.ts.map +1 -0
- package/dist/src/steps/openapi.steps.js +113 -0
- package/dist/src/steps/openapi.steps.js.map +1 -0
- package/dist/src/steps/otp.steps.d.ts +43 -0
- package/dist/src/steps/otp.steps.d.ts.map +1 -0
- package/dist/src/steps/otp.steps.js +83 -0
- package/dist/src/steps/otp.steps.js.map +1 -0
- package/dist/src/steps/realtime.steps.d.ts +40 -0
- package/dist/src/steps/realtime.steps.d.ts.map +1 -0
- package/dist/src/steps/realtime.steps.js +116 -0
- package/dist/src/steps/realtime.steps.js.map +1 -0
- package/dist/src/steps/redis.steps.d.ts +54 -0
- package/dist/src/steps/redis.steps.d.ts.map +1 -0
- package/dist/src/steps/redis.steps.js +89 -0
- package/dist/src/steps/redis.steps.js.map +1 -0
- package/dist/src/steps/search.steps.d.ts +23 -0
- package/dist/src/steps/search.steps.d.ts.map +1 -0
- package/dist/src/steps/search.steps.js +54 -0
- package/dist/src/steps/search.steps.js.map +1 -0
- package/dist/src/test-data/factory.d.ts +82 -0
- package/dist/src/test-data/factory.d.ts.map +1 -0
- package/dist/src/test-data/factory.js +116 -0
- package/dist/src/test-data/factory.js.map +1 -0
- package/dist/src/test-data/index.d.ts +4 -0
- package/dist/src/test-data/index.d.ts.map +1 -0
- package/dist/src/test-data/index.js +4 -0
- package/dist/src/test-data/index.js.map +1 -0
- package/dist/src/test-data/registry.d.ts +37 -0
- package/dist/src/test-data/registry.d.ts.map +1 -0
- package/dist/src/test-data/registry.js +51 -0
- package/dist/src/test-data/registry.js.map +1 -0
- package/dist/src/test-data/tracking.d.ts +47 -0
- package/dist/src/test-data/tracking.d.ts.map +1 -0
- package/dist/src/test-data/tracking.js +166 -0
- package/dist/src/test-data/tracking.js.map +1 -0
- package/environments.json +263 -0
- package/package.json +299 -5
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tools the Propmaster MCP server offers: read tools for every configured
|
|
3
|
+
* backend, the test-convention tools, and write tools when writes are allowed.
|
|
4
|
+
*
|
|
5
|
+
* Each backend connects on its first call and stays connected until the server
|
|
6
|
+
* stops. A backend that isn't configured answers with how to configure it.
|
|
7
|
+
*/
|
|
8
|
+
import { randomBytes } from 'node:crypto';
|
|
9
|
+
import { collect, nextIds } from '../cli/check-tests.js';
|
|
10
|
+
import { loadOptional } from '../fixtures/optional-package.js';
|
|
11
|
+
import { createDatabaseClient } from '../fixtures/database.fixture.js';
|
|
12
|
+
import { createRedisClient } from '../fixtures/redis.fixture.js';
|
|
13
|
+
import { createMongoDbClient } from '../fixtures/mongodb.fixture.js';
|
|
14
|
+
import { createNeo4jDriver, toPlain } from '../fixtures/neo4j.fixture.js';
|
|
15
|
+
import { createClickHouseClient } from '../fixtures/clickhouse.fixture.js';
|
|
16
|
+
import { createOtpClient } from '../fixtures/otp.fixture.js';
|
|
17
|
+
import { createKafka } from '../fixtures/kafka-driver.js';
|
|
18
|
+
import { loadOpenApiDocument } from '../openapi/load.js';
|
|
19
|
+
import { readOnlySqlProblem, writingPipelineStage } from './guards.js';
|
|
20
|
+
import { projectTools } from './project-tools.js';
|
|
21
|
+
import { testTools } from './test-tools.js';
|
|
22
|
+
import { ToolInputError } from './protocol.js';
|
|
23
|
+
const DEFAULT_ROWS = 100;
|
|
24
|
+
const MAX_ROWS = 1000;
|
|
25
|
+
const MAX_VALUE_CHARS = 10_000;
|
|
26
|
+
const KAFKA_PEEK_TIMEOUT_MS = 10_000;
|
|
27
|
+
/** Holds each backend's connection, opened on first use. */
|
|
28
|
+
export class Connections {
|
|
29
|
+
open = new Map();
|
|
30
|
+
closers = new Map();
|
|
31
|
+
get(name, connect) {
|
|
32
|
+
let pending = this.open.get(name);
|
|
33
|
+
if (!pending) {
|
|
34
|
+
pending = connect().then(({ value, close }) => {
|
|
35
|
+
this.closers.set(name, close);
|
|
36
|
+
return value;
|
|
37
|
+
});
|
|
38
|
+
// A failed connect is retried on the next call.
|
|
39
|
+
pending.catch(() => this.open.delete(name));
|
|
40
|
+
this.open.set(name, pending);
|
|
41
|
+
}
|
|
42
|
+
return pending;
|
|
43
|
+
}
|
|
44
|
+
async closeAll() {
|
|
45
|
+
const closers = [...this.closers.values()];
|
|
46
|
+
this.closers.clear();
|
|
47
|
+
this.open.clear();
|
|
48
|
+
await Promise.allSettled(closers.map((close) => close()));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// ─── Argument helpers ───────────────────────────────────────────────────────
|
|
52
|
+
function str(args, key) {
|
|
53
|
+
const value = args[key];
|
|
54
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
55
|
+
throw new ToolInputError(`"${key}" must be a non-empty string`);
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
function optStr(args, key) {
|
|
59
|
+
const value = args[key];
|
|
60
|
+
if (value === undefined || value === null)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (typeof value !== 'string')
|
|
63
|
+
throw new ToolInputError(`"${key}" must be a string`);
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
function count(args, key, fallback, max) {
|
|
67
|
+
const value = args[key];
|
|
68
|
+
if (value === undefined || value === null)
|
|
69
|
+
return fallback;
|
|
70
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 1)
|
|
71
|
+
throw new ToolInputError(`"${key}" must be a positive integer`);
|
|
72
|
+
return Math.min(value, max);
|
|
73
|
+
}
|
|
74
|
+
function obj(args, key) {
|
|
75
|
+
const value = args[key];
|
|
76
|
+
if (value === undefined || value === null)
|
|
77
|
+
return undefined;
|
|
78
|
+
if (typeof value !== 'object' || Array.isArray(value))
|
|
79
|
+
throw new ToolInputError(`"${key}" must be an object`);
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
function arr(args, key, required = false) {
|
|
83
|
+
const value = args[key];
|
|
84
|
+
if (value === undefined || value === null) {
|
|
85
|
+
if (required)
|
|
86
|
+
throw new ToolInputError(`"${key}" is required`);
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
if (!Array.isArray(value))
|
|
90
|
+
throw new ToolInputError(`"${key}" must be an array`);
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
function limitRows(rows, max) {
|
|
94
|
+
return rows.length > max ? { rowCount: rows.length, rows: rows.slice(0, max), truncated: true } : { rowCount: rows.length, rows };
|
|
95
|
+
}
|
|
96
|
+
function clip(value) {
|
|
97
|
+
return value.length > MAX_VALUE_CHARS ? `${value.slice(0, MAX_VALUE_CHARS)}… [${value.length - MAX_VALUE_CHARS} more characters]` : value;
|
|
98
|
+
}
|
|
99
|
+
/** Message bodies: JSON when they parse, else the (clipped) text. */
|
|
100
|
+
function decode(value) {
|
|
101
|
+
if (value === null || value === undefined)
|
|
102
|
+
return null;
|
|
103
|
+
try {
|
|
104
|
+
return JSON.parse(value);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return clip(value);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function notConfigured(backend, hint) {
|
|
111
|
+
throw new ToolInputError(`${backend} isn't configured for this environment. ${hint}`);
|
|
112
|
+
}
|
|
113
|
+
const PARAMS_SCHEMA = { type: 'array', description: 'Positional parameters for $1/? placeholders', items: {} };
|
|
114
|
+
const ROWS_SCHEMA = { type: 'integer', minimum: 1, maximum: MAX_ROWS, description: `Rows to return (default ${DEFAULT_ROWS})` };
|
|
115
|
+
// ─── Tools ──────────────────────────────────────────────────────────────────
|
|
116
|
+
export function createTools(ctx, connections) {
|
|
117
|
+
const config = ctx.config;
|
|
118
|
+
// ── Connections ──
|
|
119
|
+
const database = () => {
|
|
120
|
+
const db = config?.database;
|
|
121
|
+
if (!db)
|
|
122
|
+
notConfigured('The database', 'Add "database" to environments.json or set PW_DB_TYPE, PW_DB_HOST, ...');
|
|
123
|
+
return connections.get('database', async () => {
|
|
124
|
+
const conn = await createDatabaseClient(db);
|
|
125
|
+
return { value: conn, close: () => conn.close() };
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const redis = () => {
|
|
129
|
+
const rc = config?.redis;
|
|
130
|
+
if (!rc)
|
|
131
|
+
notConfigured('Redis', 'Add "redis" to environments.json or set PW_REDIS_HOST.');
|
|
132
|
+
return connections.get('redis', async () => {
|
|
133
|
+
const { client, subscriber } = await createRedisClient(rc);
|
|
134
|
+
subscriber?.disconnect();
|
|
135
|
+
return { value: { client, prefix: rc.keyPrefix ?? '' }, close: async () => { client.disconnect(); } };
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
const mongo = () => {
|
|
139
|
+
const mc = config?.mongodb;
|
|
140
|
+
if (!mc)
|
|
141
|
+
notConfigured('MongoDB', 'Add "mongodb" to environments.json or set PW_MONGODB_URI.');
|
|
142
|
+
return connections.get('mongodb', async () => {
|
|
143
|
+
const client = await createMongoDbClient(mc);
|
|
144
|
+
return { value: client, close: () => client.close() };
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const neo4j = () => {
|
|
148
|
+
const nc = config?.neo4j;
|
|
149
|
+
if (!nc)
|
|
150
|
+
notConfigured('Neo4j', 'Add "neo4j" to environments.json or set PW_NEO4J_URI.');
|
|
151
|
+
return connections.get('neo4j', async () => {
|
|
152
|
+
const driver = await createNeo4jDriver(nc);
|
|
153
|
+
return { value: driver, close: () => driver.close() };
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const clickhouse = () => {
|
|
157
|
+
const cc = config?.clickhouse;
|
|
158
|
+
if (!cc)
|
|
159
|
+
notConfigured('ClickHouse', 'Add "clickhouse" to environments.json or set PW_CLICKHOUSE_URL.');
|
|
160
|
+
return connections.get('clickhouse', async () => {
|
|
161
|
+
const client = await createClickHouseClient({ ...cc, createDatabase: false });
|
|
162
|
+
return { value: client, close: () => client.close() };
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const kafka = () => {
|
|
166
|
+
const kc = config?.kafka;
|
|
167
|
+
if (!kc || kc.brokers.length === 0)
|
|
168
|
+
notConfigured('Kafka', 'Add "kafka" to environments.json or set PW_KAFKA_BROKERS.');
|
|
169
|
+
return connections.get('kafka', async () => {
|
|
170
|
+
const instance = await createKafka(kc, { clientId: 'propmaster-mcp', log: 'nothing' });
|
|
171
|
+
const admin = instance.admin();
|
|
172
|
+
await admin.connect();
|
|
173
|
+
return { value: { instance, admin }, close: () => admin.disconnect() };
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
const tools = [
|
|
177
|
+
{
|
|
178
|
+
name: 'environment_info',
|
|
179
|
+
title: 'Environment info',
|
|
180
|
+
description: 'Shows the active Propmaster environment, which backends are configured (hosts only, no credentials), and whether write tools are enabled. Call this first.',
|
|
181
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
182
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
183
|
+
handler: async () => ({
|
|
184
|
+
environment: ctx.environment,
|
|
185
|
+
root: ctx.root,
|
|
186
|
+
writes: ctx.allowWrites ? 'enabled' : 'disabled (start the server with --allow-writes to enable)',
|
|
187
|
+
...(ctx.configError ? { configError: ctx.configError } : {}),
|
|
188
|
+
backends: describeBackends(config),
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'db_query',
|
|
193
|
+
title: 'Database query',
|
|
194
|
+
description: 'Runs one read-only SQL statement (SELECT, WITH, SHOW, EXPLAIN, DESCRIBE, PRAGMA) against the configured database (PostgreSQL, MySQL, MSSQL or SQLite) and returns the rows. Use placeholders ($1 for PostgreSQL, ? otherwise) and params for values.',
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: { sql: { type: 'string', description: 'A single read-only SQL statement' }, params: PARAMS_SCHEMA, maxRows: ROWS_SCHEMA },
|
|
198
|
+
required: ['sql'],
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
},
|
|
201
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
202
|
+
handler: async (args) => {
|
|
203
|
+
const sql = str(args, 'sql');
|
|
204
|
+
const problem = readOnlySqlProblem(sql);
|
|
205
|
+
if (problem) {
|
|
206
|
+
throw new ToolInputError(`db_query only runs reads, and this statement isn't one: ${problem}.${ctx.allowWrites ? ' Use db_execute for writes.' : ''}`);
|
|
207
|
+
}
|
|
208
|
+
const rows = await (await database()).query(sql, arr(args, 'params'));
|
|
209
|
+
return limitRows(rows, count(args, 'maxRows', DEFAULT_ROWS, MAX_ROWS));
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'mongo_find',
|
|
214
|
+
title: 'MongoDB find',
|
|
215
|
+
description: 'Finds documents in a MongoDB collection with an optional filter, sort and projection.',
|
|
216
|
+
inputSchema: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
collection: { type: 'string' },
|
|
220
|
+
filter: { type: 'object', description: 'MongoDB query filter, e.g. {"status": "active"}' },
|
|
221
|
+
sort: { type: 'object', description: 'e.g. {"createdAt": -1}' },
|
|
222
|
+
projection: { type: 'object', description: 'e.g. {"name": 1, "_id": 0}' },
|
|
223
|
+
limit: { type: 'integer', minimum: 1, maximum: MAX_ROWS, description: 'Documents to return (default 20)' },
|
|
224
|
+
},
|
|
225
|
+
required: ['collection'],
|
|
226
|
+
additionalProperties: false,
|
|
227
|
+
},
|
|
228
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
229
|
+
handler: async (args) => {
|
|
230
|
+
const limit = count(args, 'limit', 20, MAX_ROWS);
|
|
231
|
+
const docs = await (await mongo()).find(str(args, 'collection'), obj(args, 'filter') ?? {}, {
|
|
232
|
+
limit,
|
|
233
|
+
sort: obj(args, 'sort'),
|
|
234
|
+
projection: obj(args, 'projection'),
|
|
235
|
+
});
|
|
236
|
+
return { count: docs.length, documents: docs };
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'mongo_aggregate',
|
|
241
|
+
title: 'MongoDB aggregate',
|
|
242
|
+
description: 'Runs an aggregation pipeline on a MongoDB collection. Pipelines with $out or $merge (which write) are refused.',
|
|
243
|
+
inputSchema: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
collection: { type: 'string' },
|
|
247
|
+
pipeline: { type: 'array', items: { type: 'object' } },
|
|
248
|
+
maxRows: ROWS_SCHEMA,
|
|
249
|
+
},
|
|
250
|
+
required: ['collection', 'pipeline'],
|
|
251
|
+
additionalProperties: false,
|
|
252
|
+
},
|
|
253
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
254
|
+
handler: async (args) => {
|
|
255
|
+
const pipeline = arr(args, 'pipeline', true);
|
|
256
|
+
const stage = writingPipelineStage(pipeline);
|
|
257
|
+
if (stage)
|
|
258
|
+
throw new ToolInputError(`mongo_aggregate only reads; the pipeline has a ${stage} stage, which writes.`);
|
|
259
|
+
const docs = await (await mongo()).aggregate(str(args, 'collection'), pipeline);
|
|
260
|
+
return limitRows(docs, count(args, 'maxRows', DEFAULT_ROWS, MAX_ROWS));
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: 'redis_get',
|
|
265
|
+
title: 'Redis get',
|
|
266
|
+
description: 'Reads a Redis key of any type (string, hash, list, set, sorted set, stream) with its TTL. The configured key prefix is added for you.',
|
|
267
|
+
inputSchema: { type: 'object', properties: { key: { type: 'string' } }, required: ['key'], additionalProperties: false },
|
|
268
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
269
|
+
handler: async (args) => {
|
|
270
|
+
const key = str(args, 'key');
|
|
271
|
+
const { client } = await redis();
|
|
272
|
+
const type = await client.type(key);
|
|
273
|
+
const ttl = await client.ttl(key);
|
|
274
|
+
const value = await readRedisValue(client, key, type);
|
|
275
|
+
return { key, type, ttlSeconds: ttl >= 0 ? ttl : null, value };
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: 'redis_keys',
|
|
280
|
+
title: 'Redis keys',
|
|
281
|
+
description: 'Lists Redis keys matching a glob pattern (SCAN, never KEYS). The configured key prefix is added to the pattern and removed from the results.',
|
|
282
|
+
inputSchema: {
|
|
283
|
+
type: 'object',
|
|
284
|
+
properties: { pattern: { type: 'string', description: 'Glob, default "*"' }, limit: { type: 'integer', minimum: 1, maximum: MAX_ROWS, description: 'Keys to return (default 100)' } },
|
|
285
|
+
additionalProperties: false,
|
|
286
|
+
},
|
|
287
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
288
|
+
handler: async (args) => {
|
|
289
|
+
const { client, prefix } = await redis();
|
|
290
|
+
const limit = count(args, 'limit', 100, MAX_ROWS);
|
|
291
|
+
const match = prefix + (optStr(args, 'pattern') ?? '*');
|
|
292
|
+
const keys = [];
|
|
293
|
+
let cursor = '0';
|
|
294
|
+
do {
|
|
295
|
+
const [next, batch] = await client.scan(cursor, 'MATCH', match, 'COUNT', 500);
|
|
296
|
+
cursor = next;
|
|
297
|
+
for (const k of batch)
|
|
298
|
+
if (keys.length < limit)
|
|
299
|
+
keys.push(prefix && k.startsWith(prefix) ? k.slice(prefix.length) : k);
|
|
300
|
+
} while (cursor !== '0' && keys.length < limit);
|
|
301
|
+
return { count: keys.length, keys: keys.sort(), truncated: cursor !== '0' ? true : undefined };
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: 'kafka_topics',
|
|
306
|
+
title: 'Kafka topics',
|
|
307
|
+
description: 'Lists Kafka topics with their partitions and message offsets.',
|
|
308
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
309
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
310
|
+
handler: async () => {
|
|
311
|
+
const { admin } = await kafka();
|
|
312
|
+
const names = (await admin.listTopics()).filter((t) => !t.startsWith('__')).sort();
|
|
313
|
+
const topics = await Promise.all(names.map(async (name) => {
|
|
314
|
+
const offsets = await admin.fetchTopicOffsets(name);
|
|
315
|
+
return {
|
|
316
|
+
name,
|
|
317
|
+
partitions: offsets.length,
|
|
318
|
+
messages: offsets.reduce((sum, p) => sum + (Number(p.high) - Number(p.low)), 0),
|
|
319
|
+
};
|
|
320
|
+
}));
|
|
321
|
+
return { topics };
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: 'kafka_peek',
|
|
326
|
+
title: 'Kafka peek',
|
|
327
|
+
description: 'Reads the latest messages on a Kafka topic without committing offsets for any existing consumer group. Values are parsed as JSON when they can be.',
|
|
328
|
+
inputSchema: {
|
|
329
|
+
type: 'object',
|
|
330
|
+
properties: {
|
|
331
|
+
topic: { type: 'string' },
|
|
332
|
+
limit: { type: 'integer', minimum: 1, maximum: 200, description: 'Latest messages to return (default 10)' },
|
|
333
|
+
},
|
|
334
|
+
required: ['topic'],
|
|
335
|
+
additionalProperties: false,
|
|
336
|
+
},
|
|
337
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
338
|
+
handler: async (args) => {
|
|
339
|
+
const topic = str(args, 'topic');
|
|
340
|
+
const limit = count(args, 'limit', 10, 200);
|
|
341
|
+
const { instance, admin } = await kafka();
|
|
342
|
+
return { topic, messages: await peekTopic(instance, admin, topic, limit) };
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'neo4j_read',
|
|
347
|
+
title: 'Neo4j read',
|
|
348
|
+
description: 'Runs a Cypher query in a read transaction (Neo4j rejects writes in it) and returns the records as plain objects.',
|
|
349
|
+
inputSchema: {
|
|
350
|
+
type: 'object',
|
|
351
|
+
properties: { cypher: { type: 'string' }, params: { type: 'object' }, maxRows: ROWS_SCHEMA },
|
|
352
|
+
required: ['cypher'],
|
|
353
|
+
additionalProperties: false,
|
|
354
|
+
},
|
|
355
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
356
|
+
handler: async (args) => {
|
|
357
|
+
const driver = await neo4j();
|
|
358
|
+
const session = driver.session({ database: config?.neo4j?.database, defaultAccessMode: 'READ' });
|
|
359
|
+
try {
|
|
360
|
+
const result = await session.executeRead((tx) => tx.run(str(args, 'cypher'), obj(args, 'params') ?? {}));
|
|
361
|
+
const rows = result.records.map((r) => toPlain(r.toObject()));
|
|
362
|
+
return limitRows(rows, count(args, 'maxRows', DEFAULT_ROWS, MAX_ROWS));
|
|
363
|
+
}
|
|
364
|
+
finally {
|
|
365
|
+
await session.close();
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: 'clickhouse_query',
|
|
371
|
+
title: 'ClickHouse query',
|
|
372
|
+
description: 'Runs one read-only statement (SELECT, WITH, SHOW, EXPLAIN, DESCRIBE) against the configured ClickHouse and returns the rows, with 64-bit integers as numbers. ClickHouse itself refuses writes for it (readonly=2). Bind values with {name:Type} placeholders and params, e.g. "WHERE user_id = {user:String}" with {"user": "u1"}.',
|
|
373
|
+
inputSchema: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
properties: {
|
|
376
|
+
sql: { type: 'string', description: 'A single read-only statement' },
|
|
377
|
+
params: { type: 'object', description: 'Values for the {name:Type} placeholders, by name' },
|
|
378
|
+
maxRows: ROWS_SCHEMA,
|
|
379
|
+
},
|
|
380
|
+
required: ['sql'],
|
|
381
|
+
additionalProperties: false,
|
|
382
|
+
},
|
|
383
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
384
|
+
handler: async (args) => {
|
|
385
|
+
const sql = str(args, 'sql');
|
|
386
|
+
const problem = readOnlySqlProblem(sql);
|
|
387
|
+
if (problem)
|
|
388
|
+
throw new ToolInputError(`clickhouse_query only runs reads, and this statement isn't one: ${problem}.`);
|
|
389
|
+
const max = count(args, 'maxRows', DEFAULT_ROWS, MAX_ROWS);
|
|
390
|
+
// readonly=2: no writes or DDL, though settings may still change. The result stops (whole blocks) once past maxRows.
|
|
391
|
+
const rows = await (await clickhouse()).query(sql, obj(args, 'params'), {
|
|
392
|
+
settings: { readonly: '2', max_result_rows: String(max + 1), result_overflow_mode: 'break' },
|
|
393
|
+
});
|
|
394
|
+
return limitRows(rows, max);
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: 'openapi_operations',
|
|
399
|
+
title: 'OpenAPI operations',
|
|
400
|
+
description: 'Lists the operations in the configured OpenAPI spec: operationId (the method name on openApiClient.client), method, path, summary, parameters, request body and documented status codes. Filter by a substring of the operationId, path, summary or tag.',
|
|
401
|
+
inputSchema: { type: 'object', properties: { filter: { type: 'string' } }, additionalProperties: false },
|
|
402
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
403
|
+
handler: async (args) => {
|
|
404
|
+
const oc = config?.openapi;
|
|
405
|
+
if (!oc?.specPath)
|
|
406
|
+
notConfigured('The OpenAPI spec', 'Add "openapi.specPath" to environments.json or set PW_OPENAPI_SPEC_PATH.');
|
|
407
|
+
const document = await loadOpenApiDocument(oc.specPath, ctx.root);
|
|
408
|
+
const operations = listOperations(document, optStr(args, 'filter'));
|
|
409
|
+
return { baseUrl: oc.baseUrl, count: operations.length, operations };
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: 'otp_generate',
|
|
414
|
+
title: 'Generate OTP',
|
|
415
|
+
description: 'Generates the current TOTP code for the configured OTP secret (PW_OTP_SECRET), or for a base32 secret you pass.',
|
|
416
|
+
inputSchema: { type: 'object', properties: { secret: { type: 'string', description: 'Base32 secret; defaults to the configured one' } }, additionalProperties: false },
|
|
417
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
418
|
+
handler: async (args) => {
|
|
419
|
+
const otp = config?.otp ?? {};
|
|
420
|
+
const client = createOtpClient(otp, await loadOptional('otplib', 'otpClient'));
|
|
421
|
+
const token = await client.generateTotp(optStr(args, 'secret'));
|
|
422
|
+
const period = otp.period ?? 30;
|
|
423
|
+
return { token, expiresInSeconds: period - (Math.floor(Date.now() / 1000) % period) };
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
name: 'next_test_id',
|
|
428
|
+
title: 'Next TestCaseID',
|
|
429
|
+
description: 'Returns the next free TestCaseID(s) in a category (e.g. API → TC-API-005). Use it for every new test: each test needs a unique [TC-XXX-NNN] title prefix and matching tag.',
|
|
430
|
+
inputSchema: {
|
|
431
|
+
type: 'object',
|
|
432
|
+
properties: {
|
|
433
|
+
category: { type: 'string', description: 'Category code, e.g. API, DB, KFK, RDS, MDB, NEO, GQL, BRW' },
|
|
434
|
+
count: { type: 'integer', minimum: 1, maximum: 50, description: 'How many sequential IDs (default 1)' },
|
|
435
|
+
},
|
|
436
|
+
required: ['category'],
|
|
437
|
+
additionalProperties: false,
|
|
438
|
+
},
|
|
439
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
440
|
+
handler: async (args) => {
|
|
441
|
+
const category = str(args, 'category').toUpperCase();
|
|
442
|
+
if (!/^[A-Z][A-Z0-9]{1,5}$/.test(category))
|
|
443
|
+
throw new ToolInputError('category must be 2–6 capital letters or digits, starting with a letter (e.g. API)');
|
|
444
|
+
return { ids: nextIds(category, collect(ctx.root).ids, count(args, 'count', 1, 50)) };
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: 'check_tests',
|
|
449
|
+
title: 'Check test conventions',
|
|
450
|
+
description: "Checks every test file against the Propmaster conventions (TestCaseID in title and tag, unique IDs, test.step() bodies, imports) and the team's own rules in propmaster.standards.json (standard:<id>; warnings don't fail), and lists the violations with file, line and fix. Run it after writing or changing tests.",
|
|
451
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
452
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
453
|
+
handler: async () => {
|
|
454
|
+
const { violations, warnings } = collect(ctx.root);
|
|
455
|
+
return { ok: violations.length === 0, violations, ...(warnings.length ? { warnings } : {}) };
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
...projectTools(ctx.root, undefined, ctx.environment),
|
|
459
|
+
...testTools({ root: ctx.root, environment: ctx.environment, production: ctx.production === true, config: ctx.config }),
|
|
460
|
+
];
|
|
461
|
+
if (!ctx.allowWrites)
|
|
462
|
+
return tools;
|
|
463
|
+
// ── Write tools (only with --allow-writes, never in production) ──
|
|
464
|
+
const write = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
|
|
465
|
+
tools.push({
|
|
466
|
+
name: 'db_execute',
|
|
467
|
+
title: 'Database execute',
|
|
468
|
+
description: 'Runs one SQL statement that changes data (INSERT, UPDATE, DELETE, DDL) and returns the affected row count. Nothing is cleaned up afterwards.',
|
|
469
|
+
inputSchema: { type: 'object', properties: { sql: { type: 'string' }, params: PARAMS_SCHEMA }, required: ['sql'], additionalProperties: false },
|
|
470
|
+
annotations: write,
|
|
471
|
+
handler: async (args) => {
|
|
472
|
+
return (await database()).execute(str(args, 'sql'), arr(args, 'params'));
|
|
473
|
+
},
|
|
474
|
+
}, {
|
|
475
|
+
name: 'mongo_insert',
|
|
476
|
+
title: 'MongoDB insert',
|
|
477
|
+
description: 'Inserts documents into a MongoDB collection.',
|
|
478
|
+
inputSchema: { type: 'object', properties: { collection: { type: 'string' }, documents: { type: 'array', items: { type: 'object' } } }, required: ['collection', 'documents'], additionalProperties: false },
|
|
479
|
+
annotations: write,
|
|
480
|
+
handler: async (args) => (await mongo()).insertMany(str(args, 'collection'), arr(args, 'documents', true)),
|
|
481
|
+
}, {
|
|
482
|
+
name: 'mongo_update',
|
|
483
|
+
title: 'MongoDB update',
|
|
484
|
+
description: 'Updates every document matching a filter (updateMany).',
|
|
485
|
+
inputSchema: { type: 'object', properties: { collection: { type: 'string' }, filter: { type: 'object' }, update: { type: 'object', description: 'e.g. {"$set": {"active": false}}' } }, required: ['collection', 'filter', 'update'], additionalProperties: false },
|
|
486
|
+
annotations: write,
|
|
487
|
+
handler: async (args) => (await mongo()).updateMany(str(args, 'collection'), obj(args, 'filter') ?? {}, obj(args, 'update') ?? {}),
|
|
488
|
+
}, {
|
|
489
|
+
name: 'mongo_delete',
|
|
490
|
+
title: 'MongoDB delete',
|
|
491
|
+
description: 'Deletes every document matching a filter (deleteMany). An empty filter is refused.',
|
|
492
|
+
inputSchema: { type: 'object', properties: { collection: { type: 'string' }, filter: { type: 'object' } }, required: ['collection', 'filter'], additionalProperties: false },
|
|
493
|
+
annotations: write,
|
|
494
|
+
handler: async (args) => {
|
|
495
|
+
const filter = obj(args, 'filter') ?? {};
|
|
496
|
+
if (Object.keys(filter).length === 0)
|
|
497
|
+
throw new ToolInputError('mongo_delete needs a non-empty filter; it never deletes a whole collection.');
|
|
498
|
+
return (await mongo()).deleteMany(str(args, 'collection'), filter);
|
|
499
|
+
},
|
|
500
|
+
}, {
|
|
501
|
+
name: 'redis_set',
|
|
502
|
+
title: 'Redis set',
|
|
503
|
+
description: 'Sets a Redis string key, optionally with a TTL.',
|
|
504
|
+
inputSchema: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' }, ttlSeconds: { type: 'integer', minimum: 1 } }, required: ['key', 'value'], additionalProperties: false },
|
|
505
|
+
annotations: write,
|
|
506
|
+
handler: async (args) => {
|
|
507
|
+
const { client } = await redis();
|
|
508
|
+
const key = str(args, 'key');
|
|
509
|
+
const value = typeof args.value === 'string' ? args.value : JSON.stringify(args.value);
|
|
510
|
+
const ttl = args.ttlSeconds === undefined ? undefined : count(args, 'ttlSeconds', 1, Number.MAX_SAFE_INTEGER);
|
|
511
|
+
await (ttl ? client.set(key, value, 'EX', ttl) : client.set(key, value));
|
|
512
|
+
return { key, set: true, ttlSeconds: ttl ?? null };
|
|
513
|
+
},
|
|
514
|
+
}, {
|
|
515
|
+
name: 'redis_del',
|
|
516
|
+
title: 'Redis delete',
|
|
517
|
+
description: 'Deletes Redis keys.',
|
|
518
|
+
inputSchema: { type: 'object', properties: { keys: { type: 'array', items: { type: 'string' } } }, required: ['keys'], additionalProperties: false },
|
|
519
|
+
annotations: write,
|
|
520
|
+
handler: async (args) => {
|
|
521
|
+
const keys = (arr(args, 'keys', true) ?? []).map(String);
|
|
522
|
+
if (keys.length === 0)
|
|
523
|
+
throw new ToolInputError('"keys" is empty');
|
|
524
|
+
const { client } = await redis();
|
|
525
|
+
return { removed: await client.del(...keys) };
|
|
526
|
+
},
|
|
527
|
+
}, {
|
|
528
|
+
name: 'kafka_produce',
|
|
529
|
+
title: 'Kafka produce',
|
|
530
|
+
description: 'Sends messages to a Kafka topic. Object values are sent as JSON.',
|
|
531
|
+
inputSchema: {
|
|
532
|
+
type: 'object',
|
|
533
|
+
properties: {
|
|
534
|
+
topic: { type: 'string' },
|
|
535
|
+
messages: { type: 'array', items: { type: 'object', properties: { key: { type: 'string' }, value: {} }, required: ['value'] } },
|
|
536
|
+
},
|
|
537
|
+
required: ['topic', 'messages'],
|
|
538
|
+
additionalProperties: false,
|
|
539
|
+
},
|
|
540
|
+
annotations: write,
|
|
541
|
+
handler: async (args) => {
|
|
542
|
+
const topic = str(args, 'topic');
|
|
543
|
+
const messages = arr(args, 'messages', true).map((m) => ({
|
|
544
|
+
key: m.key ?? null,
|
|
545
|
+
value: typeof m.value === 'string' ? m.value : JSON.stringify(m.value),
|
|
546
|
+
}));
|
|
547
|
+
const { instance } = await kafka();
|
|
548
|
+
const producer = instance.producer();
|
|
549
|
+
await producer.connect();
|
|
550
|
+
try {
|
|
551
|
+
await producer.send({ topic, messages });
|
|
552
|
+
}
|
|
553
|
+
finally {
|
|
554
|
+
await producer.disconnect();
|
|
555
|
+
}
|
|
556
|
+
return { topic, sent: messages.length };
|
|
557
|
+
},
|
|
558
|
+
}, {
|
|
559
|
+
name: 'neo4j_write',
|
|
560
|
+
title: 'Neo4j write',
|
|
561
|
+
description: 'Runs a Cypher write query and returns the update counters.',
|
|
562
|
+
inputSchema: { type: 'object', properties: { cypher: { type: 'string' }, params: { type: 'object' } }, required: ['cypher'], additionalProperties: false },
|
|
563
|
+
annotations: write,
|
|
564
|
+
handler: async (args) => {
|
|
565
|
+
const driver = await neo4j();
|
|
566
|
+
const { summary } = await driver.executeQuery(str(args, 'cypher'), obj(args, 'params') ?? {}, {
|
|
567
|
+
database: config?.neo4j?.database,
|
|
568
|
+
routing: 'WRITE',
|
|
569
|
+
});
|
|
570
|
+
return summary.counters.updates();
|
|
571
|
+
},
|
|
572
|
+
});
|
|
573
|
+
return tools;
|
|
574
|
+
}
|
|
575
|
+
// ─── Backend details ────────────────────────────────────────────────────────
|
|
576
|
+
/** Configured backends with where they point, without credentials. */
|
|
577
|
+
export function describeBackends(config) {
|
|
578
|
+
if (!config)
|
|
579
|
+
return {};
|
|
580
|
+
const out = {};
|
|
581
|
+
const c = config;
|
|
582
|
+
if (c.database)
|
|
583
|
+
out.database = { type: c.database.type, host: c.database.host, port: c.database.port, database: c.database.database, tools: ['db_query'] };
|
|
584
|
+
if (c.redis)
|
|
585
|
+
out.redis = { host: c.redis.host, port: c.redis.port, db: c.redis.db, keyPrefix: c.redis.keyPrefix, tools: ['redis_get', 'redis_keys'] };
|
|
586
|
+
if (c.mongodb)
|
|
587
|
+
out.mongodb = { host: c.mongodb.uri ? hostOf(c.mongodb.uri) : c.mongodb.host, port: c.mongodb.port, database: c.mongodb.database, tools: ['mongo_find', 'mongo_aggregate'] };
|
|
588
|
+
if (c.neo4j)
|
|
589
|
+
out.neo4j = { uri: hostOf(c.neo4j.uri), database: c.neo4j.database, tools: ['neo4j_read'] };
|
|
590
|
+
if (c.clickhouse)
|
|
591
|
+
out.clickhouse = { url: hostOf(c.clickhouse.url ?? 'http://localhost:8123'), database: c.clickhouse.database ?? 'default', tools: ['clickhouse_query'] };
|
|
592
|
+
if (c.kafka && c.kafka.brokers.length > 0)
|
|
593
|
+
out.kafka = { brokers: c.kafka.brokers, tools: ['kafka_topics', 'kafka_peek'] };
|
|
594
|
+
if (c.openapi?.specPath)
|
|
595
|
+
out.openapi = { specPath: c.openapi.specPath, baseUrl: c.openapi.baseUrl, tools: ['openapi_operations'] };
|
|
596
|
+
if (c.graphql?.endpoint)
|
|
597
|
+
out.graphql = { endpoint: c.graphql.endpoint };
|
|
598
|
+
if (c.otp?.secret)
|
|
599
|
+
out.otp = { secret: 'configured', tools: ['otp_generate'] };
|
|
600
|
+
return out;
|
|
601
|
+
}
|
|
602
|
+
/** A URL without its user info. */
|
|
603
|
+
function hostOf(uri) {
|
|
604
|
+
try {
|
|
605
|
+
const u = new URL(uri);
|
|
606
|
+
u.username = '';
|
|
607
|
+
u.password = '';
|
|
608
|
+
return u.toString();
|
|
609
|
+
}
|
|
610
|
+
catch {
|
|
611
|
+
return uri.replace(/\/\/[^@/]*@/, '//');
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
async function readRedisValue(client, key, type) {
|
|
615
|
+
switch (type) {
|
|
616
|
+
case 'none': return null;
|
|
617
|
+
case 'string': return decode(await client.get(key));
|
|
618
|
+
case 'hash': return client.hgetall(key);
|
|
619
|
+
case 'list': return { length: await client.llen(key), first100: await client.lrange(key, 0, 99) };
|
|
620
|
+
case 'set': {
|
|
621
|
+
const [, members] = await client.sscan(key, '0', 'COUNT', 100);
|
|
622
|
+
return { size: await client.scard(key), sample: members.slice(0, 100) };
|
|
623
|
+
}
|
|
624
|
+
case 'zset': return { size: await client.zcard(key), first100WithScores: await client.zrange(key, '0', '99', 'WITHSCORES') };
|
|
625
|
+
case 'stream': return { length: await client.xlen(key), latest20: await client.xrevrange(key, '+', '-', 'COUNT', '20') };
|
|
626
|
+
default: return `<${type} values aren't shown>`;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Reads up to `limit` of the latest messages on each partition with a
|
|
631
|
+
* throwaway consumer group, then deletes the group.
|
|
632
|
+
*/
|
|
633
|
+
async function peekTopic(kafka, admin, topic, limit) {
|
|
634
|
+
const topics = await admin.listTopics();
|
|
635
|
+
if (!topics.includes(topic))
|
|
636
|
+
throw new ToolInputError(`Topic "${topic}" doesn't exist. kafka_topics lists the topics.`);
|
|
637
|
+
const offsets = await admin.fetchTopicOffsets(topic);
|
|
638
|
+
const ranges = offsets
|
|
639
|
+
.map((p) => ({ partition: p.partition, high: Number(p.high), start: Math.max(Number(p.low), Number(p.high) - limit) }))
|
|
640
|
+
.filter((p) => p.high > p.start);
|
|
641
|
+
if (ranges.length === 0)
|
|
642
|
+
return [];
|
|
643
|
+
const groupId = `propmaster-mcp-${randomBytes(4).toString('hex')}`;
|
|
644
|
+
const consumer = kafka.consumer({ groupId, fromBeginning: true, autoCommit: false });
|
|
645
|
+
const messages = [];
|
|
646
|
+
const remaining = new Map(ranges.map((r) => [r.partition, r.high]));
|
|
647
|
+
await consumer.connect();
|
|
648
|
+
try {
|
|
649
|
+
await consumer.subscribe({ topic });
|
|
650
|
+
await new Promise((resolve, reject) => {
|
|
651
|
+
const timer = setTimeout(resolve, KAFKA_PEEK_TIMEOUT_MS);
|
|
652
|
+
consumer.run({
|
|
653
|
+
eachMessage: async ({ partition, message }) => {
|
|
654
|
+
const high = remaining.get(partition);
|
|
655
|
+
if (high === undefined)
|
|
656
|
+
return;
|
|
657
|
+
messages.push({
|
|
658
|
+
partition,
|
|
659
|
+
offset: message.offset,
|
|
660
|
+
timestamp: new Date(Number(message.timestamp)).toISOString(),
|
|
661
|
+
key: message.key?.toString() ?? null,
|
|
662
|
+
value: decode(message.value?.toString()),
|
|
663
|
+
...(message.headers && Object.keys(message.headers).length > 0
|
|
664
|
+
? { headers: Object.fromEntries(Object.entries(message.headers).map(([k, v]) => [k, String(v)])) }
|
|
665
|
+
: {}),
|
|
666
|
+
});
|
|
667
|
+
if (Number(message.offset) + 1 >= high)
|
|
668
|
+
remaining.delete(partition);
|
|
669
|
+
if (remaining.size === 0) {
|
|
670
|
+
clearTimeout(timer);
|
|
671
|
+
resolve();
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
}).catch(reject);
|
|
675
|
+
for (const r of ranges)
|
|
676
|
+
consumer.seek({ topic, partition: r.partition, offset: String(r.start) });
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
finally {
|
|
680
|
+
await consumer.disconnect().catch(() => { });
|
|
681
|
+
await admin.deleteGroups([groupId]).catch(() => { });
|
|
682
|
+
}
|
|
683
|
+
return messages
|
|
684
|
+
.sort((a, b) => a.timestamp.localeCompare(b.timestamp) || a.partition - b.partition || Number(a.offset) - Number(b.offset))
|
|
685
|
+
.slice(-limit);
|
|
686
|
+
}
|
|
687
|
+
// ─── OpenAPI ────────────────────────────────────────────────────────────────
|
|
688
|
+
const HTTP_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];
|
|
689
|
+
export function listOperations(document, filter) {
|
|
690
|
+
const paths = (document.paths ?? {});
|
|
691
|
+
const needle = filter?.toLowerCase();
|
|
692
|
+
const out = [];
|
|
693
|
+
for (const [path, item] of Object.entries(paths)) {
|
|
694
|
+
if (!item || typeof item !== 'object')
|
|
695
|
+
continue;
|
|
696
|
+
const shared = Array.isArray(item.parameters) ? item.parameters : [];
|
|
697
|
+
for (const method of HTTP_METHODS) {
|
|
698
|
+
const op = item[method];
|
|
699
|
+
if (!op)
|
|
700
|
+
continue;
|
|
701
|
+
const params = [...shared, ...(Array.isArray(op.parameters) ? op.parameters : [])];
|
|
702
|
+
const body = op.requestBody;
|
|
703
|
+
const bodyParam = params.find((p) => p.in === 'body');
|
|
704
|
+
const entry = {
|
|
705
|
+
operationId: op.operationId,
|
|
706
|
+
method: method.toUpperCase(),
|
|
707
|
+
path,
|
|
708
|
+
summary: (op.summary ?? op.description),
|
|
709
|
+
tags: op.tags,
|
|
710
|
+
parameters: params.filter((p) => p.in !== 'body').map((p) => (p.$ref ? String(p.$ref).split('/').pop() : `${p.name} (${p.in}${p.required ? ', required' : ''})`)),
|
|
711
|
+
requestBody: body?.content ? Object.keys(body.content) : body?.$ref ? [String(body.$ref)] : bodyParam ? ['body'] : undefined,
|
|
712
|
+
responses: Object.keys((op.responses ?? {})),
|
|
713
|
+
};
|
|
714
|
+
if (entry.parameters?.length === 0)
|
|
715
|
+
delete entry.parameters;
|
|
716
|
+
if (needle) {
|
|
717
|
+
const haystack = [entry.operationId, entry.path, entry.summary, ...(entry.tags ?? [])].filter(Boolean).join(' ').toLowerCase();
|
|
718
|
+
if (!haystack.includes(needle))
|
|
719
|
+
continue;
|
|
720
|
+
}
|
|
721
|
+
out.push(entry);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return out;
|
|
725
|
+
}
|
|
726
|
+
//# sourceMappingURL=tools.js.map
|