recker 1.0.20-next.de24f7d → 1.0.20-next.e194d90
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/README.md +31 -0
- package/dist/ai/adaptive-timeout.d.ts +0 -1
- package/dist/ai/client.d.ts +0 -1
- package/dist/ai/client.js +6 -0
- package/dist/ai/index.d.ts +3 -1
- package/dist/ai/index.js +3 -0
- package/dist/ai/providers/anthropic.d.ts +0 -1
- package/dist/ai/providers/base.d.ts +0 -1
- package/dist/ai/providers/google.d.ts +59 -0
- package/dist/ai/providers/google.js +305 -0
- package/dist/ai/providers/index.d.ts +4 -1
- package/dist/ai/providers/index.js +2 -0
- package/dist/ai/providers/ollama.d.ts +44 -0
- package/dist/ai/providers/ollama.js +240 -0
- package/dist/ai/providers/openai.d.ts +0 -1
- package/dist/ai/rate-limiter.d.ts +0 -1
- package/dist/ai/vector/index.d.ts +2 -0
- package/dist/ai/vector/index.js +2 -0
- package/dist/ai/vector/similarity.d.ts +2 -0
- package/dist/ai/vector/similarity.js +27 -0
- package/dist/ai/vector/store.d.ts +27 -0
- package/dist/ai/vector/store.js +82 -0
- package/dist/bench/generator.d.ts +0 -1
- package/dist/bench/stats.d.ts +0 -1
- package/dist/cache/basic-file-storage.d.ts +12 -0
- package/dist/cache/basic-file-storage.js +50 -0
- package/dist/cache/file-storage.d.ts +25 -11
- package/dist/cache/file-storage.js +175 -30
- package/dist/cache/memory-limits.d.ts +0 -1
- package/dist/cache/memory-storage.d.ts +0 -1
- package/dist/cache/redis-storage.d.ts +0 -1
- package/dist/cli/handler.d.ts +2 -1
- package/dist/cli/handler.js +36 -5
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +559 -6
- package/dist/cli/presets.d.ts +0 -1
- package/dist/cli/tui/ai-chat.d.ts +0 -1
- package/dist/cli/tui/load-dashboard.d.ts +0 -1
- package/dist/cli/tui/scroll-buffer.d.ts +0 -1
- package/dist/cli/tui/search-panel.d.ts +0 -1
- package/dist/cli/tui/shell-search.d.ts +0 -1
- package/dist/cli/tui/shell.d.ts +0 -1
- package/dist/cli/tui/shell.js +1 -1
- package/dist/cli/tui/websocket.d.ts +0 -1
- package/dist/constants/http-status.d.ts +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/contract/index.d.ts +0 -1
- package/dist/cookies/memory-cookie-jar.d.ts +0 -1
- package/dist/core/client.d.ts +0 -1
- package/dist/core/client.js +1 -1
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/request-promise.d.ts +0 -1
- package/dist/core/request.d.ts +0 -1
- package/dist/core/response.d.ts +0 -1
- package/dist/dns/index.d.ts +0 -1
- package/dist/dns/propagation.d.ts +0 -1
- package/dist/events/request-events.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/mcp/client.d.ts +0 -1
- package/dist/mcp/contract.d.ts +0 -1
- package/dist/mcp/embeddings-loader.d.ts +0 -1
- package/dist/mcp/geoip-loader.d.ts +0 -1
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/ip-intel.d.ts +0 -1
- package/dist/mcp/search/hybrid-search.d.ts +0 -1
- package/dist/mcp/search/index.d.ts +0 -1
- package/dist/mcp/search/math.d.ts +0 -1
- package/dist/mcp/search/types.d.ts +0 -1
- package/dist/mcp/server.d.ts +6 -2
- package/dist/mcp/server.js +193 -151
- package/dist/mcp/tools/loader.d.ts +2 -0
- package/dist/mcp/tools/loader.js +41 -0
- package/dist/mcp/tools/network.d.ts +3 -0
- package/dist/mcp/tools/network.js +267 -0
- package/dist/mcp/tools/registry.d.ts +17 -0
- package/dist/mcp/tools/registry.js +37 -0
- package/dist/mcp/types.d.ts +0 -1
- package/dist/plugins/auth/api-key.d.ts +8 -0
- package/dist/plugins/auth/api-key.js +27 -0
- package/dist/plugins/auth/auth0.d.ts +33 -0
- package/dist/plugins/auth/auth0.js +94 -0
- package/dist/plugins/auth/aws-sigv4.d.ts +10 -0
- package/dist/plugins/auth/aws-sigv4.js +88 -0
- package/dist/plugins/auth/azure-ad.d.ts +48 -0
- package/dist/plugins/auth/azure-ad.js +152 -0
- package/dist/plugins/auth/basic.d.ts +7 -0
- package/dist/plugins/auth/basic.js +13 -0
- package/dist/plugins/auth/bearer.d.ts +8 -0
- package/dist/plugins/auth/bearer.js +17 -0
- package/dist/plugins/auth/cognito.d.ts +45 -0
- package/dist/plugins/auth/cognito.js +208 -0
- package/dist/plugins/auth/digest.d.ts +8 -0
- package/dist/plugins/auth/digest.js +100 -0
- package/dist/plugins/auth/firebase.d.ts +32 -0
- package/dist/plugins/auth/firebase.js +195 -0
- package/dist/plugins/auth/github-app.d.ts +36 -0
- package/dist/plugins/auth/github-app.js +170 -0
- package/dist/plugins/auth/google-service-account.d.ts +49 -0
- package/dist/plugins/auth/google-service-account.js +172 -0
- package/dist/plugins/auth/index.d.ts +15 -0
- package/dist/plugins/auth/index.js +15 -0
- package/dist/plugins/auth/mtls.d.ts +37 -0
- package/dist/plugins/auth/mtls.js +140 -0
- package/dist/plugins/auth/oauth2.d.ts +8 -0
- package/dist/plugins/auth/oauth2.js +26 -0
- package/dist/plugins/auth/oidc.d.ts +55 -0
- package/dist/plugins/auth/oidc.js +222 -0
- package/dist/plugins/auth/okta.d.ts +47 -0
- package/dist/plugins/auth/okta.js +157 -0
- package/dist/plugins/auth.d.ts +1 -45
- package/dist/plugins/auth.js +1 -268
- package/dist/plugins/cache.d.ts +0 -1
- package/dist/plugins/cache.js +1 -1
- package/dist/plugins/certificate-pinning.d.ts +59 -0
- package/dist/plugins/certificate-pinning.js +236 -0
- package/dist/plugins/circuit-breaker.d.ts +0 -1
- package/dist/plugins/compression.d.ts +0 -1
- package/dist/plugins/cookie-jar.d.ts +0 -1
- package/dist/plugins/dedup.d.ts +0 -1
- package/dist/plugins/graphql.d.ts +0 -1
- package/dist/plugins/grpc-web.d.ts +0 -1
- package/dist/plugins/har-player.d.ts +0 -1
- package/dist/plugins/har-recorder.d.ts +0 -1
- package/dist/plugins/hls.d.ts +0 -1
- package/dist/plugins/http2-push.d.ts +0 -1
- package/dist/plugins/http3.d.ts +0 -1
- package/dist/plugins/index.d.ts +27 -0
- package/dist/plugins/index.js +27 -0
- package/dist/plugins/interface-rotator.d.ts +0 -1
- package/dist/plugins/jsonrpc.d.ts +0 -1
- package/dist/plugins/logger.d.ts +0 -1
- package/dist/plugins/odata.d.ts +0 -1
- package/dist/plugins/pagination.d.ts +0 -1
- package/dist/plugins/proxy-rotator.d.ts +0 -1
- package/dist/plugins/rate-limit.d.ts +15 -0
- package/dist/plugins/rate-limit.js +162 -0
- package/dist/plugins/retry.d.ts +0 -1
- package/dist/plugins/retry.js +2 -2
- package/dist/plugins/scrape.d.ts +0 -1
- package/dist/plugins/server-timing.d.ts +0 -1
- package/dist/plugins/soap.d.ts +0 -1
- package/dist/plugins/user-agent.d.ts +0 -1
- package/dist/plugins/xml.d.ts +0 -1
- package/dist/plugins/xsrf.d.ts +0 -1
- package/dist/presets/anthropic.d.ts +0 -1
- package/dist/presets/aws.d.ts +0 -1
- package/dist/presets/azure-openai.d.ts +0 -1
- package/dist/presets/azure.d.ts +0 -1
- package/dist/presets/cloudflare.d.ts +0 -1
- package/dist/presets/cohere.d.ts +0 -1
- package/dist/presets/deepseek.d.ts +0 -1
- package/dist/presets/digitalocean.d.ts +0 -1
- package/dist/presets/discord.d.ts +0 -1
- package/dist/presets/fireworks.d.ts +0 -1
- package/dist/presets/gcp.d.ts +0 -1
- package/dist/presets/gemini.d.ts +0 -1
- package/dist/presets/github.d.ts +0 -1
- package/dist/presets/gitlab.d.ts +0 -1
- package/dist/presets/groq.d.ts +0 -1
- package/dist/presets/huggingface.d.ts +0 -1
- package/dist/presets/index.d.ts +0 -1
- package/dist/presets/linear.d.ts +0 -1
- package/dist/presets/mailgun.d.ts +0 -1
- package/dist/presets/meta.d.ts +0 -1
- package/dist/presets/mistral.d.ts +0 -1
- package/dist/presets/notion.d.ts +0 -1
- package/dist/presets/openai.d.ts +0 -1
- package/dist/presets/oracle.d.ts +0 -1
- package/dist/presets/perplexity.d.ts +0 -1
- package/dist/presets/registry.d.ts +0 -1
- package/dist/presets/replicate.d.ts +0 -1
- package/dist/presets/sinch.d.ts +0 -1
- package/dist/presets/slack.d.ts +0 -1
- package/dist/presets/stripe.d.ts +0 -1
- package/dist/presets/supabase.d.ts +0 -1
- package/dist/presets/tiktok.d.ts +0 -1
- package/dist/presets/together.d.ts +0 -1
- package/dist/presets/twilio.d.ts +0 -1
- package/dist/presets/vercel.d.ts +0 -1
- package/dist/presets/vultr.d.ts +0 -1
- package/dist/presets/xai.d.ts +0 -1
- package/dist/presets/youtube.d.ts +0 -1
- package/dist/protocols/ftp.d.ts +0 -1
- package/dist/protocols/index.d.ts +0 -1
- package/dist/protocols/sftp.d.ts +0 -1
- package/dist/protocols/telnet.d.ts +0 -1
- package/dist/recker.d.ts +0 -1
- package/dist/runner/request-runner.d.ts +0 -1
- package/dist/scrape/document.d.ts +0 -1
- package/dist/scrape/element.d.ts +0 -1
- package/dist/scrape/extractors.d.ts +0 -1
- package/dist/scrape/index.d.ts +0 -1
- package/dist/scrape/types.d.ts +0 -1
- package/dist/testing/index.d.ts +16 -1
- package/dist/testing/index.js +8 -0
- package/dist/testing/mock-dns-server.d.ts +69 -0
- package/dist/testing/mock-dns-server.js +269 -0
- package/dist/testing/mock-ftp-server.d.ts +89 -0
- package/dist/testing/mock-ftp-server.js +562 -0
- package/dist/testing/mock-hls-server.d.ts +80 -0
- package/dist/testing/mock-hls-server.js +381 -0
- package/dist/testing/mock-http-server.d.ts +99 -0
- package/dist/testing/mock-http-server.js +298 -0
- package/dist/testing/mock-sse-server.d.ts +76 -0
- package/dist/testing/mock-sse-server.js +291 -0
- package/dist/testing/mock-telnet-server.d.ts +59 -0
- package/dist/testing/mock-telnet-server.js +273 -0
- package/dist/testing/mock-udp-server.d.ts +0 -1
- package/dist/testing/mock-websocket-server.d.ts +77 -0
- package/dist/testing/mock-websocket-server.js +316 -0
- package/dist/testing/mock-whois-server.d.ts +56 -0
- package/dist/testing/mock-whois-server.js +234 -0
- package/dist/testing/mock.d.ts +0 -1
- package/dist/transport/base-udp.d.ts +0 -1
- package/dist/transport/fetch.d.ts +0 -1
- package/dist/transport/udp-response.d.ts +0 -1
- package/dist/transport/udp.d.ts +0 -1
- package/dist/transport/undici.d.ts +0 -1
- package/dist/transport/undici.js +1 -1
- package/dist/types/ai.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/logger.d.ts +0 -1
- package/dist/types/udp.d.ts +0 -1
- package/dist/udp/index.d.ts +0 -1
- package/dist/utils/agent-manager.d.ts +0 -1
- package/dist/utils/body.d.ts +0 -1
- package/dist/utils/cert.d.ts +0 -1
- package/dist/utils/charset.d.ts +0 -1
- package/dist/utils/chart.d.ts +0 -1
- package/dist/utils/client-pool.d.ts +0 -1
- package/dist/utils/colors.d.ts +0 -1
- package/dist/utils/concurrency.d.ts +0 -1
- package/dist/utils/dns-toolkit.d.ts +0 -1
- package/dist/utils/dns-toolkit.js +1 -1
- package/dist/utils/dns.d.ts +0 -1
- package/dist/utils/dns.js +2 -2
- package/dist/utils/doh.d.ts +0 -1
- package/dist/utils/download.d.ts +0 -1
- package/dist/utils/env-proxy.d.ts +0 -1
- package/dist/utils/header-parser.d.ts +0 -1
- package/dist/utils/html-cleaner.d.ts +0 -1
- package/dist/utils/link-header.d.ts +0 -1
- package/dist/utils/optional-require.d.ts +0 -1
- package/dist/utils/optional-require.js +1 -1
- package/dist/utils/progress.d.ts +0 -1
- package/dist/utils/rdap.d.ts +0 -1
- package/dist/utils/request-pool.d.ts +0 -1
- package/dist/utils/security-grader.d.ts +0 -1
- package/dist/utils/sparkline.d.ts +0 -1
- package/dist/utils/sse.d.ts +0 -1
- package/dist/utils/streaming.d.ts +0 -1
- package/dist/utils/system-metrics.d.ts +0 -1
- package/dist/utils/tls-inspector.d.ts +0 -1
- package/dist/utils/try-fn.d.ts +0 -1
- package/dist/utils/upload.d.ts +0 -1
- package/dist/utils/user-agent.d.ts +0 -1
- package/dist/utils/whois.d.ts +0 -1
- package/dist/webrtc/index.d.ts +0 -1
- package/dist/webrtc/index.js +1 -1
- package/dist/websocket/client.d.ts +0 -1
- package/package.json +12 -3
- package/dist/ai/adaptive-timeout.d.ts.map +0 -1
- package/dist/ai/client.d.ts.map +0 -1
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/providers/anthropic.d.ts.map +0 -1
- package/dist/ai/providers/base.d.ts.map +0 -1
- package/dist/ai/providers/index.d.ts.map +0 -1
- package/dist/ai/providers/openai.d.ts.map +0 -1
- package/dist/ai/rate-limiter.d.ts.map +0 -1
- package/dist/bench/generator.d.ts.map +0 -1
- package/dist/bench/stats.d.ts.map +0 -1
- package/dist/cache/file-storage.d.ts.map +0 -1
- package/dist/cache/memory-limits.d.ts.map +0 -1
- package/dist/cache/memory-storage.d.ts.map +0 -1
- package/dist/cache/redis-storage.d.ts.map +0 -1
- package/dist/cli/handler.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/presets.d.ts.map +0 -1
- package/dist/cli/tui/ai-chat.d.ts.map +0 -1
- package/dist/cli/tui/load-dashboard.d.ts.map +0 -1
- package/dist/cli/tui/scroll-buffer.d.ts.map +0 -1
- package/dist/cli/tui/search-panel.d.ts.map +0 -1
- package/dist/cli/tui/shell-search.d.ts.map +0 -1
- package/dist/cli/tui/shell.d.ts.map +0 -1
- package/dist/cli/tui/websocket.d.ts.map +0 -1
- package/dist/constants/http-status.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/cookies/memory-cookie-jar.d.ts.map +0 -1
- package/dist/core/client.d.ts.map +0 -1
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/request-promise.d.ts.map +0 -1
- package/dist/core/request.d.ts.map +0 -1
- package/dist/core/response.d.ts.map +0 -1
- package/dist/dns/index.d.ts.map +0 -1
- package/dist/dns/propagation.d.ts.map +0 -1
- package/dist/events/request-events.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/contract.d.ts.map +0 -1
- package/dist/mcp/embeddings-loader.d.ts.map +0 -1
- package/dist/mcp/geoip-loader.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/ip-intel.d.ts.map +0 -1
- package/dist/mcp/search/hybrid-search.d.ts.map +0 -1
- package/dist/mcp/search/index.d.ts.map +0 -1
- package/dist/mcp/search/math.d.ts.map +0 -1
- package/dist/mcp/search/types.d.ts.map +0 -1
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/plugins/auth.d.ts.map +0 -1
- package/dist/plugins/cache.d.ts.map +0 -1
- package/dist/plugins/circuit-breaker.d.ts.map +0 -1
- package/dist/plugins/compression.d.ts.map +0 -1
- package/dist/plugins/cookie-jar.d.ts.map +0 -1
- package/dist/plugins/dedup.d.ts.map +0 -1
- package/dist/plugins/graphql.d.ts.map +0 -1
- package/dist/plugins/grpc-web.d.ts.map +0 -1
- package/dist/plugins/har-player.d.ts.map +0 -1
- package/dist/plugins/har-recorder.d.ts.map +0 -1
- package/dist/plugins/hls.d.ts.map +0 -1
- package/dist/plugins/http2-push.d.ts.map +0 -1
- package/dist/plugins/http3.d.ts.map +0 -1
- package/dist/plugins/interface-rotator.d.ts.map +0 -1
- package/dist/plugins/jsonrpc.d.ts.map +0 -1
- package/dist/plugins/logger.d.ts.map +0 -1
- package/dist/plugins/odata.d.ts.map +0 -1
- package/dist/plugins/pagination.d.ts.map +0 -1
- package/dist/plugins/proxy-rotator.d.ts.map +0 -1
- package/dist/plugins/retry.d.ts.map +0 -1
- package/dist/plugins/scrape.d.ts.map +0 -1
- package/dist/plugins/server-timing.d.ts.map +0 -1
- package/dist/plugins/soap.d.ts.map +0 -1
- package/dist/plugins/user-agent.d.ts.map +0 -1
- package/dist/plugins/xml.d.ts.map +0 -1
- package/dist/plugins/xsrf.d.ts.map +0 -1
- package/dist/presets/anthropic.d.ts.map +0 -1
- package/dist/presets/aws.d.ts.map +0 -1
- package/dist/presets/azure-openai.d.ts.map +0 -1
- package/dist/presets/azure.d.ts.map +0 -1
- package/dist/presets/cloudflare.d.ts.map +0 -1
- package/dist/presets/cohere.d.ts.map +0 -1
- package/dist/presets/deepseek.d.ts.map +0 -1
- package/dist/presets/digitalocean.d.ts.map +0 -1
- package/dist/presets/discord.d.ts.map +0 -1
- package/dist/presets/fireworks.d.ts.map +0 -1
- package/dist/presets/gcp.d.ts.map +0 -1
- package/dist/presets/gemini.d.ts.map +0 -1
- package/dist/presets/github.d.ts.map +0 -1
- package/dist/presets/gitlab.d.ts.map +0 -1
- package/dist/presets/groq.d.ts.map +0 -1
- package/dist/presets/huggingface.d.ts.map +0 -1
- package/dist/presets/index.d.ts.map +0 -1
- package/dist/presets/linear.d.ts.map +0 -1
- package/dist/presets/mailgun.d.ts.map +0 -1
- package/dist/presets/meta.d.ts.map +0 -1
- package/dist/presets/mistral.d.ts.map +0 -1
- package/dist/presets/notion.d.ts.map +0 -1
- package/dist/presets/openai.d.ts.map +0 -1
- package/dist/presets/oracle.d.ts.map +0 -1
- package/dist/presets/perplexity.d.ts.map +0 -1
- package/dist/presets/registry.d.ts.map +0 -1
- package/dist/presets/replicate.d.ts.map +0 -1
- package/dist/presets/sinch.d.ts.map +0 -1
- package/dist/presets/slack.d.ts.map +0 -1
- package/dist/presets/stripe.d.ts.map +0 -1
- package/dist/presets/supabase.d.ts.map +0 -1
- package/dist/presets/tiktok.d.ts.map +0 -1
- package/dist/presets/together.d.ts.map +0 -1
- package/dist/presets/twilio.d.ts.map +0 -1
- package/dist/presets/vercel.d.ts.map +0 -1
- package/dist/presets/vultr.d.ts.map +0 -1
- package/dist/presets/xai.d.ts.map +0 -1
- package/dist/presets/youtube.d.ts.map +0 -1
- package/dist/protocols/ftp.d.ts.map +0 -1
- package/dist/protocols/index.d.ts.map +0 -1
- package/dist/protocols/sftp.d.ts.map +0 -1
- package/dist/protocols/telnet.d.ts.map +0 -1
- package/dist/recker.d.ts.map +0 -1
- package/dist/runner/request-runner.d.ts.map +0 -1
- package/dist/scrape/document.d.ts.map +0 -1
- package/dist/scrape/element.d.ts.map +0 -1
- package/dist/scrape/extractors.d.ts.map +0 -1
- package/dist/scrape/index.d.ts.map +0 -1
- package/dist/scrape/types.d.ts.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/mock-udp-server.d.ts.map +0 -1
- package/dist/testing/mock.d.ts.map +0 -1
- package/dist/transport/base-udp.d.ts.map +0 -1
- package/dist/transport/fetch.d.ts.map +0 -1
- package/dist/transport/udp-response.d.ts.map +0 -1
- package/dist/transport/udp.d.ts.map +0 -1
- package/dist/transport/undici.d.ts.map +0 -1
- package/dist/types/ai.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/udp.d.ts.map +0 -1
- package/dist/udp/index.d.ts.map +0 -1
- package/dist/utils/agent-manager.d.ts.map +0 -1
- package/dist/utils/body.d.ts.map +0 -1
- package/dist/utils/cert.d.ts.map +0 -1
- package/dist/utils/charset.d.ts.map +0 -1
- package/dist/utils/chart.d.ts.map +0 -1
- package/dist/utils/client-pool.d.ts.map +0 -1
- package/dist/utils/colors.d.ts.map +0 -1
- package/dist/utils/concurrency.d.ts.map +0 -1
- package/dist/utils/dns-toolkit.d.ts.map +0 -1
- package/dist/utils/dns.d.ts.map +0 -1
- package/dist/utils/doh.d.ts.map +0 -1
- package/dist/utils/download.d.ts.map +0 -1
- package/dist/utils/env-proxy.d.ts.map +0 -1
- package/dist/utils/header-parser.d.ts.map +0 -1
- package/dist/utils/html-cleaner.d.ts.map +0 -1
- package/dist/utils/link-header.d.ts.map +0 -1
- package/dist/utils/optional-require.d.ts.map +0 -1
- package/dist/utils/progress.d.ts.map +0 -1
- package/dist/utils/rdap.d.ts.map +0 -1
- package/dist/utils/request-pool.d.ts.map +0 -1
- package/dist/utils/security-grader.d.ts.map +0 -1
- package/dist/utils/sparkline.d.ts.map +0 -1
- package/dist/utils/sse.d.ts.map +0 -1
- package/dist/utils/streaming.d.ts.map +0 -1
- package/dist/utils/system-metrics.d.ts.map +0 -1
- package/dist/utils/tls-inspector.d.ts.map +0 -1
- package/dist/utils/try-fn.d.ts.map +0 -1
- package/dist/utils/upload.d.ts.map +0 -1
- package/dist/utils/user-agent.d.ts.map +0 -1
- package/dist/utils/whois.d.ts.map +0 -1
- package/dist/webrtc/index.d.ts.map +0 -1
- package/dist/websocket/client.d.ts.map +0 -1
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
const DEFAULT_VARIANTS = [
|
|
3
|
+
{ name: '360p', bandwidth: 800_000, resolution: '640x360', codecs: 'avc1.4d401e,mp4a.40.2' },
|
|
4
|
+
{ name: '480p', bandwidth: 1_400_000, resolution: '854x480', codecs: 'avc1.4d401e,mp4a.40.2' },
|
|
5
|
+
{ name: '720p', bandwidth: 2_800_000, resolution: '1280x720', codecs: 'avc1.4d401f,mp4a.40.2' },
|
|
6
|
+
{ name: '1080p', bandwidth: 5_000_000, resolution: '1920x1080', codecs: 'avc1.640028,mp4a.40.2' },
|
|
7
|
+
];
|
|
8
|
+
export class MockHlsServer extends EventEmitter {
|
|
9
|
+
options;
|
|
10
|
+
segments = new Map();
|
|
11
|
+
currentSequence;
|
|
12
|
+
ended = false;
|
|
13
|
+
started = false;
|
|
14
|
+
realtimeInterval = null;
|
|
15
|
+
startTime = 0;
|
|
16
|
+
stats = {
|
|
17
|
+
playlistRequests: 0,
|
|
18
|
+
segmentRequests: 0,
|
|
19
|
+
segmentsServed: 0,
|
|
20
|
+
bytesServed: 0,
|
|
21
|
+
requestLog: [],
|
|
22
|
+
};
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
super();
|
|
25
|
+
const segmentDuration = options.segmentDuration ?? 6;
|
|
26
|
+
this.options = {
|
|
27
|
+
mode: 'vod',
|
|
28
|
+
segmentDuration,
|
|
29
|
+
segmentCount: 10,
|
|
30
|
+
windowSize: 3,
|
|
31
|
+
startSequence: 0,
|
|
32
|
+
realtime: false,
|
|
33
|
+
segmentInterval: segmentDuration * 1000,
|
|
34
|
+
multiQuality: false,
|
|
35
|
+
variants: options.variants ?? DEFAULT_VARIANTS,
|
|
36
|
+
encrypted: false,
|
|
37
|
+
baseUrl: 'http://mock-hls-server',
|
|
38
|
+
delay: 0,
|
|
39
|
+
segmentDataGenerator: options.segmentDataGenerator ?? this.defaultSegmentGenerator.bind(this),
|
|
40
|
+
...options,
|
|
41
|
+
};
|
|
42
|
+
this.currentSequence = this.options.startSequence;
|
|
43
|
+
}
|
|
44
|
+
get isRunning() {
|
|
45
|
+
return this.started && !this.ended;
|
|
46
|
+
}
|
|
47
|
+
get isEnded() {
|
|
48
|
+
return this.ended;
|
|
49
|
+
}
|
|
50
|
+
get manifestUrl() {
|
|
51
|
+
return this.options.multiQuality
|
|
52
|
+
? `${this.options.baseUrl}/master.m3u8`
|
|
53
|
+
: `${this.options.baseUrl}/playlist.m3u8`;
|
|
54
|
+
}
|
|
55
|
+
get segmentCount() {
|
|
56
|
+
const variantKey = this.options.multiQuality ? this.options.variants[0].name : 'default';
|
|
57
|
+
return this.segments.get(variantKey)?.length ?? 0;
|
|
58
|
+
}
|
|
59
|
+
get statistics() {
|
|
60
|
+
return { ...this.stats };
|
|
61
|
+
}
|
|
62
|
+
get transport() {
|
|
63
|
+
return {
|
|
64
|
+
dispatch: async (req) => this.handleRequest(req),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async start() {
|
|
68
|
+
if (this.started) {
|
|
69
|
+
throw new Error('Server already started');
|
|
70
|
+
}
|
|
71
|
+
this.started = true;
|
|
72
|
+
this.startTime = Date.now();
|
|
73
|
+
if (this.options.mode === 'vod') {
|
|
74
|
+
this.initializeVodSegments();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.initializeLiveSegments();
|
|
78
|
+
if (this.options.realtime) {
|
|
79
|
+
this.startRealtimeSegmentGeneration();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.emit('start');
|
|
83
|
+
}
|
|
84
|
+
async stop() {
|
|
85
|
+
if (!this.started)
|
|
86
|
+
return;
|
|
87
|
+
if (this.realtimeInterval) {
|
|
88
|
+
clearInterval(this.realtimeInterval);
|
|
89
|
+
this.realtimeInterval = null;
|
|
90
|
+
}
|
|
91
|
+
this.started = false;
|
|
92
|
+
this.emit('stop');
|
|
93
|
+
}
|
|
94
|
+
endStream() {
|
|
95
|
+
if (this.options.mode === 'vod')
|
|
96
|
+
return;
|
|
97
|
+
this.ended = true;
|
|
98
|
+
if (this.realtimeInterval) {
|
|
99
|
+
clearInterval(this.realtimeInterval);
|
|
100
|
+
this.realtimeInterval = null;
|
|
101
|
+
}
|
|
102
|
+
this.emit('ended');
|
|
103
|
+
}
|
|
104
|
+
reset() {
|
|
105
|
+
this.segments.clear();
|
|
106
|
+
this.currentSequence = this.options.startSequence;
|
|
107
|
+
this.ended = false;
|
|
108
|
+
this.stats = {
|
|
109
|
+
playlistRequests: 0,
|
|
110
|
+
segmentRequests: 0,
|
|
111
|
+
segmentsServed: 0,
|
|
112
|
+
bytesServed: 0,
|
|
113
|
+
requestLog: [],
|
|
114
|
+
};
|
|
115
|
+
if (this.started) {
|
|
116
|
+
if (this.options.mode === 'vod') {
|
|
117
|
+
this.initializeVodSegments();
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
this.initializeLiveSegments();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.emit('reset');
|
|
124
|
+
}
|
|
125
|
+
addSegment(variant = 'default', options = {}) {
|
|
126
|
+
const variantSegments = this.segments.get(variant) ?? [];
|
|
127
|
+
const segment = {
|
|
128
|
+
sequence: this.currentSequence,
|
|
129
|
+
duration: this.options.segmentDuration,
|
|
130
|
+
data: options.data ?? this.options.segmentDataGenerator(this.currentSequence, variant),
|
|
131
|
+
addedAt: Date.now(),
|
|
132
|
+
programDateTime: options.programDateTime,
|
|
133
|
+
discontinuity: options.discontinuity,
|
|
134
|
+
...options,
|
|
135
|
+
};
|
|
136
|
+
variantSegments.push(segment);
|
|
137
|
+
this.segments.set(variant, variantSegments);
|
|
138
|
+
this.currentSequence++;
|
|
139
|
+
if (this.options.mode === 'live' && variantSegments.length > this.options.windowSize) {
|
|
140
|
+
variantSegments.shift();
|
|
141
|
+
}
|
|
142
|
+
this.emit('segment', segment, variant);
|
|
143
|
+
return segment;
|
|
144
|
+
}
|
|
145
|
+
addDiscontinuity(variant = 'default') {
|
|
146
|
+
this.addSegment(variant, { discontinuity: true });
|
|
147
|
+
}
|
|
148
|
+
getSegments(variant = 'default') {
|
|
149
|
+
return [...(this.segments.get(variant) ?? [])];
|
|
150
|
+
}
|
|
151
|
+
async handleRequest(req) {
|
|
152
|
+
const url = req.url;
|
|
153
|
+
this.stats.requestLog.push({ url, timestamp: Date.now() });
|
|
154
|
+
if (this.options.delay > 0) {
|
|
155
|
+
await new Promise((resolve) => setTimeout(resolve, this.options.delay));
|
|
156
|
+
}
|
|
157
|
+
if (url.includes('master.m3u8')) {
|
|
158
|
+
return this.handleMasterPlaylist();
|
|
159
|
+
}
|
|
160
|
+
if (url.includes('.m3u8')) {
|
|
161
|
+
return this.handleMediaPlaylist(url);
|
|
162
|
+
}
|
|
163
|
+
if (url.includes('.ts')) {
|
|
164
|
+
return this.handleSegment(url);
|
|
165
|
+
}
|
|
166
|
+
if (url.includes('.key')) {
|
|
167
|
+
return this.handleKey();
|
|
168
|
+
}
|
|
169
|
+
throw new Error(`Unknown request: ${url}`);
|
|
170
|
+
}
|
|
171
|
+
handleMasterPlaylist() {
|
|
172
|
+
this.stats.playlistRequests++;
|
|
173
|
+
const lines = ['#EXTM3U', '#EXT-X-VERSION:3'];
|
|
174
|
+
for (const variant of this.options.variants) {
|
|
175
|
+
const attrs = [
|
|
176
|
+
`BANDWIDTH=${variant.bandwidth}`,
|
|
177
|
+
variant.resolution ? `RESOLUTION=${variant.resolution}` : null,
|
|
178
|
+
variant.codecs ? `CODECS="${variant.codecs}"` : null,
|
|
179
|
+
`NAME="${variant.name}"`,
|
|
180
|
+
]
|
|
181
|
+
.filter(Boolean)
|
|
182
|
+
.join(',');
|
|
183
|
+
lines.push(`#EXT-X-STREAM-INF:${attrs}`);
|
|
184
|
+
lines.push(`${variant.name}/playlist.m3u8`);
|
|
185
|
+
}
|
|
186
|
+
const body = lines.join('\n');
|
|
187
|
+
return this.createResponse(body, 'application/vnd.apple.mpegurl');
|
|
188
|
+
}
|
|
189
|
+
handleMediaPlaylist(url) {
|
|
190
|
+
this.stats.playlistRequests++;
|
|
191
|
+
let variant = 'default';
|
|
192
|
+
if (this.options.multiQuality) {
|
|
193
|
+
const match = url.match(/\/(\w+)\/playlist\.m3u8/);
|
|
194
|
+
variant = match?.[1] ?? this.options.variants[0].name;
|
|
195
|
+
}
|
|
196
|
+
if (this.options.mode === 'live' && !this.options.realtime && !this.ended) {
|
|
197
|
+
this.addSegmentToAllVariants();
|
|
198
|
+
}
|
|
199
|
+
const segments = this.segments.get(variant) ?? [];
|
|
200
|
+
const lines = [
|
|
201
|
+
'#EXTM3U',
|
|
202
|
+
'#EXT-X-VERSION:3',
|
|
203
|
+
`#EXT-X-TARGETDURATION:${Math.ceil(this.options.segmentDuration)}`,
|
|
204
|
+
];
|
|
205
|
+
if (this.options.mode !== 'vod') {
|
|
206
|
+
const mediaSequence = segments.length > 0 ? segments[0].sequence : 0;
|
|
207
|
+
lines.push(`#EXT-X-MEDIA-SEQUENCE:${mediaSequence}`);
|
|
208
|
+
}
|
|
209
|
+
if (this.options.mode === 'event') {
|
|
210
|
+
lines.push('#EXT-X-PLAYLIST-TYPE:EVENT');
|
|
211
|
+
}
|
|
212
|
+
else if (this.options.mode === 'vod') {
|
|
213
|
+
lines.push('#EXT-X-PLAYLIST-TYPE:VOD');
|
|
214
|
+
}
|
|
215
|
+
if (this.options.encrypted) {
|
|
216
|
+
lines.push(`#EXT-X-KEY:METHOD=AES-128,URI="${this.options.baseUrl}/key.key",IV=0x00000000000000000000000000000001`);
|
|
217
|
+
}
|
|
218
|
+
for (const segment of segments) {
|
|
219
|
+
if (segment.discontinuity) {
|
|
220
|
+
lines.push('#EXT-X-DISCONTINUITY');
|
|
221
|
+
}
|
|
222
|
+
if (segment.programDateTime) {
|
|
223
|
+
lines.push(`#EXT-X-PROGRAM-DATE-TIME:${segment.programDateTime.toISOString()}`);
|
|
224
|
+
}
|
|
225
|
+
lines.push(`#EXTINF:${segment.duration.toFixed(3)},`);
|
|
226
|
+
const segmentPath = this.options.multiQuality
|
|
227
|
+
? `${variant}/segment${segment.sequence}.ts`
|
|
228
|
+
: `segment${segment.sequence}.ts`;
|
|
229
|
+
lines.push(segmentPath);
|
|
230
|
+
}
|
|
231
|
+
if (this.options.mode === 'vod' || this.ended) {
|
|
232
|
+
lines.push('#EXT-X-ENDLIST');
|
|
233
|
+
}
|
|
234
|
+
const body = lines.join('\n');
|
|
235
|
+
return this.createResponse(body, 'application/vnd.apple.mpegurl');
|
|
236
|
+
}
|
|
237
|
+
handleSegment(url) {
|
|
238
|
+
this.stats.segmentRequests++;
|
|
239
|
+
const urlPath = url.replace(/^https?:\/\/[^/]+/, '');
|
|
240
|
+
const match = urlPath.match(/(?:\/(\w+))?\/segment(\d+)\.ts/);
|
|
241
|
+
if (!match) {
|
|
242
|
+
return this.createResponse('Not Found', 'text/plain', 404);
|
|
243
|
+
}
|
|
244
|
+
const variant = match[1] ?? 'default';
|
|
245
|
+
const sequence = parseInt(match[2], 10);
|
|
246
|
+
const segments = this.segments.get(variant) ?? [];
|
|
247
|
+
const segment = segments.find((s) => s.sequence === sequence);
|
|
248
|
+
if (!segment) {
|
|
249
|
+
return this.createResponse('Not Found', 'text/plain', 404);
|
|
250
|
+
}
|
|
251
|
+
this.stats.segmentsServed++;
|
|
252
|
+
this.stats.bytesServed += segment.data.byteLength;
|
|
253
|
+
this.emit('segmentServed', segment, variant);
|
|
254
|
+
return this.createResponse(segment.data, 'video/mp2t');
|
|
255
|
+
}
|
|
256
|
+
handleKey() {
|
|
257
|
+
const key = new Uint8Array(16);
|
|
258
|
+
for (let i = 0; i < 16; i++) {
|
|
259
|
+
key[i] = i;
|
|
260
|
+
}
|
|
261
|
+
return this.createResponse(key, 'application/octet-stream');
|
|
262
|
+
}
|
|
263
|
+
createResponse(body, contentType, status = 200) {
|
|
264
|
+
const isText = typeof body === 'string';
|
|
265
|
+
const blobData = isText ? body : new Uint8Array(body);
|
|
266
|
+
return {
|
|
267
|
+
ok: status >= 200 && status < 300,
|
|
268
|
+
status,
|
|
269
|
+
text: async () => (isText ? body : new TextDecoder().decode(body)),
|
|
270
|
+
blob: async () => new Blob([blobData]),
|
|
271
|
+
arrayBuffer: async () => (isText ? new TextEncoder().encode(body).buffer : body.buffer),
|
|
272
|
+
headers: new Headers({
|
|
273
|
+
'content-type': contentType,
|
|
274
|
+
'content-length': String(isText ? body.length : body.byteLength),
|
|
275
|
+
}),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
initializeVodSegments() {
|
|
279
|
+
const variants = this.options.multiQuality
|
|
280
|
+
? this.options.variants.map((v) => v.name)
|
|
281
|
+
: ['default'];
|
|
282
|
+
for (const variant of variants) {
|
|
283
|
+
this.segments.set(variant, []);
|
|
284
|
+
for (let i = 0; i < this.options.segmentCount; i++) {
|
|
285
|
+
const segment = {
|
|
286
|
+
sequence: this.currentSequence,
|
|
287
|
+
duration: this.options.segmentDuration,
|
|
288
|
+
data: this.options.segmentDataGenerator(this.currentSequence, variant),
|
|
289
|
+
addedAt: Date.now(),
|
|
290
|
+
};
|
|
291
|
+
this.segments.get(variant).push(segment);
|
|
292
|
+
this.currentSequence++;
|
|
293
|
+
}
|
|
294
|
+
if (this.options.multiQuality) {
|
|
295
|
+
this.currentSequence = this.options.startSequence;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
this.currentSequence = this.options.startSequence + this.options.segmentCount;
|
|
299
|
+
}
|
|
300
|
+
initializeLiveSegments() {
|
|
301
|
+
const variants = this.options.multiQuality
|
|
302
|
+
? this.options.variants.map((v) => v.name)
|
|
303
|
+
: ['default'];
|
|
304
|
+
for (const variant of variants) {
|
|
305
|
+
this.segments.set(variant, []);
|
|
306
|
+
for (let i = 0; i < this.options.windowSize; i++) {
|
|
307
|
+
const segment = {
|
|
308
|
+
sequence: this.currentSequence + i,
|
|
309
|
+
duration: this.options.segmentDuration,
|
|
310
|
+
data: this.options.segmentDataGenerator(this.currentSequence + i, variant),
|
|
311
|
+
addedAt: Date.now(),
|
|
312
|
+
};
|
|
313
|
+
this.segments.get(variant).push(segment);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
this.currentSequence += this.options.windowSize;
|
|
317
|
+
}
|
|
318
|
+
addSegmentToAllVariants() {
|
|
319
|
+
const variants = this.options.multiQuality
|
|
320
|
+
? this.options.variants.map((v) => v.name)
|
|
321
|
+
: ['default'];
|
|
322
|
+
for (const variant of variants) {
|
|
323
|
+
const variantSegments = this.segments.get(variant) ?? [];
|
|
324
|
+
const segment = {
|
|
325
|
+
sequence: this.currentSequence,
|
|
326
|
+
duration: this.options.segmentDuration,
|
|
327
|
+
data: this.options.segmentDataGenerator(this.currentSequence, variant),
|
|
328
|
+
addedAt: Date.now(),
|
|
329
|
+
};
|
|
330
|
+
variantSegments.push(segment);
|
|
331
|
+
if (this.options.mode === 'live' && variantSegments.length > this.options.windowSize) {
|
|
332
|
+
variantSegments.shift();
|
|
333
|
+
}
|
|
334
|
+
this.segments.set(variant, variantSegments);
|
|
335
|
+
this.emit('segment', segment, variant);
|
|
336
|
+
}
|
|
337
|
+
this.currentSequence++;
|
|
338
|
+
}
|
|
339
|
+
startRealtimeSegmentGeneration() {
|
|
340
|
+
this.realtimeInterval = setInterval(() => {
|
|
341
|
+
if (this.ended)
|
|
342
|
+
return;
|
|
343
|
+
this.addSegmentToAllVariants();
|
|
344
|
+
}, this.options.segmentInterval);
|
|
345
|
+
}
|
|
346
|
+
defaultSegmentGenerator(sequence, _variant) {
|
|
347
|
+
const size = 1024 + (sequence % 512);
|
|
348
|
+
const data = new Uint8Array(size);
|
|
349
|
+
for (let i = 0; i < size; i++) {
|
|
350
|
+
data[i] = (sequence * 17 + i * 13) % 256;
|
|
351
|
+
}
|
|
352
|
+
return data;
|
|
353
|
+
}
|
|
354
|
+
static async create(options = {}) {
|
|
355
|
+
const server = new MockHlsServer(options);
|
|
356
|
+
await server.start();
|
|
357
|
+
return server;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
export async function createMockHlsVod(segmentCount = 10, options = {}) {
|
|
361
|
+
return MockHlsServer.create({
|
|
362
|
+
mode: 'vod',
|
|
363
|
+
segmentCount,
|
|
364
|
+
...options,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
export async function createMockHlsLive(options = {}) {
|
|
368
|
+
return MockHlsServer.create({
|
|
369
|
+
mode: 'live',
|
|
370
|
+
realtime: true,
|
|
371
|
+
segmentDuration: 2,
|
|
372
|
+
windowSize: 3,
|
|
373
|
+
...options,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
export async function createMockHlsMultiQuality(options = {}) {
|
|
377
|
+
return MockHlsServer.create({
|
|
378
|
+
multiQuality: true,
|
|
379
|
+
...options,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { type IncomingMessage } from 'node:http';
|
|
3
|
+
export interface MockHttpServerOptions {
|
|
4
|
+
port?: number;
|
|
5
|
+
host?: string;
|
|
6
|
+
defaultResponse?: MockHttpResponse;
|
|
7
|
+
delay?: number;
|
|
8
|
+
cors?: boolean;
|
|
9
|
+
corsOrigin?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MockHttpResponse {
|
|
12
|
+
status?: number;
|
|
13
|
+
body?: any;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
delay?: number;
|
|
16
|
+
drop?: boolean;
|
|
17
|
+
stream?: {
|
|
18
|
+
chunks: (string | Buffer)[];
|
|
19
|
+
interval: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface MockHttpRequest {
|
|
23
|
+
method: string;
|
|
24
|
+
path: string;
|
|
25
|
+
query: Record<string, string>;
|
|
26
|
+
headers: Record<string, string | string[] | undefined>;
|
|
27
|
+
body: any;
|
|
28
|
+
raw: IncomingMessage;
|
|
29
|
+
}
|
|
30
|
+
export type MockHttpHandler = (req: MockHttpRequest) => MockHttpResponse | Promise<MockHttpResponse>;
|
|
31
|
+
export interface MockHttpStats {
|
|
32
|
+
totalRequests: number;
|
|
33
|
+
requestsByMethod: Record<string, number>;
|
|
34
|
+
requestsByPath: Record<string, number>;
|
|
35
|
+
requestLog: Array<{
|
|
36
|
+
method: string;
|
|
37
|
+
path: string;
|
|
38
|
+
status: number;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
duration: number;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export declare class MockHttpServer extends EventEmitter {
|
|
44
|
+
private options;
|
|
45
|
+
private httpServer;
|
|
46
|
+
private routes;
|
|
47
|
+
private _port;
|
|
48
|
+
private _started;
|
|
49
|
+
private stats;
|
|
50
|
+
constructor(options?: MockHttpServerOptions);
|
|
51
|
+
get port(): number;
|
|
52
|
+
get address(): string;
|
|
53
|
+
get url(): string;
|
|
54
|
+
get isRunning(): boolean;
|
|
55
|
+
get statistics(): MockHttpStats;
|
|
56
|
+
get routeCount(): number;
|
|
57
|
+
start(): Promise<void>;
|
|
58
|
+
stop(): Promise<void>;
|
|
59
|
+
reset(): void;
|
|
60
|
+
route(method: string, path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
61
|
+
times?: number;
|
|
62
|
+
}): this;
|
|
63
|
+
get(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
64
|
+
times?: number;
|
|
65
|
+
}): this;
|
|
66
|
+
post(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
67
|
+
times?: number;
|
|
68
|
+
}): this;
|
|
69
|
+
put(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
70
|
+
times?: number;
|
|
71
|
+
}): this;
|
|
72
|
+
patch(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
73
|
+
times?: number;
|
|
74
|
+
}): this;
|
|
75
|
+
delete(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
76
|
+
times?: number;
|
|
77
|
+
}): this;
|
|
78
|
+
head(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
79
|
+
times?: number;
|
|
80
|
+
}): this;
|
|
81
|
+
optionsRoute(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
82
|
+
times?: number;
|
|
83
|
+
}): this;
|
|
84
|
+
any(path: string, handler: MockHttpResponse | MockHttpHandler, options?: {
|
|
85
|
+
times?: number;
|
|
86
|
+
}): this;
|
|
87
|
+
removeRoute(method: string, path: string): boolean;
|
|
88
|
+
clearRoutes(): void;
|
|
89
|
+
private handleRequest;
|
|
90
|
+
private findRoute;
|
|
91
|
+
private sendResponse;
|
|
92
|
+
private sendCorsHeaders;
|
|
93
|
+
private parseBody;
|
|
94
|
+
private pathToRegex;
|
|
95
|
+
waitForRequests(count: number, timeout?: number): Promise<void>;
|
|
96
|
+
getCallCount(method: string, path: string): number;
|
|
97
|
+
static create(options?: MockHttpServerOptions): Promise<MockHttpServer>;
|
|
98
|
+
}
|
|
99
|
+
export declare function createMockHttpServer(routes?: Record<string, MockHttpResponse>, options?: MockHttpServerOptions): Promise<MockHttpServer>;
|