recker 1.0.43 → 1.0.44
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 +47 -0
- package/dist/bin/recker-linux-x64 +0 -0
- package/dist/bin/recker-macos-x64 +0 -0
- package/dist/bin/recker-win-x64.exe +0 -0
- package/dist/bin/rek.cjs +85152 -100207
- package/dist/browser/ai/adaptive-timeout.d.ts +50 -0
- package/dist/browser/ai/adaptive-timeout.js +208 -0
- package/dist/browser/ai/client.d.ts +22 -0
- package/dist/browser/ai/client.js +294 -0
- package/dist/browser/ai/index.d.ts +14 -0
- package/dist/browser/ai/index.js +11 -0
- package/dist/browser/ai/providers/anthropic.d.ts +63 -0
- package/dist/browser/ai/providers/anthropic.js +370 -0
- package/dist/browser/ai/providers/base.d.ts +48 -0
- package/dist/browser/ai/providers/base.js +150 -0
- package/dist/browser/ai/providers/google.d.ts +59 -0
- package/dist/browser/ai/providers/google.js +305 -0
- package/dist/browser/ai/providers/ollama.d.ts +44 -0
- package/dist/browser/ai/providers/ollama.js +240 -0
- package/dist/browser/ai/providers/openai.d.ts +64 -0
- package/dist/browser/ai/providers/openai.js +298 -0
- package/dist/browser/ai/rate-limiter.d.ts +43 -0
- package/dist/browser/ai/rate-limiter.js +215 -0
- package/dist/browser/ai/vector/index.d.ts +2 -0
- package/dist/browser/ai/vector/index.js +2 -0
- package/dist/browser/ai/vector/similarity.d.ts +2 -0
- package/dist/browser/ai/vector/similarity.js +27 -0
- package/dist/browser/ai/vector/store.d.ts +27 -0
- package/dist/browser/ai/vector/store.js +82 -0
- package/dist/browser/browser/cache.d.ts +2 -40
- package/dist/browser/browser/cache.js +2 -199
- package/dist/browser/browser/index.d.ts +8 -0
- package/dist/browser/browser/index.js +8 -0
- package/dist/browser/browser/recker.d.ts +8 -1
- package/dist/browser/browser/recker.js +8 -2
- package/dist/browser/cache/indexed-db.d.ts +10 -0
- package/dist/browser/cache/indexed-db.js +88 -0
- package/dist/browser/cache/service-worker-cache.d.ts +18 -0
- package/dist/browser/cache/service-worker-cache.js +103 -0
- package/dist/browser/cache.d.ts +2 -40
- package/dist/browser/cache.js +2 -199
- package/dist/browser/constants/user-agents.d.ts +7 -0
- package/dist/browser/constants/user-agents.js +7 -0
- package/dist/browser/core/client.d.ts +2 -0
- package/dist/browser/core/client.js +19 -1
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/index.js +8 -0
- package/dist/browser/plugins/har-recorder.d.ts +40 -0
- package/dist/browser/plugins/har-recorder.js +120 -0
- package/dist/browser/plugins/network-simulation.d.ts +7 -0
- package/dist/browser/plugins/network-simulation.js +13 -0
- package/dist/browser/presets/android.d.ts +2 -0
- package/dist/browser/presets/android.js +16 -0
- package/dist/browser/presets/anthropic.d.ts +8 -0
- package/dist/browser/presets/anthropic.js +27 -0
- package/dist/browser/presets/aws.d.ts +19 -0
- package/dist/browser/presets/aws.js +68 -0
- package/dist/browser/presets/azure-openai.d.ts +10 -0
- package/dist/browser/presets/azure-openai.js +35 -0
- package/dist/browser/presets/azure.d.ts +41 -0
- package/dist/browser/presets/azure.js +104 -0
- package/dist/browser/presets/chaturbate.d.ts +2 -0
- package/dist/browser/presets/chaturbate.js +17 -0
- package/dist/browser/presets/cloudflare.d.ts +12 -0
- package/dist/browser/presets/cloudflare.js +39 -0
- package/dist/browser/presets/cohere.d.ts +7 -0
- package/dist/browser/presets/cohere.js +22 -0
- package/dist/browser/presets/deepseek.d.ts +7 -0
- package/dist/browser/presets/deepseek.js +22 -0
- package/dist/browser/presets/digitalocean.d.ts +5 -0
- package/dist/browser/presets/digitalocean.js +16 -0
- package/dist/browser/presets/discord.d.ts +6 -0
- package/dist/browser/presets/discord.js +17 -0
- package/dist/browser/presets/elevenlabs.d.ts +6 -0
- package/dist/browser/presets/elevenlabs.js +20 -0
- package/dist/browser/presets/enhancers.d.ts +20 -0
- package/dist/browser/presets/enhancers.js +85 -0
- package/dist/browser/presets/fireworks.d.ts +7 -0
- package/dist/browser/presets/fireworks.js +22 -0
- package/dist/browser/presets/gcp.d.ts +34 -0
- package/dist/browser/presets/gcp.js +91 -0
- package/dist/browser/presets/gemini.d.ts +7 -0
- package/dist/browser/presets/gemini.js +23 -0
- package/dist/browser/presets/github.d.ts +6 -0
- package/dist/browser/presets/github.js +17 -0
- package/dist/browser/presets/gitlab.d.ts +6 -0
- package/dist/browser/presets/gitlab.js +16 -0
- package/dist/browser/presets/groq.d.ts +7 -0
- package/dist/browser/presets/groq.js +22 -0
- package/dist/browser/presets/hubspot.d.ts +9 -0
- package/dist/browser/presets/hubspot.js +28 -0
- package/dist/browser/presets/huggingface.d.ts +7 -0
- package/dist/browser/presets/huggingface.js +23 -0
- package/dist/browser/presets/index.d.ts +47 -0
- package/dist/browser/presets/index.js +47 -0
- package/dist/browser/presets/ios.d.ts +2 -0
- package/dist/browser/presets/ios.js +13 -0
- package/dist/browser/presets/linear.d.ts +5 -0
- package/dist/browser/presets/linear.js +16 -0
- package/dist/browser/presets/mailgun.d.ts +7 -0
- package/dist/browser/presets/mailgun.js +20 -0
- package/dist/browser/presets/meta.d.ts +10 -0
- package/dist/browser/presets/meta.js +33 -0
- package/dist/browser/presets/mistral.d.ts +7 -0
- package/dist/browser/presets/mistral.js +22 -0
- package/dist/browser/presets/notion.d.ts +6 -0
- package/dist/browser/presets/notion.js +17 -0
- package/dist/browser/presets/openai.d.ts +9 -0
- package/dist/browser/presets/openai.js +30 -0
- package/dist/browser/presets/oracle.d.ts +19 -0
- package/dist/browser/presets/oracle.js +117 -0
- package/dist/browser/presets/perplexity.d.ts +7 -0
- package/dist/browser/presets/perplexity.js +22 -0
- package/dist/browser/presets/pinecone.d.ts +8 -0
- package/dist/browser/presets/pinecone.js +42 -0
- package/dist/browser/presets/registry.d.ts +23 -0
- package/dist/browser/presets/registry.js +519 -0
- package/dist/browser/presets/replicate.d.ts +7 -0
- package/dist/browser/presets/replicate.js +23 -0
- package/dist/browser/presets/sendgrid.d.ts +6 -0
- package/dist/browser/presets/sendgrid.js +20 -0
- package/dist/browser/presets/sentry.d.ts +11 -0
- package/dist/browser/presets/sentry.js +48 -0
- package/dist/browser/presets/sinch.d.ts +9 -0
- package/dist/browser/presets/sinch.js +39 -0
- package/dist/browser/presets/slack.d.ts +5 -0
- package/dist/browser/presets/slack.js +16 -0
- package/dist/browser/presets/square.d.ts +10 -0
- package/dist/browser/presets/square.js +33 -0
- package/dist/browser/presets/stripe.d.ts +7 -0
- package/dist/browser/presets/stripe.js +23 -0
- package/dist/browser/presets/supabase.d.ts +6 -0
- package/dist/browser/presets/supabase.js +18 -0
- package/dist/browser/presets/tiktok.d.ts +10 -0
- package/dist/browser/presets/tiktok.js +38 -0
- package/dist/browser/presets/together.d.ts +7 -0
- package/dist/browser/presets/together.js +22 -0
- package/dist/browser/presets/twilio.d.ts +6 -0
- package/dist/browser/presets/twilio.js +17 -0
- package/dist/browser/presets/vercel.d.ts +6 -0
- package/dist/browser/presets/vercel.js +23 -0
- package/dist/browser/presets/vultr.d.ts +5 -0
- package/dist/browser/presets/vultr.js +16 -0
- package/dist/browser/presets/xai.d.ts +8 -0
- package/dist/browser/presets/xai.js +23 -0
- package/dist/browser/presets/youtube.d.ts +5 -0
- package/dist/browser/presets/youtube.js +20 -0
- package/dist/browser/recker.d.ts +8 -1
- package/dist/browser/recker.js +8 -2
- package/dist/browser/scrape/document.d.ts +5 -4
- package/dist/browser/scrape/document.js +89 -76
- package/dist/browser/scrape/element.d.ts +10 -8
- package/dist/browser/scrape/element.js +295 -81
- package/dist/browser/scrape/extractors.d.ts +11 -11
- package/dist/browser/scrape/extractors.js +145 -113
- package/dist/browser/scrape/parser/back.d.ts +1 -0
- package/dist/browser/scrape/parser/back.js +3 -0
- package/dist/browser/scrape/parser/index.d.ts +20 -0
- package/dist/browser/scrape/parser/index.js +19 -0
- package/dist/browser/scrape/parser/matcher.d.ts +30 -0
- package/dist/browser/scrape/parser/matcher.js +99 -0
- package/dist/browser/scrape/parser/nodes/comment.d.ts +12 -0
- package/dist/browser/scrape/parser/nodes/comment.js +21 -0
- package/dist/browser/scrape/parser/nodes/html.d.ts +110 -0
- package/dist/browser/scrape/parser/nodes/html.js +978 -0
- package/dist/browser/scrape/parser/nodes/node.d.ts +18 -0
- package/dist/browser/scrape/parser/nodes/node.js +31 -0
- package/dist/browser/scrape/parser/nodes/text.d.ts +14 -0
- package/dist/browser/scrape/parser/nodes/text.js +30 -0
- package/dist/browser/scrape/parser/nodes/type.d.ts +6 -0
- package/dist/browser/scrape/parser/nodes/type.js +7 -0
- package/dist/browser/scrape/parser/parse.d.ts +1 -0
- package/dist/browser/scrape/parser/parse.js +1 -0
- package/dist/browser/scrape/parser/valid.d.ts +2 -0
- package/dist/browser/scrape/parser/valid.js +5 -0
- package/dist/browser/scrape/parser/void-tag.d.ts +7 -0
- package/dist/browser/scrape/parser/void-tag.js +43 -0
- package/dist/browser/scrape/types.d.ts +7 -0
- package/dist/browser/seo/analyzer.d.ts +59 -0
- package/dist/browser/seo/analyzer.js +1399 -0
- package/dist/browser/seo/keywords.d.ts +16 -0
- package/dist/browser/seo/keywords.js +55 -0
- package/dist/browser/seo/rules/accessibility.d.ts +2 -0
- package/dist/browser/seo/rules/accessibility.js +733 -0
- package/dist/browser/seo/rules/ai-search.d.ts +2 -0
- package/dist/browser/seo/rules/ai-search.js +436 -0
- package/dist/browser/seo/rules/analytics.d.ts +2 -0
- package/dist/browser/seo/rules/analytics.js +306 -0
- package/dist/browser/seo/rules/best-practices.d.ts +2 -0
- package/dist/browser/seo/rules/best-practices.js +195 -0
- package/dist/browser/seo/rules/canonical.d.ts +12 -0
- package/dist/browser/seo/rules/canonical.js +270 -0
- package/dist/browser/seo/rules/content.d.ts +2 -0
- package/dist/browser/seo/rules/content.js +522 -0
- package/dist/browser/seo/rules/crawl.d.ts +2 -0
- package/dist/browser/seo/rules/crawl.js +435 -0
- package/dist/browser/seo/rules/cwv.d.ts +2 -0
- package/dist/browser/seo/rules/cwv.js +248 -0
- package/dist/browser/seo/rules/ecommerce.d.ts +2 -0
- package/dist/browser/seo/rules/ecommerce.js +312 -0
- package/dist/browser/seo/rules/i18n.d.ts +2 -0
- package/dist/browser/seo/rules/i18n.js +288 -0
- package/dist/browser/seo/rules/images.d.ts +2 -0
- package/dist/browser/seo/rules/images.js +255 -0
- package/dist/browser/seo/rules/index.d.ts +52 -0
- package/dist/browser/seo/rules/index.js +159 -0
- package/dist/browser/seo/rules/internal-linking.d.ts +2 -0
- package/dist/browser/seo/rules/internal-linking.js +394 -0
- package/dist/browser/seo/rules/links.d.ts +2 -0
- package/dist/browser/seo/rules/links.js +498 -0
- package/dist/browser/seo/rules/local.d.ts +2 -0
- package/dist/browser/seo/rules/local.js +289 -0
- package/dist/browser/seo/rules/meta.d.ts +2 -0
- package/dist/browser/seo/rules/meta.js +805 -0
- package/dist/browser/seo/rules/mobile.d.ts +2 -0
- package/dist/browser/seo/rules/mobile.js +161 -0
- package/dist/browser/seo/rules/performance.d.ts +2 -0
- package/dist/browser/seo/rules/performance.js +738 -0
- package/dist/browser/seo/rules/pwa.d.ts +2 -0
- package/dist/browser/seo/rules/pwa.js +299 -0
- package/dist/browser/seo/rules/readability.d.ts +2 -0
- package/dist/browser/seo/rules/readability.js +264 -0
- package/dist/browser/seo/rules/redirects.d.ts +16 -0
- package/dist/browser/seo/rules/redirects.js +199 -0
- package/dist/browser/seo/rules/resources.d.ts +2 -0
- package/dist/browser/seo/rules/resources.js +390 -0
- package/dist/browser/seo/rules/schema.d.ts +2 -0
- package/dist/browser/seo/rules/schema.js +379 -0
- package/dist/browser/seo/rules/security.d.ts +2 -0
- package/dist/browser/seo/rules/security.js +877 -0
- package/dist/browser/seo/rules/social.d.ts +2 -0
- package/dist/browser/seo/rules/social.js +603 -0
- package/dist/browser/seo/rules/structural.d.ts +2 -0
- package/dist/browser/seo/rules/structural.js +223 -0
- package/dist/browser/seo/rules/technical-advanced.d.ts +10 -0
- package/dist/browser/seo/rules/technical-advanced.js +289 -0
- package/dist/browser/seo/rules/technical.d.ts +2 -0
- package/dist/browser/seo/rules/technical.js +480 -0
- package/dist/browser/seo/rules/thresholds.d.ts +196 -0
- package/dist/browser/seo/rules/thresholds.js +118 -0
- package/dist/browser/seo/rules/types.d.ts +498 -0
- package/dist/browser/seo/rules/types.js +11 -0
- package/dist/browser/seo/types.d.ts +211 -0
- package/dist/browser/seo/types.js +1 -0
- package/dist/browser/transport/curl.d.ts +4 -0
- package/dist/browser/transport/curl.js +101 -0
- package/dist/browser/transport/undici.js +1 -2
- package/dist/browser/transport/worker.d.ts +18 -0
- package/dist/browser/transport/worker.js +278 -0
- package/dist/browser/types/index.d.ts +4 -1
- package/dist/browser/utils/binary-manager.d.ts +4 -0
- package/dist/browser/utils/binary-manager.js +72 -0
- package/dist/browser/utils/user-agent.js +2 -13
- package/dist/cache/indexed-db.d.ts +10 -0
- package/dist/cache/indexed-db.js +88 -0
- package/dist/cache/service-worker-cache.d.ts +18 -0
- package/dist/cache/service-worker-cache.js +103 -0
- package/dist/cli/commands/ai.d.ts +2 -0
- package/dist/cli/commands/ai.js +162 -0
- package/dist/cli/commands/bench.d.ts +2 -0
- package/dist/cli/commands/bench.js +51 -0
- package/dist/cli/commands/dns.d.ts +2 -0
- package/dist/cli/commands/dns.js +295 -0
- package/dist/cli/commands/har.d.ts +2 -0
- package/dist/cli/commands/har.js +171 -0
- package/dist/cli/commands/hls.d.ts +2 -0
- package/dist/cli/commands/hls.js +192 -0
- package/dist/cli/commands/network.d.ts +2 -0
- package/dist/cli/commands/network.js +288 -0
- package/dist/cli/commands/protocols.d.ts +2 -0
- package/dist/cli/commands/protocols.js +344 -0
- package/dist/cli/commands/scrape.d.ts +2 -0
- package/dist/cli/commands/scrape.js +176 -0
- package/dist/cli/commands/security.d.ts +2 -0
- package/dist/cli/commands/security.js +57 -0
- package/dist/cli/commands/seo.d.ts +2 -0
- package/dist/cli/commands/seo.js +125 -0
- package/dist/cli/commands/serve.d.ts +2 -0
- package/dist/cli/commands/serve.js +531 -0
- package/dist/cli/commands/spider.d.ts +3 -0
- package/dist/cli/commands/spider.js +456 -0
- package/dist/cli/commands/utils.d.ts +2 -0
- package/dist/cli/commands/utils.js +176 -0
- package/dist/cli/commands/vector.d.ts +2 -0
- package/dist/cli/commands/vector.js +158 -0
- package/dist/cli/handler.d.ts +2 -2
- package/dist/cli/handler.js +6 -6
- package/dist/cli/helpers.d.ts +7 -0
- package/dist/cli/helpers.js +128 -0
- package/dist/cli/index.js +96 -5228
- package/dist/cli/parser/help.d.ts +2 -0
- package/dist/cli/parser/help.js +52 -0
- package/dist/cli/parser/index.d.ts +3 -0
- package/dist/cli/parser/index.js +3 -0
- package/dist/cli/parser/parser.d.ts +4 -0
- package/dist/cli/parser/parser.js +146 -0
- package/dist/cli/parser/types.d.ts +41 -0
- package/dist/cli/parser/types.js +1 -0
- package/dist/cli/presets.d.ts +1 -1
- package/dist/cli/presets.js +1 -1
- package/dist/cli/router.d.ts +36 -0
- package/dist/cli/router.js +195 -0
- package/dist/cli/tui/ai-chat.js +1 -1
- package/dist/cli/tui/commands/context.d.ts +9 -0
- package/dist/cli/tui/commands/context.js +1 -0
- package/dist/cli/tui/commands/dns.d.ts +10 -0
- package/dist/cli/tui/commands/dns.js +461 -0
- package/dist/cli/tui/commands/hls.d.ts +2 -0
- package/dist/cli/tui/commands/hls.js +162 -0
- package/dist/cli/tui/commands/ip.d.ts +2 -0
- package/dist/cli/tui/commands/ip.js +45 -0
- package/dist/cli/tui/commands/network.d.ts +3 -0
- package/dist/cli/tui/commands/network.js +81 -0
- package/dist/cli/tui/commands/protocols.d.ts +6 -0
- package/dist/cli/tui/commands/protocols.js +531 -0
- package/dist/cli/tui/commands/security.d.ts +2 -0
- package/dist/cli/tui/commands/security.js +48 -0
- package/dist/cli/tui/commands/seo.d.ts +2 -0
- package/dist/cli/tui/commands/seo.js +74 -0
- package/dist/cli/tui/context.d.ts +12 -0
- package/dist/cli/tui/context.js +1 -0
- package/dist/cli/tui/shell.d.ts +11 -20
- package/dist/cli/tui/shell.js +216 -1873
- package/dist/constants/user-agents.d.ts +7 -0
- package/dist/constants/user-agents.js +7 -0
- package/dist/core/client.d.ts +2 -0
- package/dist/core/client.js +19 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/cli.js +2 -3
- package/dist/mcp/data/embeddings.json +1 -1
- package/dist/mcp/tools/network.js +298 -158
- package/dist/plugins/har-player.d.ts +23 -0
- package/dist/plugins/har-player.js +49 -0
- package/dist/plugins/har-recorder.d.ts +37 -3
- package/dist/plugins/har-recorder.js +116 -63
- package/dist/plugins/network-simulation.d.ts +7 -0
- package/dist/plugins/network-simulation.js +13 -0
- package/dist/presets/android.d.ts +2 -0
- package/dist/presets/android.js +16 -0
- package/dist/presets/chaturbate.d.ts +2 -0
- package/dist/presets/chaturbate.js +17 -0
- package/dist/presets/elevenlabs.d.ts +6 -0
- package/dist/presets/elevenlabs.js +20 -0
- package/dist/presets/enhancers.d.ts +20 -0
- package/dist/presets/enhancers.js +85 -0
- package/dist/presets/hubspot.d.ts +9 -0
- package/dist/presets/hubspot.js +28 -0
- package/dist/presets/index.d.ts +10 -0
- package/dist/presets/index.js +10 -0
- package/dist/presets/ios.d.ts +2 -0
- package/dist/presets/ios.js +13 -0
- package/dist/presets/pinecone.d.ts +8 -0
- package/dist/presets/pinecone.js +42 -0
- package/dist/presets/registry.js +60 -0
- package/dist/presets/sendgrid.d.ts +6 -0
- package/dist/presets/sendgrid.js +20 -0
- package/dist/presets/sentry.d.ts +11 -0
- package/dist/presets/sentry.js +48 -0
- package/dist/presets/square.d.ts +10 -0
- package/dist/presets/square.js +33 -0
- package/dist/recker.d.ts +3 -0
- package/dist/recker.js +4 -0
- package/dist/scrape/document.d.ts +5 -4
- package/dist/scrape/document.js +89 -76
- package/dist/scrape/element.d.ts +10 -8
- package/dist/scrape/element.js +295 -81
- package/dist/scrape/extractors.d.ts +11 -11
- package/dist/scrape/extractors.js +145 -113
- package/dist/scrape/index.d.ts +2 -0
- package/dist/scrape/index.js +1 -0
- package/dist/scrape/parser/back.d.ts +1 -0
- package/dist/scrape/parser/back.js +3 -0
- package/dist/scrape/parser/index.d.ts +20 -0
- package/dist/scrape/parser/index.js +19 -0
- package/dist/scrape/parser/matcher.d.ts +30 -0
- package/dist/scrape/parser/matcher.js +99 -0
- package/dist/scrape/parser/nodes/comment.d.ts +12 -0
- package/dist/scrape/parser/nodes/comment.js +21 -0
- package/dist/scrape/parser/nodes/html.d.ts +110 -0
- package/dist/scrape/parser/nodes/html.js +978 -0
- package/dist/scrape/parser/nodes/node.d.ts +18 -0
- package/dist/scrape/parser/nodes/node.js +31 -0
- package/dist/scrape/parser/nodes/text.d.ts +14 -0
- package/dist/scrape/parser/nodes/text.js +30 -0
- package/dist/scrape/parser/nodes/type.d.ts +6 -0
- package/dist/scrape/parser/nodes/type.js +7 -0
- package/dist/scrape/parser/parse.d.ts +1 -0
- package/dist/scrape/parser/parse.js +1 -0
- package/dist/scrape/parser/valid.d.ts +2 -0
- package/dist/scrape/parser/valid.js +5 -0
- package/dist/scrape/parser/void-tag.d.ts +7 -0
- package/dist/scrape/parser/void-tag.js +43 -0
- package/dist/scrape/spider.d.ts +19 -0
- package/dist/scrape/spider.js +28 -3
- package/dist/scrape/types.d.ts +7 -0
- package/dist/seo/analyzer.d.ts +15 -5
- package/dist/seo/analyzer.js +636 -175
- package/dist/seo/formatter.d.ts +16 -0
- package/dist/seo/formatter.js +228 -0
- package/dist/seo/index.d.ts +2 -0
- package/dist/seo/index.js +1 -0
- package/dist/seo/keywords.d.ts +16 -0
- package/dist/seo/keywords.js +55 -0
- package/dist/seo/rules/accessibility.js +96 -57
- package/dist/seo/rules/ai-search.js +44 -31
- package/dist/seo/rules/analytics.d.ts +2 -0
- package/dist/seo/rules/analytics.js +306 -0
- package/dist/seo/rules/best-practices.js +21 -14
- package/dist/seo/rules/canonical.js +53 -32
- package/dist/seo/rules/content.js +317 -31
- package/dist/seo/rules/crawl.js +55 -40
- package/dist/seo/rules/cwv.js +21 -15
- package/dist/seo/rules/ecommerce.js +82 -22
- package/dist/seo/rules/i18n.js +75 -36
- package/dist/seo/rules/images.js +109 -30
- package/dist/seo/rules/index.js +2 -0
- package/dist/seo/rules/internal-linking.js +58 -39
- package/dist/seo/rules/links.js +79 -52
- package/dist/seo/rules/local.js +49 -25
- package/dist/seo/rules/meta.js +339 -81
- package/dist/seo/rules/mobile.js +112 -2
- package/dist/seo/rules/performance.js +434 -66
- package/dist/seo/rules/pwa.js +36 -39
- package/dist/seo/rules/readability.js +31 -22
- package/dist/seo/rules/redirects.js +21 -15
- package/dist/seo/rules/resources.js +59 -42
- package/dist/seo/rules/schema.js +333 -8
- package/dist/seo/rules/security.js +142 -80
- package/dist/seo/rules/social.js +277 -47
- package/dist/seo/rules/structural.js +87 -19
- package/dist/seo/rules/technical-advanced.js +30 -24
- package/dist/seo/rules/technical.js +243 -42
- package/dist/seo/rules/types.d.ts +53 -1
- package/dist/seo/seo-spider.d.ts +22 -0
- package/dist/seo/seo-spider.js +77 -13
- package/dist/seo/types.d.ts +8 -1
- package/dist/seo/validators/llms-txt.js +19 -0
- package/dist/seo/validators/rss.d.ts +11 -0
- package/dist/seo/validators/rss.js +93 -0
- package/dist/seo/validators/sitemap.js +36 -26
- package/dist/transport/curl.d.ts +4 -0
- package/dist/transport/curl.js +101 -0
- package/dist/transport/udp.js +0 -1
- package/dist/transport/undici.js +1 -2
- package/dist/transport/worker.d.ts +18 -0
- package/dist/transport/worker.js +278 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/utils/binary-manager.d.ts +4 -0
- package/dist/utils/binary-manager.js +72 -0
- package/dist/utils/optional-require.d.ts +7 -8
- package/dist/utils/optional-require.js +2 -21
- package/dist/utils/upload.d.ts +6 -0
- package/dist/utils/upload.js +11 -0
- package/dist/utils/user-agent.js +2 -13
- package/dist/version.js +1 -1
- package/package.json +12 -6
- package/dist/browser/utils/optional-require.d.ts +0 -19
- package/dist/browser/utils/optional-require.js +0 -105
package/dist/browser/cache.d.ts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
value: T;
|
|
4
|
-
createdAt: number;
|
|
5
|
-
expiresAt?: number;
|
|
6
|
-
etag?: string;
|
|
7
|
-
lastModified?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface BrowserCacheOptions {
|
|
10
|
-
dbName?: string;
|
|
11
|
-
storeName?: string;
|
|
12
|
-
defaultTTL?: number;
|
|
13
|
-
maxEntries?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class IndexedDBStorage {
|
|
16
|
-
private dbName;
|
|
17
|
-
private storeName;
|
|
18
|
-
private defaultTTL;
|
|
19
|
-
private maxEntries;
|
|
20
|
-
private db;
|
|
21
|
-
private initPromise;
|
|
22
|
-
constructor(options?: BrowserCacheOptions);
|
|
23
|
-
init(): Promise<void>;
|
|
24
|
-
get<T = unknown>(key: string): Promise<CacheEntry<T> | null>;
|
|
25
|
-
set<T = unknown>(key: string, value: T, ttl?: number, metadata?: {
|
|
26
|
-
etag?: string;
|
|
27
|
-
lastModified?: string;
|
|
28
|
-
}): Promise<void>;
|
|
29
|
-
delete(key: string): Promise<boolean>;
|
|
30
|
-
has(key: string): Promise<boolean>;
|
|
31
|
-
clear(): Promise<void>;
|
|
32
|
-
keys(): Promise<string[]>;
|
|
33
|
-
size(): Promise<number>;
|
|
34
|
-
cleanup(): Promise<number>;
|
|
35
|
-
private enforceMaxEntries;
|
|
36
|
-
close(): void;
|
|
37
|
-
destroy(): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
export declare function isIndexedDBAvailable(): boolean;
|
|
40
|
-
export declare function getBrowserCacheStorage(options?: BrowserCacheOptions): IndexedDBStorage | null;
|
|
1
|
+
export { IndexedDBStorage } from '../cache/indexed-db.js';
|
|
2
|
+
export { ServiceWorkerCache } from '../cache/service-worker-cache.js';
|
package/dist/browser/cache.js
CHANGED
|
@@ -1,199 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
storeName;
|
|
4
|
-
defaultTTL;
|
|
5
|
-
maxEntries;
|
|
6
|
-
db = null;
|
|
7
|
-
initPromise = null;
|
|
8
|
-
constructor(options = {}) {
|
|
9
|
-
this.dbName = options.dbName ?? 'recker-cache';
|
|
10
|
-
this.storeName = options.storeName ?? 'responses';
|
|
11
|
-
this.defaultTTL = options.defaultTTL ?? 5 * 60 * 1000;
|
|
12
|
-
this.maxEntries = options.maxEntries ?? 1000;
|
|
13
|
-
}
|
|
14
|
-
async init() {
|
|
15
|
-
if (this.db)
|
|
16
|
-
return;
|
|
17
|
-
if (this.initPromise)
|
|
18
|
-
return this.initPromise;
|
|
19
|
-
this.initPromise = new Promise((resolve, reject) => {
|
|
20
|
-
const request = indexedDB.open(this.dbName, 1);
|
|
21
|
-
request.onerror = () => {
|
|
22
|
-
reject(new Error(`Failed to open IndexedDB: ${request.error?.message}`));
|
|
23
|
-
};
|
|
24
|
-
request.onsuccess = () => {
|
|
25
|
-
this.db = request.result;
|
|
26
|
-
resolve();
|
|
27
|
-
};
|
|
28
|
-
request.onupgradeneeded = (event) => {
|
|
29
|
-
const db = event.target.result;
|
|
30
|
-
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
31
|
-
const store = db.createObjectStore(this.storeName, { keyPath: 'key' });
|
|
32
|
-
store.createIndex('expiresAt', 'expiresAt', { unique: false });
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
return this.initPromise;
|
|
37
|
-
}
|
|
38
|
-
async get(key) {
|
|
39
|
-
await this.init();
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
const transaction = this.db.transaction(this.storeName, 'readonly');
|
|
42
|
-
const store = transaction.objectStore(this.storeName);
|
|
43
|
-
const request = store.get(key);
|
|
44
|
-
request.onerror = () => reject(request.error);
|
|
45
|
-
request.onsuccess = () => {
|
|
46
|
-
const entry = request.result;
|
|
47
|
-
if (!entry) {
|
|
48
|
-
resolve(null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (entry.expiresAt && entry.expiresAt < Date.now()) {
|
|
52
|
-
this.delete(key).catch(() => { });
|
|
53
|
-
resolve(null);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
resolve(entry);
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
async set(key, value, ttl, metadata) {
|
|
61
|
-
await this.init();
|
|
62
|
-
const entry = {
|
|
63
|
-
key,
|
|
64
|
-
value,
|
|
65
|
-
createdAt: Date.now(),
|
|
66
|
-
expiresAt: ttl !== undefined ? Date.now() + ttl : undefined,
|
|
67
|
-
etag: metadata?.etag,
|
|
68
|
-
lastModified: metadata?.lastModified,
|
|
69
|
-
};
|
|
70
|
-
return new Promise((resolve, reject) => {
|
|
71
|
-
const transaction = this.db.transaction(this.storeName, 'readwrite');
|
|
72
|
-
const store = transaction.objectStore(this.storeName);
|
|
73
|
-
const request = store.put(entry);
|
|
74
|
-
request.onerror = () => reject(request.error);
|
|
75
|
-
request.onsuccess = () => resolve();
|
|
76
|
-
transaction.oncomplete = () => {
|
|
77
|
-
this.enforceMaxEntries().catch(() => { });
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async delete(key) {
|
|
82
|
-
await this.init();
|
|
83
|
-
return new Promise((resolve, reject) => {
|
|
84
|
-
const transaction = this.db.transaction(this.storeName, 'readwrite');
|
|
85
|
-
const store = transaction.objectStore(this.storeName);
|
|
86
|
-
const request = store.delete(key);
|
|
87
|
-
request.onerror = () => reject(request.error);
|
|
88
|
-
request.onsuccess = () => resolve(true);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async has(key) {
|
|
92
|
-
const entry = await this.get(key);
|
|
93
|
-
return entry !== null;
|
|
94
|
-
}
|
|
95
|
-
async clear() {
|
|
96
|
-
await this.init();
|
|
97
|
-
return new Promise((resolve, reject) => {
|
|
98
|
-
const transaction = this.db.transaction(this.storeName, 'readwrite');
|
|
99
|
-
const store = transaction.objectStore(this.storeName);
|
|
100
|
-
const request = store.clear();
|
|
101
|
-
request.onerror = () => reject(request.error);
|
|
102
|
-
request.onsuccess = () => resolve();
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
async keys() {
|
|
106
|
-
await this.init();
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
const transaction = this.db.transaction(this.storeName, 'readonly');
|
|
109
|
-
const store = transaction.objectStore(this.storeName);
|
|
110
|
-
const request = store.getAllKeys();
|
|
111
|
-
request.onerror = () => reject(request.error);
|
|
112
|
-
request.onsuccess = () => resolve(request.result);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
async size() {
|
|
116
|
-
await this.init();
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
const transaction = this.db.transaction(this.storeName, 'readonly');
|
|
119
|
-
const store = transaction.objectStore(this.storeName);
|
|
120
|
-
const request = store.count();
|
|
121
|
-
request.onerror = () => reject(request.error);
|
|
122
|
-
request.onsuccess = () => resolve(request.result);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
async cleanup() {
|
|
126
|
-
await this.init();
|
|
127
|
-
const now = Date.now();
|
|
128
|
-
let removed = 0;
|
|
129
|
-
return new Promise((resolve, reject) => {
|
|
130
|
-
const transaction = this.db.transaction(this.storeName, 'readwrite');
|
|
131
|
-
const store = transaction.objectStore(this.storeName);
|
|
132
|
-
const index = store.index('expiresAt');
|
|
133
|
-
const range = IDBKeyRange.upperBound(now);
|
|
134
|
-
const request = index.openCursor(range);
|
|
135
|
-
request.onerror = () => reject(request.error);
|
|
136
|
-
request.onsuccess = (event) => {
|
|
137
|
-
const cursor = event.target.result;
|
|
138
|
-
if (cursor) {
|
|
139
|
-
cursor.delete();
|
|
140
|
-
removed++;
|
|
141
|
-
cursor.continue();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
transaction.oncomplete = () => resolve(removed);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
async enforceMaxEntries() {
|
|
148
|
-
const currentSize = await this.size();
|
|
149
|
-
if (currentSize <= this.maxEntries)
|
|
150
|
-
return;
|
|
151
|
-
const toRemove = currentSize - this.maxEntries;
|
|
152
|
-
return new Promise((resolve, reject) => {
|
|
153
|
-
const transaction = this.db.transaction(this.storeName, 'readwrite');
|
|
154
|
-
const store = transaction.objectStore(this.storeName);
|
|
155
|
-
const index = store.index('expiresAt');
|
|
156
|
-
let removed = 0;
|
|
157
|
-
const request = index.openCursor();
|
|
158
|
-
request.onerror = () => reject(request.error);
|
|
159
|
-
request.onsuccess = (event) => {
|
|
160
|
-
const cursor = event.target.result;
|
|
161
|
-
if (cursor && removed < toRemove) {
|
|
162
|
-
cursor.delete();
|
|
163
|
-
removed++;
|
|
164
|
-
cursor.continue();
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
transaction.oncomplete = () => resolve();
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
close() {
|
|
171
|
-
if (this.db) {
|
|
172
|
-
this.db.close();
|
|
173
|
-
this.db = null;
|
|
174
|
-
this.initPromise = null;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async destroy() {
|
|
178
|
-
this.close();
|
|
179
|
-
return new Promise((resolve, reject) => {
|
|
180
|
-
const request = indexedDB.deleteDatabase(this.dbName);
|
|
181
|
-
request.onerror = () => reject(request.error);
|
|
182
|
-
request.onsuccess = () => resolve();
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
export function isIndexedDBAvailable() {
|
|
187
|
-
try {
|
|
188
|
-
return typeof indexedDB !== 'undefined' && indexedDB !== null;
|
|
189
|
-
}
|
|
190
|
-
catch {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
export function getBrowserCacheStorage(options) {
|
|
195
|
-
if (isIndexedDBAvailable()) {
|
|
196
|
-
return new IndexedDBStorage(options);
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
1
|
+
export { IndexedDBStorage } from '../cache/indexed-db.js';
|
|
2
|
+
export { ServiceWorkerCache } from '../cache/service-worker-cache.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const USER_AGENTS = {
|
|
2
|
+
ANDROID: 'Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-G973U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36',
|
|
3
|
+
IOS: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Mobile/15E148 Safari/604.1',
|
|
4
|
+
CHROME_WIN: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
5
|
+
CHROME_MAC: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
6
|
+
FIREFOX_MAC: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0'
|
|
7
|
+
};
|
|
@@ -28,6 +28,7 @@ export declare class Client {
|
|
|
28
28
|
private middlewares;
|
|
29
29
|
private hooks;
|
|
30
30
|
private transport;
|
|
31
|
+
private curlTransport?;
|
|
31
32
|
private defaultHeaders;
|
|
32
33
|
private defaultParams;
|
|
33
34
|
private paginationConfig?;
|
|
@@ -49,6 +50,7 @@ export declare class Client {
|
|
|
49
50
|
private setupCookieJar;
|
|
50
51
|
private createCookieMiddleware;
|
|
51
52
|
private splitSetCookieHeader;
|
|
53
|
+
private dispatch;
|
|
52
54
|
private composeMiddlewares;
|
|
53
55
|
private hooksMiddleware;
|
|
54
56
|
private httpErrorMiddleware;
|
|
@@ -2,6 +2,7 @@ import { consoleLogger } from '../types/index.js';
|
|
|
2
2
|
import { ClientAIImpl } from '../ai/client-ai.js';
|
|
3
3
|
import { HttpRequest } from './request.js';
|
|
4
4
|
import { UndiciTransport } from '../transport/undici.js';
|
|
5
|
+
import { CurlTransport } from '../transport/curl.js';
|
|
5
6
|
import { RequestPromise } from './request-promise.js';
|
|
6
7
|
import { HttpError, MaxSizeExceededError, ConfigurationError, ValidationError, TimeoutError } from '../core/errors.js';
|
|
7
8
|
import { processBody, createFormData, isPlainObject } from '../utils/body.js';
|
|
@@ -41,6 +42,7 @@ export class Client {
|
|
|
41
42
|
middlewares;
|
|
42
43
|
hooks;
|
|
43
44
|
transport;
|
|
45
|
+
curlTransport;
|
|
44
46
|
defaultHeaders;
|
|
45
47
|
defaultParams;
|
|
46
48
|
paginationConfig;
|
|
@@ -88,7 +90,14 @@ export class Client {
|
|
|
88
90
|
if (options.transport) {
|
|
89
91
|
this.transport = options.transport;
|
|
90
92
|
}
|
|
93
|
+
else if (options.useCurl) {
|
|
94
|
+
if (this.debugEnabled)
|
|
95
|
+
console.log('[DEBUG] Using Curl Transport');
|
|
96
|
+
this.transport = new CurlTransport();
|
|
97
|
+
}
|
|
91
98
|
else {
|
|
99
|
+
if (this.debugEnabled)
|
|
100
|
+
console.log('[DEBUG] Using Undici Transport');
|
|
92
101
|
let http2Options;
|
|
93
102
|
if (options.http2) {
|
|
94
103
|
if (typeof options.http2 === 'boolean') {
|
|
@@ -281,9 +290,18 @@ export class Client {
|
|
|
281
290
|
splitSetCookieHeader(header) {
|
|
282
291
|
return header.split(/,(?=\s*[a-zA-Z0-9_-]+=)/g).map(s => s.trim());
|
|
283
292
|
}
|
|
293
|
+
async dispatch(req) {
|
|
294
|
+
if (req.useCurl && !(this.transport instanceof CurlTransport)) {
|
|
295
|
+
if (!this.curlTransport) {
|
|
296
|
+
this.curlTransport = new CurlTransport();
|
|
297
|
+
}
|
|
298
|
+
return this.curlTransport.dispatch(req);
|
|
299
|
+
}
|
|
300
|
+
return this.transport.dispatch(req);
|
|
301
|
+
}
|
|
284
302
|
composeMiddlewares() {
|
|
285
303
|
const chain = [...this.middlewares];
|
|
286
|
-
const transportDispatch = this.
|
|
304
|
+
const transportDispatch = this.dispatch.bind(this);
|
|
287
305
|
if (this.hooks.beforeRequest?.length || this.hooks.afterResponse?.length) {
|
|
288
306
|
chain.unshift(this.hooksMiddleware);
|
|
289
307
|
}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from '../core/client.js';
|
|
|
4
4
|
export * from '../core/request.js';
|
|
5
5
|
export * from '../core/response.js';
|
|
6
6
|
export * from '../transport/fetch.js';
|
|
7
|
+
export * from '../transport/worker.js';
|
|
7
8
|
export * from '../plugins/retry.js';
|
|
8
9
|
export * from '../plugins/rate-limit.js';
|
|
9
10
|
export * from '../plugins/dedup.js';
|
|
@@ -18,12 +19,19 @@ export * from '../plugins/jsonrpc.js';
|
|
|
18
19
|
export * from '../plugins/grpc-web.js';
|
|
19
20
|
export * from '../plugins/soap.js';
|
|
20
21
|
export * from '../plugins/odata.js';
|
|
22
|
+
export * from '../plugins/har-recorder.js';
|
|
23
|
+
export * from '../plugins/network-simulation.js';
|
|
21
24
|
export * from '../plugins/auth.js';
|
|
22
25
|
export * from '../cache/memory-storage.js';
|
|
26
|
+
export * from '../cache/indexed-db.js';
|
|
23
27
|
export * from '../utils/body.js';
|
|
24
28
|
export * from '../utils/header-parser.js';
|
|
25
29
|
export * from '../utils/link-header.js';
|
|
30
|
+
export * from '../utils/user-agent.js';
|
|
26
31
|
export * from '../utils/charset.js';
|
|
32
|
+
export * from '../seo/analyzer.js';
|
|
33
|
+
export * as ai from '../ai/index.js';
|
|
34
|
+
export * as presets from '../presets/index.js';
|
|
27
35
|
export * from '../constants/http-status.js';
|
|
28
36
|
export * from './crypto.js';
|
|
29
37
|
export * from './cache.js';
|
package/dist/browser/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from '../core/client.js';
|
|
|
4
4
|
export * from '../core/request.js';
|
|
5
5
|
export * from '../core/response.js';
|
|
6
6
|
export * from '../transport/fetch.js';
|
|
7
|
+
export * from '../transport/worker.js';
|
|
7
8
|
export * from '../plugins/retry.js';
|
|
8
9
|
export * from '../plugins/rate-limit.js';
|
|
9
10
|
export * from '../plugins/dedup.js';
|
|
@@ -18,12 +19,19 @@ export * from '../plugins/jsonrpc.js';
|
|
|
18
19
|
export * from '../plugins/grpc-web.js';
|
|
19
20
|
export * from '../plugins/soap.js';
|
|
20
21
|
export * from '../plugins/odata.js';
|
|
22
|
+
export * from '../plugins/har-recorder.js';
|
|
23
|
+
export * from '../plugins/network-simulation.js';
|
|
21
24
|
export * from '../plugins/auth.js';
|
|
22
25
|
export * from '../cache/memory-storage.js';
|
|
26
|
+
export * from '../cache/indexed-db.js';
|
|
23
27
|
export * from '../utils/body.js';
|
|
24
28
|
export * from '../utils/header-parser.js';
|
|
25
29
|
export * from '../utils/link-header.js';
|
|
30
|
+
export * from '../utils/user-agent.js';
|
|
26
31
|
export * from '../utils/charset.js';
|
|
32
|
+
export * from '../seo/analyzer.js';
|
|
33
|
+
export * as ai from '../ai/index.js';
|
|
34
|
+
export * as presets from '../presets/index.js';
|
|
27
35
|
export * from '../constants/http-status.js';
|
|
28
36
|
export * from './crypto.js';
|
|
29
37
|
export * from './cache.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Plugin } from '../types/index.js';
|
|
2
|
+
interface HarEntry {
|
|
3
|
+
startedDateTime: string;
|
|
4
|
+
time: number;
|
|
5
|
+
request: any;
|
|
6
|
+
response: any;
|
|
7
|
+
timings: any;
|
|
8
|
+
cache: {};
|
|
9
|
+
}
|
|
10
|
+
export declare class HarRecorder {
|
|
11
|
+
private entries;
|
|
12
|
+
private isRecording;
|
|
13
|
+
private onEntry?;
|
|
14
|
+
start(): void;
|
|
15
|
+
stop(): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
getEntries(): HarEntry[];
|
|
18
|
+
setOnEntry(cb: (entry: HarEntry) => void): void;
|
|
19
|
+
generateHar(): {
|
|
20
|
+
log: {
|
|
21
|
+
version: string;
|
|
22
|
+
creator: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
};
|
|
26
|
+
pages: never[];
|
|
27
|
+
entries: HarEntry[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
download(filename?: string): void;
|
|
31
|
+
save(path: string): Promise<void>;
|
|
32
|
+
plugin(): Plugin;
|
|
33
|
+
private mapHeaders;
|
|
34
|
+
}
|
|
35
|
+
export declare const harRecorder: HarRecorder;
|
|
36
|
+
export declare const harRecorderPlugin: (options?: {
|
|
37
|
+
path?: string;
|
|
38
|
+
onEntry?: (entry: any) => void;
|
|
39
|
+
}) => Plugin;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export class HarRecorder {
|
|
2
|
+
entries = [];
|
|
3
|
+
isRecording = false;
|
|
4
|
+
onEntry;
|
|
5
|
+
start() {
|
|
6
|
+
this.isRecording = true;
|
|
7
|
+
this.entries = [];
|
|
8
|
+
}
|
|
9
|
+
stop() {
|
|
10
|
+
this.isRecording = false;
|
|
11
|
+
}
|
|
12
|
+
clear() {
|
|
13
|
+
this.entries = [];
|
|
14
|
+
}
|
|
15
|
+
getEntries() {
|
|
16
|
+
return this.entries;
|
|
17
|
+
}
|
|
18
|
+
setOnEntry(cb) {
|
|
19
|
+
this.onEntry = cb;
|
|
20
|
+
}
|
|
21
|
+
generateHar() {
|
|
22
|
+
return {
|
|
23
|
+
log: {
|
|
24
|
+
version: '1.2',
|
|
25
|
+
creator: { name: 'Recker', version: '1.0.0' },
|
|
26
|
+
pages: [],
|
|
27
|
+
entries: this.entries
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
download(filename = 'recker-session.har') {
|
|
32
|
+
if (typeof Blob === 'undefined' || typeof document === 'undefined') {
|
|
33
|
+
throw new Error('download() is only supported in browser. Use save() in Node.js');
|
|
34
|
+
}
|
|
35
|
+
const har = this.generateHar();
|
|
36
|
+
const blob = new Blob([JSON.stringify(har, null, 2)], { type: 'application/json' });
|
|
37
|
+
const url = URL.createObjectURL(blob);
|
|
38
|
+
const a = document.createElement('a');
|
|
39
|
+
a.href = url;
|
|
40
|
+
a.download = filename;
|
|
41
|
+
document.body.appendChild(a);
|
|
42
|
+
a.click();
|
|
43
|
+
document.body.removeChild(a);
|
|
44
|
+
URL.revokeObjectURL(url);
|
|
45
|
+
}
|
|
46
|
+
async save(path) {
|
|
47
|
+
if (typeof window !== 'undefined') {
|
|
48
|
+
throw new Error('save() is only supported in Node.js. Use download() in browser');
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const fs = await import('node:fs/promises');
|
|
52
|
+
const har = this.generateHar();
|
|
53
|
+
await fs.writeFile(path, JSON.stringify(har, null, 2));
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw new Error(`Failed to save HAR: ${e.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
plugin() {
|
|
60
|
+
return (client) => {
|
|
61
|
+
if (!client.hooks.afterResponse)
|
|
62
|
+
client.hooks.afterResponse = [];
|
|
63
|
+
client.hooks.afterResponse.push(async (req, res) => {
|
|
64
|
+
if (!this.isRecording)
|
|
65
|
+
return;
|
|
66
|
+
const entry = {
|
|
67
|
+
startedDateTime: new Date().toISOString(),
|
|
68
|
+
time: res.timings?.total || 0,
|
|
69
|
+
request: {
|
|
70
|
+
method: req.method,
|
|
71
|
+
url: req.url,
|
|
72
|
+
httpVersion: "HTTP/1.1",
|
|
73
|
+
headers: this.mapHeaders(req.headers),
|
|
74
|
+
queryString: [],
|
|
75
|
+
cookies: [],
|
|
76
|
+
headersSize: -1,
|
|
77
|
+
bodySize: -1,
|
|
78
|
+
},
|
|
79
|
+
response: {
|
|
80
|
+
status: res.status,
|
|
81
|
+
statusText: res.statusText,
|
|
82
|
+
httpVersion: "HTTP/1.1",
|
|
83
|
+
headers: this.mapHeaders(res.headers),
|
|
84
|
+
cookies: [],
|
|
85
|
+
content: {
|
|
86
|
+
size: -1,
|
|
87
|
+
mimeType: res.headers.get('content-type') || '',
|
|
88
|
+
text: "[Body capture disabled]"
|
|
89
|
+
},
|
|
90
|
+
redirectURL: "",
|
|
91
|
+
headersSize: -1,
|
|
92
|
+
bodySize: -1,
|
|
93
|
+
},
|
|
94
|
+
cache: {},
|
|
95
|
+
timings: {
|
|
96
|
+
send: 0,
|
|
97
|
+
wait: res.timings?.firstByte || 0,
|
|
98
|
+
receive: (res.timings?.total || 0) - (res.timings?.firstByte || 0)
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
this.entries.push(entry);
|
|
102
|
+
this.onEntry?.(entry);
|
|
103
|
+
return res;
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
mapHeaders(headers) {
|
|
108
|
+
const arr = [];
|
|
109
|
+
headers.forEach((value, key) => arr.push({ name: key, value }));
|
|
110
|
+
return arr;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export const harRecorder = new HarRecorder();
|
|
114
|
+
export const harRecorderPlugin = (options) => {
|
|
115
|
+
harRecorder.start();
|
|
116
|
+
if (options?.onEntry) {
|
|
117
|
+
harRecorder.setOnEntry(options.onEntry);
|
|
118
|
+
}
|
|
119
|
+
return harRecorder.plugin();
|
|
120
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function simulateNetwork(options) {
|
|
2
|
+
return async (req, next) => {
|
|
3
|
+
if (options.latency && options.latency > 0) {
|
|
4
|
+
await new Promise(resolve => setTimeout(resolve, options.latency));
|
|
5
|
+
}
|
|
6
|
+
if (options.errorRate && options.errorRate > 0) {
|
|
7
|
+
if (Math.random() < options.errorRate) {
|
|
8
|
+
throw new Error(options.errorMessage || 'Simulated Network Error (Packet Loss)');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return next(req);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { USER_AGENTS } from '../constants/user-agents.js';
|
|
2
|
+
export default function android() {
|
|
3
|
+
return {
|
|
4
|
+
headers: {
|
|
5
|
+
'User-Agent': USER_AGENTS.ANDROID,
|
|
6
|
+
'Accept': '*/*',
|
|
7
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
8
|
+
'Sec-CH-UA': '"Google Chrome";v="87", "SamsungBrowser";v="14", "Not;A=Brand";v="99"',
|
|
9
|
+
'Sec-CH-UA-Mobile': '?1',
|
|
10
|
+
'Sec-CH-UA-Platform': '"Android"',
|
|
11
|
+
'Sec-Fetch-Dest': 'empty',
|
|
12
|
+
'Sec-Fetch-Mode': 'cors',
|
|
13
|
+
'Sec-Fetch-Site': 'cross-site'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
import type { ClientOptionsWithAI } from '../types/ai-client.js';
|
|
3
|
+
export interface AnthropicPresetOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function anthropic(options: AnthropicPresetOptions): ClientOptions & ClientOptionsWithAI;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function anthropic(options) {
|
|
2
|
+
const _aiConfig = {
|
|
3
|
+
provider: 'anthropic',
|
|
4
|
+
apiKey: options.apiKey,
|
|
5
|
+
model: options.model ?? 'claude-sonnet-4-5',
|
|
6
|
+
headers: {
|
|
7
|
+
'anthropic-version': options.version || '2023-06-01',
|
|
8
|
+
},
|
|
9
|
+
memory: { maxPairs: 12 },
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
baseUrl: 'https://api.anthropic.com/v1',
|
|
13
|
+
headers: {
|
|
14
|
+
'x-api-key': options.apiKey,
|
|
15
|
+
'anthropic-version': options.version || '2023-06-01',
|
|
16
|
+
'content-type': 'application/json'
|
|
17
|
+
},
|
|
18
|
+
timeout: 10 * 60 * 1000,
|
|
19
|
+
retry: {
|
|
20
|
+
maxAttempts: 5,
|
|
21
|
+
backoff: 'exponential',
|
|
22
|
+
delay: 1000,
|
|
23
|
+
statusCodes: [408, 429, 500, 502, 503, 504]
|
|
24
|
+
},
|
|
25
|
+
_aiConfig,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ClientOptions } from '../types/index.js';
|
|
2
|
+
export interface AWSPresetOptions {
|
|
3
|
+
accessKeyId: string;
|
|
4
|
+
secretAccessKey: string;
|
|
5
|
+
region: string;
|
|
6
|
+
service: AWSService | string;
|
|
7
|
+
sessionToken?: string;
|
|
8
|
+
endpoint?: string;
|
|
9
|
+
}
|
|
10
|
+
export type AWSService = 's3' | 'dynamodb' | 'lambda' | 'sqs' | 'sns' | 'ses' | 'secretsmanager' | 'ssm' | 'sts' | 'iam' | 'ec2' | 'ecs' | 'eks' | 'cloudwatch' | 'logs' | 'events' | 'kinesis' | 'firehose' | 'apigateway' | 'execute-api' | 'cognito-idp' | 'cognito-identity' | 'kms' | 'athena' | 'glue' | 'stepfunctions' | 'states' | 'bedrock' | 'bedrock-runtime';
|
|
11
|
+
export declare function aws(options: AWSPresetOptions): ClientOptions;
|
|
12
|
+
export declare function awsS3(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
13
|
+
export declare function awsDynamoDB(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
14
|
+
export declare function awsLambda(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
15
|
+
export declare function awsSQS(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
16
|
+
export declare function awsSNS(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
17
|
+
export declare function awsSES(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
18
|
+
export declare function awsSecretsManager(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|
|
19
|
+
export declare function awsBedrock(options: Omit<AWSPresetOptions, 'service'>): ClientOptions;
|