@yanglaofish/fishtools 0.5.2 → 0.5.3
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 +23 -11
- package/manual/README.md +23 -11
- package/manual/docs/deployment.md +3 -3
- package/manual/docs/examples/action-plugin/package.json +1 -1
- package/manual/docs/plugin-development.md +15 -4
- package/manual/docs/releases.md +24 -0
- package/manual/docs/superpowers/plans/2026-10-13-command-shortcuts.md +3 -2
- package/manual/docs/superpowers/plans/2026-10-13-global-plugins.md +56 -0
- package/manual/docs/superpowers/plans/2026-10-13-tui-readable-sessions.md +21 -0
- package/manual/docs/superpowers/reviews/2026-10-13-0.5.3-review.md +28 -0
- package/manual/docs/superpowers/reviews/2026-10-13-command-shortcuts-review.md +7 -0
- package/manual/docs/superpowers/reviews/2026-10-13-tui-sessions-review.md +55 -0
- package/manual/docs/superpowers/specs/2026-10-13-issue-4-workflow-menu.md +23 -0
- package/manual/docs/superpowers/specs/2026-10-13-issue-5-results-and-history.md +20 -0
- package/manual/docs/terminal-commands.md +8 -0
- package/manual/docs/verification.md +30 -0
- package/manual/packages/core/README.md +2 -0
- package/manual/packages/core/package.json +1 -1
- package/manual/packages/core/src/application.js +100 -51
- package/manual/packages/core/src/development-watch-worker.js +10 -1
- package/manual/packages/core/src/development.js +1 -1
- package/manual/packages/core/src/plugin-catalog.js +42 -0
- package/manual/packages/core/src/version.js +1 -1
- package/manual/packages/fst-cli/README.md +4 -0
- package/manual/packages/fst-cli/bin/fst.js +7 -6
- package/manual/packages/fst-cli/package.json +1 -1
- package/manual/packages/fst-cli/src/development.js +6 -1
- package/manual/packages/fst-cli/src/terminal/command-menu.js +8 -3
- package/manual/packages/fst-cli/src/terminal/navigation.js +2 -0
- package/manual/packages/fst-cli/src/terminal/presentation.js +4 -3
- package/manual/packages/fst-cli/src/terminal/run-feed.js +69 -13
- package/manual/packages/fst-cli/src/terminal/run-presentation.js +55 -12
- package/manual/packages/fst-cli/src/terminal/run-viewer.js +26 -10
- package/manual/packages/fst-cli/src/terminal/session-history.js +82 -0
- package/manual/packages/fst-cli/src/terminal/session.js +119 -40
- package/manual/packages/fst-cli/src/terminal/view.js +31 -8
- package/manual/packages/fst-cli/src/terminal/workflow-menu.js +14 -9
- package/manual/packages/fst-devtools/package.json +2 -2
- package/manual/packages/fst-devtools/src/plugin-tools.js +1 -1
- package/manual/packages/fst-logs/README.md +23 -2
- package/manual/packages/fst-logs/package.json +2 -1
- package/manual/packages/fst-logs/src/file-identity.js +23 -0
- package/manual/packages/fst-logs/src/markdown-log.js +4 -3
- package/manual/packages/fst-logs/src/run-logs.js +3 -2
- package/manual/packages/fst-logs/src/session-history.js +180 -0
- package/manual/packages/fst-platform/README.md +4 -0
- package/manual/packages/fst-platform/package.json +3 -3
- package/manual/packages/fst-platform/src/process.js +4 -1
- package/manual/packages/fst-platform/src/shell.js +46 -1
- package/manual/packages/fst-plugin/package.json +1 -1
- package/manual/packages/fst-plugin/src/host.js +31 -23
- package/manual/packages/fst-workflow/package.json +1 -1
- package/manual/packages/fst-workflow/src/engine.js +1 -1
- package/manual/packages/fst-workspace/README.md +2 -0
- package/manual/packages/fst-workspace/package.json +2 -1
- package/manual/packages/fst-workspace/src/plugin-registry.js +58 -0
- package/manual/packages/fst-workspace/src/plugins.js +7 -4
- package/manual/packages/fst-workspace/src/workflows.js +5 -3
- package/manual/packages/pack/package.json +3 -3
- package/manual/packages/pack/runtime-cache.js +26 -0
- package/manual/packages/pack/runtime.js +6 -10
- package/manual/plugins/commands/package.json +1 -1
- package/node_modules/@mytools/commands/package.json +1 -1
- package/node_modules/@mytools/core/README.md +2 -0
- package/node_modules/@mytools/core/package.json +1 -1
- package/node_modules/@mytools/core/src/application.js +100 -51
- package/node_modules/@mytools/core/src/development-watch-worker.js +10 -1
- package/node_modules/@mytools/core/src/development.js +1 -1
- package/node_modules/@mytools/core/src/plugin-catalog.js +42 -0
- package/node_modules/@mytools/core/src/version.js +1 -1
- package/node_modules/@mytools/fst-cli/README.md +4 -0
- package/node_modules/@mytools/fst-cli/bin/fst.js +7 -6
- package/node_modules/@mytools/fst-cli/package.json +1 -1
- package/node_modules/@mytools/fst-cli/src/development.js +6 -1
- package/node_modules/@mytools/fst-cli/src/terminal/command-menu.js +8 -3
- package/node_modules/@mytools/fst-cli/src/terminal/navigation.js +2 -0
- package/node_modules/@mytools/fst-cli/src/terminal/presentation.js +4 -3
- package/node_modules/@mytools/fst-cli/src/terminal/run-feed.js +69 -13
- package/node_modules/@mytools/fst-cli/src/terminal/run-presentation.js +55 -12
- package/node_modules/@mytools/fst-cli/src/terminal/run-viewer.js +26 -10
- package/node_modules/@mytools/fst-cli/src/terminal/session-history.js +82 -0
- package/node_modules/@mytools/fst-cli/src/terminal/session.js +119 -40
- package/node_modules/@mytools/fst-cli/src/terminal/view.js +31 -8
- package/node_modules/@mytools/fst-cli/src/terminal/workflow-menu.js +14 -9
- package/node_modules/@mytools/fst-devtools/package.json +2 -2
- package/node_modules/@mytools/fst-devtools/src/plugin-tools.js +1 -1
- package/node_modules/@mytools/fst-logs/README.md +23 -2
- package/node_modules/@mytools/fst-logs/package.json +2 -1
- package/node_modules/@mytools/fst-logs/src/file-identity.js +23 -0
- package/node_modules/@mytools/fst-logs/src/markdown-log.js +4 -3
- package/node_modules/@mytools/fst-logs/src/run-logs.js +3 -2
- package/node_modules/@mytools/fst-logs/src/session-history.js +180 -0
- package/node_modules/@mytools/fst-platform/README.md +4 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/LICENSE +21 -0
- package/node_modules/{undici/docs/docs/index.md → @mytools/fst-platform/node_modules/undici/README.md} +85 -137
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Client.md +288 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Cookies.md +128 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +317 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Dispatcher.md +1393 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/docs/docs/best-practices/crawling.md +1 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/docs/docs/best-practices/undici-vs-builtin-fetch.md +8 -10
- package/node_modules/@mytools/fst-platform/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index-fetch.js +65 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index.d.ts +3 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/index.js +234 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-connect.js +110 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-request.js +214 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-stream.js +209 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/index.js +7 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/api/readable.js +580 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/cache/memory-cache-store.js +3 -3
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/cache/sqlite-cache-store.js +1 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/connect.js +153 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/constants.js +143 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/errors.js +477 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/request.js +485 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/symbols.js +75 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/tree.js +160 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/core/util.js +992 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/agent.js +158 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/balanced-pool.js +221 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client-h1.js +1746 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client-h2.js +1060 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/client.js +668 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/h2c-client.js +4 -4
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/round-robin-pool.js +10 -32
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/dispatcher/socks5-proxy-agent.js +63 -153
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/global.js +59 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/cache-handler.js +7 -49
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/cache-revalidation-handler.js +0 -10
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/handler/deduplication-handler.js +10 -29
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/retry-handler.js +504 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/cache.js +26 -79
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/decompress.js +3 -13
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/interceptor/deduplicate.js +4 -5
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/mock-call-history.js +1 -1
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-agent.js +7 -25
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-recorder.js +3 -38
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/cache.js +10 -92
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/util/promise.js +28 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/runtime-features.js +34 -3
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/util/timers.js +425 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cache/util.js +45 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/parse.js +314 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/cookies/util.js +352 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/eventsource-stream.js +494 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/infra/index.js +1 -16
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/webidl/index.js +21 -7
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/connection.js +339 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/receiver.js +507 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/websocket/stream/websocketerror.js +10 -13
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/websocket/stream/websocketstream.js +14 -29
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/package.json +152 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/scripts/strip-comments.js +10 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/README.md +6 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/agent.d.ts +32 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/api.d.ts +43 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/cache.d.ts +36 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/client.d.ts +139 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/connector.d.ts +36 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/content-type.d.ts +21 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/cookies.d.ts +30 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/dispatcher.d.ts +275 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/errors.d.ts +177 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/eventsource.d.ts +66 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/fetch.d.ts +231 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/formdata.d.ts +114 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/global-origin.d.ts +7 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/h2c-client.d.ts +6 -6
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/handlers.d.ts +14 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/header.d.ts +160 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/index.d.ts +91 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/interceptors.d.ts +82 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-client.d.ts +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/patch.d.ts +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/pool.d.ts +41 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/readable.d.ts +68 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/round-robin-pool.d.ts +2 -0
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/snapshot-agent.d.ts +0 -4
- package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/socks5-proxy-agent.d.ts +2 -4
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/util.d.ts +18 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/webidl.d.ts +347 -0
- package/node_modules/@mytools/fst-platform/node_modules/undici/types/websocket.d.ts +188 -0
- package/node_modules/@mytools/fst-platform/package.json +3 -3
- package/node_modules/@mytools/fst-platform/src/process.js +4 -1
- package/node_modules/@mytools/fst-platform/src/shell.js +46 -1
- package/node_modules/@mytools/fst-plugin/package.json +1 -1
- package/node_modules/@mytools/fst-plugin/src/host.js +31 -23
- package/node_modules/@mytools/fst-workflow/package.json +1 -1
- package/node_modules/@mytools/fst-workflow/src/engine.js +1 -1
- package/node_modules/@mytools/fst-workspace/README.md +2 -0
- package/node_modules/@mytools/fst-workspace/package.json +2 -1
- package/node_modules/@mytools/fst-workspace/src/plugin-registry.js +58 -0
- package/node_modules/@mytools/fst-workspace/src/plugins.js +7 -4
- package/node_modules/@mytools/fst-workspace/src/workflows.js +5 -3
- package/node_modules/@mytools/pack/package.json +3 -3
- package/node_modules/@mytools/pack/runtime-cache.js +26 -0
- package/node_modules/@mytools/pack/runtime.js +6 -10
- package/node_modules/@mytools/web/public/THIRD_PARTY_NOTICES.txt +953 -963
- package/node_modules/@npmcli/agent/lib/agents.js +0 -10
- package/node_modules/@npmcli/agent/package.json +12 -11
- package/node_modules/@npmcli/arborist/README.md +2 -2
- package/node_modules/@npmcli/arborist/bin/index.js +2 -1
- package/node_modules/@npmcli/arborist/bin/shrinkwrap.js +7 -0
- package/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +25 -159
- package/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js +49 -11
- package/node_modules/@npmcli/arborist/lib/arborist/load-actual.js +0 -67
- package/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js +37 -5
- package/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +8 -15
- package/node_modules/@npmcli/arborist/lib/arborist/reify.js +42 -59
- package/node_modules/@npmcli/arborist/lib/consistent-resolve.js +1 -1
- package/node_modules/@npmcli/arborist/lib/diff.js +22 -17
- package/node_modules/@npmcli/arborist/lib/edge.js +2 -22
- package/node_modules/@npmcli/arborist/lib/index.js +0 -2
- package/node_modules/@npmcli/arborist/lib/isolated-classes.js +1 -4
- package/node_modules/@npmcli/arborist/lib/node.js +9 -13
- package/node_modules/@npmcli/arborist/lib/place-dep.js +0 -6
- package/node_modules/@npmcli/arborist/lib/printable.js +5 -0
- package/node_modules/@npmcli/arborist/lib/shrinkwrap.js +32 -55
- package/node_modules/@npmcli/arborist/package.json +26 -32
- package/node_modules/@npmcli/fs/lib/move-file.js +5 -5
- package/node_modules/@npmcli/fs/package.json +5 -5
- package/node_modules/@npmcli/git/package.json +12 -13
- package/node_modules/@npmcli/installed-package-contents/package.json +7 -7
- package/node_modules/@npmcli/map-workspaces/package.json +7 -7
- package/node_modules/@npmcli/metavuln-calculator/package.json +16 -10
- package/node_modules/@npmcli/name-from-folder/package.json +16 -13
- package/node_modules/@npmcli/node-gyp/package.json +5 -5
- package/node_modules/@npmcli/package-json/lib/index.js +1 -2
- package/node_modules/@npmcli/package-json/lib/normalize.js +22 -23
- package/node_modules/@npmcli/package-json/package.json +10 -11
- package/node_modules/@npmcli/promise-spawn/README.md +2 -1
- package/node_modules/@npmcli/promise-spawn/package.json +5 -5
- package/node_modules/@npmcli/redact/package.json +4 -4
- package/node_modules/@npmcli/run-script/lib/is-server-package.js +11 -0
- package/node_modules/@npmcli/run-script/lib/make-spawn-args.js +6 -5
- package/node_modules/@npmcli/run-script/lib/run-script-pkg.js +13 -4
- package/node_modules/@npmcli/run-script/lib/run-script.js +2 -1
- package/node_modules/@npmcli/run-script/package.json +11 -12
- package/node_modules/@sigstore/bundle/README.md +1 -1
- package/node_modules/@sigstore/bundle/dist/error.js +0 -1
- package/node_modules/@sigstore/bundle/package.json +2 -2
- package/node_modules/@sigstore/core/README.md +1 -1
- package/node_modules/@sigstore/core/dist/asn1/length.js +1 -12
- package/node_modules/@sigstore/core/dist/asn1/obj.js +7 -25
- package/node_modules/@sigstore/core/dist/asn1/parse.js +5 -24
- package/node_modules/@sigstore/core/package.json +2 -2
- package/node_modules/@sigstore/sign/README.md +1 -1
- package/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js +1 -1
- package/node_modules/@sigstore/sign/package.json +9 -9
- package/node_modules/@sigstore/tuf/README.md +1 -1
- package/node_modules/@sigstore/tuf/package.json +4 -4
- package/node_modules/@sigstore/tuf/seeds.json +1 -1
- package/node_modules/@sigstore/verify/README.md +1 -1
- package/node_modules/@sigstore/verify/dist/bundle/dsse.d.ts +0 -1
- package/node_modules/@sigstore/verify/dist/bundle/dsse.js +0 -6
- package/node_modules/@sigstore/verify/dist/bundle/message.d.ts +0 -1
- package/node_modules/@sigstore/verify/dist/bundle/message.js +0 -5
- package/node_modules/@sigstore/verify/dist/policy.d.ts +1 -1
- package/node_modules/@sigstore/verify/dist/policy.js +2 -0
- package/node_modules/@sigstore/verify/dist/shared.types.d.ts +1 -6
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.js +3 -17
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js +4 -4
- package/node_modules/@sigstore/verify/dist/tlog/index.js +1 -13
- package/node_modules/@sigstore/verify/dist/tlog/merkle.js +1 -12
- package/node_modules/@sigstore/verify/dist/verifier.js +5 -13
- package/node_modules/@sigstore/verify/package.json +5 -5
- package/node_modules/@tufjs/models/package.json +3 -3
- package/node_modules/abbrev/package.json +8 -9
- package/node_modules/agent-base/dist/helpers.d.ts +5 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -1
- package/node_modules/agent-base/dist/helpers.js +34 -5
- package/node_modules/agent-base/dist/helpers.js.map +1 -1
- package/node_modules/agent-base/dist/index.d.ts +5 -1
- package/node_modules/agent-base/dist/index.d.ts.map +1 -1
- package/node_modules/agent-base/dist/index.js +40 -8
- package/node_modules/agent-base/dist/index.js.map +1 -1
- package/node_modules/agent-base/package.json +12 -12
- package/node_modules/bin-links/README.md +4 -5
- package/node_modules/bin-links/lib/fix-bin.js +1 -3
- package/node_modules/bin-links/lib/index.js +16 -8
- package/node_modules/bin-links/lib/link-mans.js +53 -0
- package/node_modules/bin-links/package.json +12 -11
- package/node_modules/cacache/lib/content/write.js +0 -2
- package/node_modules/cacache/lib/entry-index.js +0 -3
- package/node_modules/cacache/lib/rm.js +0 -1
- package/node_modules/cacache/lib/util/tmp.js +1 -5
- package/node_modules/cacache/lib/verify.js +2 -2
- package/node_modules/cacache/package.json +7 -7
- package/node_modules/cmd-shim/lib/index.js +32 -67
- package/node_modules/cmd-shim/package.json +5 -5
- package/node_modules/hosted-git-info/README.md +1 -1
- package/node_modules/hosted-git-info/lib/parse-url.js +3 -1
- package/node_modules/hosted-git-info/package.json +4 -4
- package/node_modules/http-proxy-agent/dist/index.d.ts +5 -8
- package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/http-proxy-agent/dist/index.js +42 -26
- package/node_modules/http-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/http-proxy-agent/package.json +14 -15
- package/node_modules/https-proxy-agent/dist/index.d.ts +5 -9
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/https-proxy-agent/dist/index.js +44 -98
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +3 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +10 -3
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -1
- package/node_modules/https-proxy-agent/package.json +15 -16
- package/node_modules/ignore-walk/package.json +4 -4
- package/node_modules/ini/package.json +5 -5
- package/node_modules/ip-address/README.md +70 -70
- package/node_modules/ip-address/dist/ipv6.js +7 -4
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +3 -0
- package/node_modules/ip-address/dist/v6/constants.js +3 -0
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +2 -1
- package/node_modules/json-parse-even-better-errors/lib/index.js +1 -3
- package/node_modules/json-parse-even-better-errors/package.json +17 -13
- package/node_modules/make-fetch-happen/package.json +11 -11
- package/node_modules/minipass-fetch/package.json +4 -4
- package/node_modules/node-gyp/.release-please-manifest.json +1 -1
- package/node_modules/node-gyp/CHANGELOG.md +0 -102
- package/node_modules/node-gyp/README.md +2 -3
- package/node_modules/node-gyp/eslint.config.js +1 -4
- package/node_modules/node-gyp/gyp/.release-please-manifest.json +1 -1
- package/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +19 -14
- package/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +2 -7
- package/node_modules/node-gyp/gyp/pyproject.toml +1 -1
- package/node_modules/node-gyp/lib/build.js +6 -18
- package/node_modules/node-gyp/lib/create-config-gypi.js +0 -5
- package/node_modules/node-gyp/lib/node-gyp.js +2 -9
- package/node_modules/node-gyp/lib/rebuild.js +3 -3
- package/node_modules/node-gyp/package.json +9 -11
- package/node_modules/nopt/README.md +4 -2
- package/node_modules/nopt/lib/debug.js +5 -0
- package/node_modules/nopt/lib/nopt-lib.js +43 -7
- package/node_modules/nopt/lib/nopt.js +4 -2
- package/node_modules/nopt/lib/type-defs.js +13 -8
- package/node_modules/nopt/package.json +17 -15
- package/node_modules/npm-bundled/package.json +6 -6
- package/node_modules/npm-install-checks/package.json +5 -5
- package/node_modules/npm-normalize-package-bin/package.json +16 -13
- package/node_modules/npm-package-arg/package.json +7 -7
- package/node_modules/npm-packlist/README.md +30 -45
- package/node_modules/npm-packlist/lib/index.js +47 -115
- package/node_modules/npm-packlist/package.json +8 -10
- package/node_modules/npm-pick-manifest/package.json +19 -15
- package/node_modules/npm-registry-fetch/lib/errors.js +3 -8
- package/node_modules/npm-registry-fetch/package.json +12 -12
- package/node_modules/pacote/lib/dir.js +5 -60
- package/node_modules/pacote/lib/fetcher.js +0 -4
- package/node_modules/pacote/lib/git.js +3 -11
- package/node_modules/pacote/lib/util/add-git-sha.js +1 -1
- package/node_modules/pacote/package.json +18 -19
- package/node_modules/parse-conflict-json/package.json +6 -6
- package/node_modules/proc-log/package.json +4 -4
- package/node_modules/read-cmd-shim/lib/index.js +1 -1
- package/node_modules/read-cmd-shim/package.json +18 -14
- package/node_modules/sigstore/README.md +1 -1
- package/node_modules/sigstore/package.json +10 -10
- package/node_modules/socks-proxy-agent/dist/index.d.ts +3 -1
- package/node_modules/socks-proxy-agent/dist/index.d.ts.map +1 -1
- package/node_modules/socks-proxy-agent/dist/index.js +43 -17
- package/node_modules/socks-proxy-agent/dist/index.js.map +1 -1
- package/node_modules/socks-proxy-agent/package.json +15 -15
- package/node_modules/ssri/package.json +4 -4
- package/node_modules/tuf-js/dist/config.d.ts +2 -2
- package/node_modules/tuf-js/dist/fetcher.d.ts +4 -4
- package/node_modules/tuf-js/dist/fetcher.js +16 -55
- package/node_modules/tuf-js/dist/updater.js +2 -2
- package/node_modules/tuf-js/package.json +8 -8
- package/node_modules/undici/README.md +72 -405
- package/node_modules/undici/docs/docs/api/Agent.md +41 -252
- package/node_modules/undici/docs/docs/api/BalancedPool.md +48 -246
- package/node_modules/undici/docs/docs/api/CacheStorage.md +13 -171
- package/node_modules/undici/docs/docs/api/Client.md +139 -395
- package/node_modules/undici/docs/docs/api/Connector.md +35 -118
- package/node_modules/undici/docs/docs/api/ContentType.md +25 -65
- package/node_modules/undici/docs/docs/api/Cookies.md +47 -125
- package/node_modules/undici/docs/docs/api/Debug.md +31 -47
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +97 -409
- package/node_modules/undici/docs/docs/api/DispatchInterceptor.md +60 -0
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1011 -500
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +96 -105
- package/node_modules/undici/docs/docs/api/Errors.md +28 -528
- package/node_modules/undici/docs/docs/api/EventSource.md +13 -326
- package/node_modules/undici/docs/docs/api/Fetch.md +24 -693
- package/node_modules/undici/docs/docs/api/MockAgent.md +264 -346
- package/node_modules/undici/docs/docs/api/MockClient.md +31 -153
- package/node_modules/undici/docs/docs/api/MockErrors.md +5 -56
- package/node_modules/undici/docs/docs/api/MockPool.md +253 -324
- package/node_modules/undici/docs/docs/api/Pool.md +41 -235
- package/node_modules/undici/docs/docs/api/PoolStats.md +13 -119
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +81 -198
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +58 -238
- package/node_modules/undici/docs/docs/api/RetryAgent.md +28 -119
- package/node_modules/undici/docs/docs/api/RetryHandler.md +78 -161
- package/node_modules/undici/docs/docs/api/Util.md +11 -68
- package/node_modules/undici/docs/docs/api/WebSocket.md +24 -509
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +33 -101
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -2
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +2 -58
- package/node_modules/undici/docs/docs/best-practices/proxy.md +1 -3
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -45
- package/node_modules/undici/index-fetch.js +4 -34
- package/node_modules/undici/index.d.ts +1 -1
- package/node_modules/undici/index.js +20 -87
- package/node_modules/undici/lib/api/abort-signal.js +0 -2
- package/node_modules/undici/lib/api/api-connect.js +11 -15
- package/node_modules/undici/lib/api/api-pipeline.js +19 -33
- package/node_modules/undici/lib/api/api-request.js +59 -89
- package/node_modules/undici/lib/api/api-stream.js +64 -114
- package/node_modules/undici/lib/api/api-upgrade.js +13 -26
- package/node_modules/undici/lib/api/readable.js +87 -317
- package/node_modules/undici/lib/api/util.js +93 -0
- package/node_modules/undici/lib/core/connect.js +125 -77
- package/node_modules/undici/lib/core/constants.js +9 -11
- package/node_modules/undici/lib/core/diagnostics.js +129 -154
- package/node_modules/undici/lib/core/errors.js +50 -122
- package/node_modules/undici/lib/core/request.js +87 -172
- package/node_modules/undici/lib/core/symbols.js +2 -14
- package/node_modules/undici/lib/core/tree.js +2 -10
- package/node_modules/undici/lib/core/util.js +190 -481
- package/node_modules/undici/lib/dispatcher/agent.js +35 -83
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +38 -46
- package/node_modules/undici/lib/dispatcher/client-h1.js +199 -492
- package/node_modules/undici/lib/dispatcher/client-h2.js +380 -1409
- package/node_modules/undici/lib/dispatcher/client.js +130 -253
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +52 -50
- package/node_modules/undici/lib/dispatcher/dispatcher.js +24 -17
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +45 -75
- package/node_modules/undici/lib/dispatcher/fixed-queue.js +50 -68
- package/node_modules/undici/lib/dispatcher/pool-base.js +54 -153
- package/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
- package/node_modules/undici/lib/dispatcher/pool.js +16 -135
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +41 -175
- package/node_modules/undici/lib/dispatcher/retry-agent.js +0 -3
- package/node_modules/undici/lib/global.js +9 -59
- package/node_modules/undici/lib/handler/decorator-handler.js +15 -43
- package/node_modules/undici/lib/handler/redirect-handler.js +116 -127
- package/node_modules/undici/lib/handler/retry-handler.js +182 -398
- package/node_modules/undici/lib/interceptor/dns.js +47 -254
- package/node_modules/undici/lib/interceptor/dump.js +56 -32
- package/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
- package/node_modules/undici/lib/interceptor/redirect.js +14 -11
- package/node_modules/undici/lib/interceptor/response-error.js +22 -31
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/llhttp/constants.js +193 -446
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -11
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -11
- package/node_modules/undici/lib/llhttp/utils.js +12 -9
- package/node_modules/undici/lib/mock/mock-agent.js +22 -106
- package/node_modules/undici/lib/mock/mock-client.js +4 -13
- package/node_modules/undici/lib/mock/mock-errors.js +2 -3
- package/node_modules/undici/lib/mock/mock-interceptor.js +13 -33
- package/node_modules/undici/lib/mock/mock-pool.js +4 -13
- package/node_modules/undici/lib/mock/mock-symbols.js +1 -10
- package/node_modules/undici/lib/mock/mock-utils.js +51 -404
- package/node_modules/undici/lib/mock/pluralizer.js +29 -0
- package/node_modules/undici/lib/util/timers.js +9 -11
- package/node_modules/undici/lib/web/cache/cache.js +51 -63
- package/node_modules/undici/lib/web/cache/cachestorage.js +7 -13
- package/node_modules/undici/lib/web/cache/symbols.js +5 -0
- package/node_modules/undici/lib/web/cookies/index.js +18 -45
- package/node_modules/undici/lib/web/cookies/parse.js +149 -157
- package/node_modules/undici/lib/web/cookies/util.js +2 -4
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +9 -37
- package/node_modules/undici/lib/web/eventsource/eventsource.js +64 -108
- package/node_modules/undici/lib/web/eventsource/util.js +5 -28
- package/node_modules/undici/lib/web/fetch/body.js +148 -173
- package/node_modules/undici/lib/web/fetch/constants.js +6 -13
- package/node_modules/undici/lib/web/fetch/data-url.js +167 -19
- package/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/node_modules/undici/lib/web/fetch/file.js +126 -0
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +117 -229
- package/node_modules/undici/lib/web/fetch/formdata.js +65 -85
- package/node_modules/undici/lib/web/fetch/headers.js +108 -143
- package/node_modules/undici/lib/web/fetch/index.js +446 -627
- package/node_modules/undici/lib/web/fetch/request.js +115 -217
- package/node_modules/undici/lib/web/fetch/response.js +82 -110
- package/node_modules/undici/lib/web/fetch/symbols.js +9 -0
- package/node_modules/undici/lib/web/fetch/util.js +393 -291
- package/node_modules/undici/lib/web/fetch/webidl.js +695 -0
- package/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
- package/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
- package/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
- package/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
- package/node_modules/undici/lib/web/fileapi/util.js +391 -0
- package/node_modules/undici/lib/web/websocket/connection.js +160 -139
- package/node_modules/undici/lib/web/websocket/constants.js +10 -70
- package/node_modules/undici/lib/web/websocket/events.js +30 -49
- package/node_modules/undici/lib/web/websocket/frame.js +20 -51
- package/node_modules/undici/lib/web/websocket/receiver.js +87 -83
- package/node_modules/undici/lib/web/websocket/sender.js +13 -18
- package/node_modules/undici/lib/web/websocket/symbols.js +12 -0
- package/node_modules/undici/lib/web/websocket/util.js +90 -115
- package/node_modules/undici/lib/web/websocket/websocket.js +171 -359
- package/node_modules/undici/package.json +57 -49
- package/node_modules/undici/scripts/strip-comments.js +1 -3
- package/node_modules/undici/types/agent.d.ts +13 -12
- package/node_modules/undici/types/api.d.ts +26 -26
- package/node_modules/undici/types/balanced-pool.d.ts +12 -13
- package/node_modules/undici/types/client.d.ts +39 -98
- package/node_modules/undici/types/connector.d.ts +2 -5
- package/node_modules/undici/types/cookies.d.ts +1 -3
- package/node_modules/undici/types/diagnostics-channel.d.ts +11 -20
- package/node_modules/undici/types/dispatcher.d.ts +139 -136
- package/node_modules/undici/types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici/types/errors.d.ts +54 -86
- package/node_modules/undici/types/eventsource.d.ts +4 -9
- package/node_modules/undici/types/fetch.d.ts +25 -51
- package/node_modules/undici/types/file.d.ts +39 -0
- package/node_modules/undici/types/filereader.d.ts +54 -0
- package/node_modules/undici/types/formdata.d.ts +7 -7
- package/node_modules/undici/types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici/types/global-origin.d.ts +5 -5
- package/node_modules/undici/types/handlers.d.ts +9 -10
- package/node_modules/undici/types/header.d.ts +1 -162
- package/node_modules/undici/types/index.d.ts +47 -69
- package/node_modules/undici/types/interceptors.d.ts +12 -62
- package/node_modules/undici/types/mock-agent.d.ts +27 -46
- package/node_modules/undici/types/mock-client.d.ts +4 -6
- package/node_modules/undici/types/mock-errors.d.ts +3 -3
- package/node_modules/undici/types/mock-interceptor.d.ts +21 -26
- package/node_modules/undici/types/mock-pool.d.ts +4 -6
- package/node_modules/undici/types/patch.d.ts +4 -0
- package/node_modules/undici/types/pool-stats.d.ts +8 -8
- package/node_modules/undici/types/pool.d.ts +14 -14
- package/node_modules/undici/types/proxy-agent.d.ts +6 -13
- package/node_modules/undici/types/readable.d.ts +16 -19
- package/node_modules/undici/types/retry-agent.d.ts +1 -1
- package/node_modules/undici/types/retry-handler.d.ts +9 -18
- package/node_modules/undici/types/util.d.ts +3 -3
- package/node_modules/undici/types/webidl.d.ts +32 -156
- package/node_modules/undici/types/websocket.d.ts +10 -48
- package/node_modules/validate-npm-package-name/package.json +4 -4
- package/node_modules/which/package.json +4 -4
- package/node_modules/write-file-atomic/package.json +4 -4
- package/package.json +56 -60
- package/node_modules/@npmcli/arborist/lib/npm-extension.js +0 -237
- package/node_modules/@npmcli/arborist/lib/package-extensions.js +0 -236
- package/node_modules/@npmcli/arborist/lib/patch.js +0 -111
- package/node_modules/@npmcli/arborist/lib/patched-dependencies.js +0 -168
- package/node_modules/cacache/lib/util/cache-dir.js +0 -29
- package/node_modules/diff/CONTRIBUTING.md +0 -28
- package/node_modules/diff/LICENSE +0 -29
- package/node_modules/diff/README.md +0 -388
- package/node_modules/diff/dist/diff.js +0 -1782
- package/node_modules/diff/dist/diff.min.js +0 -1
- package/node_modules/diff/eslint.config.mjs +0 -182
- package/node_modules/diff/libcjs/convert/dmp.d.ts +0 -8
- package/node_modules/diff/libcjs/convert/dmp.d.ts.map +0 -1
- package/node_modules/diff/libcjs/convert/dmp.js +0 -24
- package/node_modules/diff/libcjs/convert/xml.d.ts +0 -6
- package/node_modules/diff/libcjs/convert/xml.d.ts.map +0 -1
- package/node_modules/diff/libcjs/convert/xml.js +0 -34
- package/node_modules/diff/libcjs/diff/array.d.ts +0 -19
- package/node_modules/diff/libcjs/diff/array.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/array.js +0 -40
- package/node_modules/diff/libcjs/diff/base.d.ts +0 -20
- package/node_modules/diff/libcjs/diff/base.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/base.js +0 -265
- package/node_modules/diff/libcjs/diff/character.d.ts +0 -19
- package/node_modules/diff/libcjs/diff/character.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/character.js +0 -31
- package/node_modules/diff/libcjs/diff/css.d.ts +0 -18
- package/node_modules/diff/libcjs/diff/css.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/css.js +0 -34
- package/node_modules/diff/libcjs/diff/json.d.ts +0 -24
- package/node_modules/diff/libcjs/diff/json.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/json.js +0 -105
- package/node_modules/diff/libcjs/diff/line.d.ts +0 -24
- package/node_modules/diff/libcjs/diff/line.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/line.js +0 -89
- package/node_modules/diff/libcjs/diff/sentence.d.ts +0 -21
- package/node_modules/diff/libcjs/diff/sentence.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/sentence.js +0 -67
- package/node_modules/diff/libcjs/diff/word.d.ts +0 -35
- package/node_modules/diff/libcjs/diff/word.d.ts.map +0 -1
- package/node_modules/diff/libcjs/diff/word.js +0 -312
- package/node_modules/diff/libcjs/index.d.ts +0 -20
- package/node_modules/diff/libcjs/index.d.ts.map +0 -1
- package/node_modules/diff/libcjs/index.js +0 -64
- package/node_modules/diff/libcjs/package.json +0 -1
- package/node_modules/diff/libcjs/patch/apply.d.ts +0 -62
- package/node_modules/diff/libcjs/patch/apply.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/apply.js +0 -267
- package/node_modules/diff/libcjs/patch/create.d.ts +0 -122
- package/node_modules/diff/libcjs/patch/create.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/create.js +0 -251
- package/node_modules/diff/libcjs/patch/line-endings.d.ts +0 -17
- package/node_modules/diff/libcjs/patch/line-endings.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/line-endings.js +0 -61
- package/node_modules/diff/libcjs/patch/parse.d.ts +0 -8
- package/node_modules/diff/libcjs/patch/parse.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/parse.js +0 -150
- package/node_modules/diff/libcjs/patch/reverse.d.ts +0 -9
- package/node_modules/diff/libcjs/patch/reverse.d.ts.map +0 -1
- package/node_modules/diff/libcjs/patch/reverse.js +0 -37
- package/node_modules/diff/libcjs/types.d.ts +0 -213
- package/node_modules/diff/libcjs/types.d.ts.map +0 -1
- package/node_modules/diff/libcjs/types.js +0 -2
- package/node_modules/diff/libcjs/util/array.d.ts +0 -3
- package/node_modules/diff/libcjs/util/array.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/array.js +0 -21
- package/node_modules/diff/libcjs/util/distance-iterator.d.ts +0 -2
- package/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/distance-iterator.js +0 -40
- package/node_modules/diff/libcjs/util/params.d.ts +0 -4
- package/node_modules/diff/libcjs/util/params.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/params.js +0 -17
- package/node_modules/diff/libcjs/util/string.d.ts +0 -30
- package/node_modules/diff/libcjs/util/string.d.ts.map +0 -1
- package/node_modules/diff/libcjs/util/string.js +0 -200
- package/node_modules/diff/libesm/convert/dmp.d.ts +0 -8
- package/node_modules/diff/libesm/convert/dmp.d.ts.map +0 -1
- package/node_modules/diff/libesm/convert/dmp.js +0 -21
- package/node_modules/diff/libesm/convert/xml.d.ts +0 -6
- package/node_modules/diff/libesm/convert/xml.d.ts.map +0 -1
- package/node_modules/diff/libesm/convert/xml.js +0 -31
- package/node_modules/diff/libesm/diff/array.d.ts +0 -19
- package/node_modules/diff/libesm/diff/array.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/array.js +0 -16
- package/node_modules/diff/libesm/diff/base.d.ts +0 -20
- package/node_modules/diff/libesm/diff/base.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/base.js +0 -253
- package/node_modules/diff/libesm/diff/character.d.ts +0 -19
- package/node_modules/diff/libesm/diff/character.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/character.js +0 -7
- package/node_modules/diff/libesm/diff/css.d.ts +0 -18
- package/node_modules/diff/libesm/diff/css.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/css.js +0 -10
- package/node_modules/diff/libesm/diff/json.d.ts +0 -24
- package/node_modules/diff/libesm/diff/json.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/json.js +0 -78
- package/node_modules/diff/libesm/diff/line.d.ts +0 -24
- package/node_modules/diff/libesm/diff/line.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/line.js +0 -65
- package/node_modules/diff/libesm/diff/sentence.d.ts +0 -21
- package/node_modules/diff/libesm/diff/sentence.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/sentence.js +0 -43
- package/node_modules/diff/libesm/diff/word.d.ts +0 -35
- package/node_modules/diff/libesm/diff/word.d.ts.map +0 -1
- package/node_modules/diff/libesm/diff/word.js +0 -281
- package/node_modules/diff/libesm/index.d.ts +0 -20
- package/node_modules/diff/libesm/index.d.ts.map +0 -1
- package/node_modules/diff/libesm/index.js +0 -30
- package/node_modules/diff/libesm/package.json +0 -1
- package/node_modules/diff/libesm/patch/apply.d.ts +0 -62
- package/node_modules/diff/libesm/patch/apply.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/apply.js +0 -257
- package/node_modules/diff/libesm/patch/create.d.ts +0 -122
- package/node_modules/diff/libesm/patch/create.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/create.js +0 -228
- package/node_modules/diff/libesm/patch/line-endings.d.ts +0 -17
- package/node_modules/diff/libesm/patch/line-endings.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/line-endings.js +0 -44
- package/node_modules/diff/libesm/patch/parse.d.ts +0 -8
- package/node_modules/diff/libesm/patch/parse.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/parse.js +0 -147
- package/node_modules/diff/libesm/patch/reverse.d.ts +0 -9
- package/node_modules/diff/libesm/patch/reverse.d.ts.map +0 -1
- package/node_modules/diff/libesm/patch/reverse.js +0 -23
- package/node_modules/diff/libesm/types.d.ts +0 -213
- package/node_modules/diff/libesm/types.d.ts.map +0 -1
- package/node_modules/diff/libesm/types.js +0 -1
- package/node_modules/diff/libesm/util/array.d.ts +0 -3
- package/node_modules/diff/libesm/util/array.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/array.js +0 -17
- package/node_modules/diff/libesm/util/distance-iterator.d.ts +0 -2
- package/node_modules/diff/libesm/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/distance-iterator.js +0 -37
- package/node_modules/diff/libesm/util/params.d.ts +0 -4
- package/node_modules/diff/libesm/util/params.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/params.js +0 -14
- package/node_modules/diff/libesm/util/string.d.ts +0 -30
- package/node_modules/diff/libesm/util/string.d.ts.map +0 -1
- package/node_modules/diff/libesm/util/string.js +0 -184
- package/node_modules/diff/package.json +0 -130
- package/node_modules/diff/release-notes.md +0 -432
- package/node_modules/node-gyp/commitlint.config.mjs +0 -3
- package/node_modules/node-gyp/gyp/commitlint.config.js +0 -6
- package/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake_test.py +0 -105
- package/node_modules/node-gyp/zizmor.yml +0 -5
- package/node_modules/proxy-agent-negotiate/dist/index.d.ts +0 -14
- package/node_modules/proxy-agent-negotiate/dist/index.d.ts.map +0 -1
- package/node_modules/proxy-agent-negotiate/dist/index.js +0 -35
- package/node_modules/proxy-agent-negotiate/dist/index.js.map +0 -1
- package/node_modules/proxy-agent-negotiate/package.json +0 -47
- package/node_modules/undici/docs/docs/api/CacheStore.md +0 -360
- package/node_modules/undici/docs/docs/api/ClientStats.md +0 -93
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +0 -121
- package/node_modules/undici/docs/docs/api/H2CClient.md +0 -385
- package/node_modules/undici/docs/docs/api/Interceptors.md +0 -419
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +0 -371
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +0 -206
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +0 -239
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +0 -361
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +0 -256
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +0 -233
- package/node_modules/undici/docs/docs/getting-started.md +0 -281
- package/node_modules/undici/docs/docs/site.json +0 -125
- package/node_modules/undici/docs/docs/type-map.json +0 -79
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -110
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +0 -7
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/core/socks5-client.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/core/socks5-utils.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/encoding/index.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/llhttp/constants.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/llhttp/utils.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/mock/snapshot-utils.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/date.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/util/stats.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/subresource-integrity/Readme.md +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/lib/web/subresource-integrity/subresource-integrity.js +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/cache-interceptor.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/client-stats.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/mock-call-history.d.ts +0 -0
- /package/node_modules/{undici → @mytools/fst-platform/node_modules/undici}/types/utility.d.ts +0 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
InvalidArgumentError,
|
|
5
|
+
NotSupportedError
|
|
6
|
+
} = require('./errors')
|
|
7
|
+
const assert = require('node:assert')
|
|
8
|
+
const {
|
|
9
|
+
isValidHTTPToken,
|
|
10
|
+
isValidHeaderValue,
|
|
11
|
+
isStream,
|
|
12
|
+
destroy,
|
|
13
|
+
isBuffer,
|
|
14
|
+
isFormDataLike,
|
|
15
|
+
isIterable,
|
|
16
|
+
hasSafeIterator,
|
|
17
|
+
isBlobLike,
|
|
18
|
+
serializePathWithQuery,
|
|
19
|
+
assertRequestHandler,
|
|
20
|
+
getServerName,
|
|
21
|
+
normalizedMethodRecords,
|
|
22
|
+
getProtocolFromUrlString
|
|
23
|
+
} = require('./util')
|
|
24
|
+
const { channels } = require('./diagnostics.js')
|
|
25
|
+
const { headerNameLowerCasedRecord } = require('./constants')
|
|
26
|
+
|
|
27
|
+
// Verifies that a given path is valid does not contain control chars \x00 to \x20
|
|
28
|
+
const invalidPathRegex = /[^\u0021-\u00ff]/
|
|
29
|
+
|
|
30
|
+
function isValidContentLengthHeaderValue (val) {
|
|
31
|
+
if (typeof val !== 'string' || val.length === 0) {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < val.length; i++) {
|
|
36
|
+
const charCode = val.charCodeAt(i)
|
|
37
|
+
if (charCode < 48 || charCode > 57) {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const kHandler = Symbol('handler')
|
|
46
|
+
|
|
47
|
+
class Request {
|
|
48
|
+
constructor (origin, {
|
|
49
|
+
path,
|
|
50
|
+
method,
|
|
51
|
+
body,
|
|
52
|
+
headers,
|
|
53
|
+
query,
|
|
54
|
+
idempotent,
|
|
55
|
+
blocking,
|
|
56
|
+
upgrade,
|
|
57
|
+
headersTimeout,
|
|
58
|
+
bodyTimeout,
|
|
59
|
+
reset,
|
|
60
|
+
expectContinue,
|
|
61
|
+
servername,
|
|
62
|
+
throwOnError,
|
|
63
|
+
maxRedirections,
|
|
64
|
+
typeOfService
|
|
65
|
+
}, handler) {
|
|
66
|
+
if (typeof path !== 'string') {
|
|
67
|
+
throw new InvalidArgumentError('path must be a string')
|
|
68
|
+
} else if (
|
|
69
|
+
path[0] !== '/' &&
|
|
70
|
+
!(path.startsWith('http://') || path.startsWith('https://')) &&
|
|
71
|
+
method !== 'CONNECT'
|
|
72
|
+
) {
|
|
73
|
+
throw new InvalidArgumentError('path must be an absolute URL or start with a slash')
|
|
74
|
+
} else if (invalidPathRegex.test(path)) {
|
|
75
|
+
throw new InvalidArgumentError('invalid request path')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof method !== 'string') {
|
|
79
|
+
throw new InvalidArgumentError('method must be a string')
|
|
80
|
+
} else if (normalizedMethodRecords[method] === undefined && !isValidHTTPToken(method)) {
|
|
81
|
+
throw new InvalidArgumentError('invalid request method')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (upgrade && typeof upgrade !== 'string') {
|
|
85
|
+
throw new InvalidArgumentError('upgrade must be a string')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (upgrade && !isValidHeaderValue(upgrade)) {
|
|
89
|
+
throw new InvalidArgumentError('invalid upgrade header')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {
|
|
93
|
+
throw new InvalidArgumentError('invalid headersTimeout')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {
|
|
97
|
+
throw new InvalidArgumentError('invalid bodyTimeout')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (reset != null && typeof reset !== 'boolean') {
|
|
101
|
+
throw new InvalidArgumentError('invalid reset')
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (expectContinue != null && typeof expectContinue !== 'boolean') {
|
|
105
|
+
throw new InvalidArgumentError('invalid expectContinue')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (throwOnError != null) {
|
|
109
|
+
throw new InvalidArgumentError('invalid throwOnError')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (maxRedirections != null && maxRedirections !== 0) {
|
|
113
|
+
throw new InvalidArgumentError('maxRedirections is not supported, use the redirect interceptor')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (typeOfService != null && (!Number.isInteger(typeOfService) || typeOfService < 0 || typeOfService > 255)) {
|
|
117
|
+
throw new InvalidArgumentError('typeOfService must be an integer between 0 and 255')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.headersTimeout = headersTimeout
|
|
121
|
+
|
|
122
|
+
this.bodyTimeout = bodyTimeout
|
|
123
|
+
|
|
124
|
+
this.method = method
|
|
125
|
+
|
|
126
|
+
this.typeOfService = typeOfService ?? 0
|
|
127
|
+
|
|
128
|
+
this.abort = null
|
|
129
|
+
|
|
130
|
+
if (body == null) {
|
|
131
|
+
this.body = null
|
|
132
|
+
} else if (isStream(body)) {
|
|
133
|
+
this.body = body
|
|
134
|
+
|
|
135
|
+
const rState = this.body._readableState
|
|
136
|
+
if (!rState || !rState.autoDestroy) {
|
|
137
|
+
this.endHandler = function autoDestroy () {
|
|
138
|
+
destroy(this)
|
|
139
|
+
}
|
|
140
|
+
this.body.on('end', this.endHandler)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this.errorHandler = err => {
|
|
144
|
+
if (this.abort) {
|
|
145
|
+
this.abort(err)
|
|
146
|
+
} else {
|
|
147
|
+
this.error = err
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
this.body.on('error', this.errorHandler)
|
|
151
|
+
} else if (isBuffer(body)) {
|
|
152
|
+
this.body = body.byteLength ? body : null
|
|
153
|
+
} else if (ArrayBuffer.isView(body)) {
|
|
154
|
+
this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null
|
|
155
|
+
} else if (body instanceof ArrayBuffer) {
|
|
156
|
+
this.body = body.byteLength ? Buffer.from(body) : null
|
|
157
|
+
} else if (typeof body === 'string') {
|
|
158
|
+
this.body = body.length ? Buffer.from(body) : null
|
|
159
|
+
} else if (isFormDataLike(body) || isIterable(body) || isBlobLike(body)) {
|
|
160
|
+
this.body = body
|
|
161
|
+
} else {
|
|
162
|
+
throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.completed = false
|
|
166
|
+
this.aborted = false
|
|
167
|
+
|
|
168
|
+
this.upgrade = upgrade || null
|
|
169
|
+
|
|
170
|
+
this.path = query ? serializePathWithQuery(path, query) : path
|
|
171
|
+
|
|
172
|
+
// TODO: shall we maybe standardize it to an URL object?
|
|
173
|
+
this.origin = origin
|
|
174
|
+
|
|
175
|
+
this.protocol = getProtocolFromUrlString(origin)
|
|
176
|
+
|
|
177
|
+
this.idempotent = idempotent == null
|
|
178
|
+
? method === 'HEAD' || method === 'GET'
|
|
179
|
+
: idempotent
|
|
180
|
+
|
|
181
|
+
this.blocking = blocking ?? this.method !== 'HEAD'
|
|
182
|
+
|
|
183
|
+
this.reset = reset == null ? null : reset
|
|
184
|
+
|
|
185
|
+
this.host = null
|
|
186
|
+
|
|
187
|
+
this.contentLength = null
|
|
188
|
+
|
|
189
|
+
this.contentType = null
|
|
190
|
+
|
|
191
|
+
this.headers = []
|
|
192
|
+
|
|
193
|
+
// Only for H2
|
|
194
|
+
this.expectContinue = expectContinue != null ? expectContinue : false
|
|
195
|
+
|
|
196
|
+
if (Array.isArray(headers)) {
|
|
197
|
+
if (headers.length % 2 !== 0) {
|
|
198
|
+
throw new InvalidArgumentError('headers array must be even')
|
|
199
|
+
}
|
|
200
|
+
for (let i = 0; i < headers.length; i += 2) {
|
|
201
|
+
processHeader(this, headers[i], headers[i + 1])
|
|
202
|
+
}
|
|
203
|
+
} else if (headers && typeof headers === 'object') {
|
|
204
|
+
if (hasSafeIterator(headers)) {
|
|
205
|
+
for (const header of headers) {
|
|
206
|
+
if (!Array.isArray(header) || header.length !== 2) {
|
|
207
|
+
throw new InvalidArgumentError('headers must be in key-value pair format')
|
|
208
|
+
}
|
|
209
|
+
processHeader(this, header[0], header[1])
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
const keys = Object.keys(headers)
|
|
213
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
214
|
+
processHeader(this, keys[i], headers[keys[i]])
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} else if (headers != null) {
|
|
218
|
+
throw new InvalidArgumentError('headers must be an object or an array')
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
assertRequestHandler(handler, method, upgrade)
|
|
222
|
+
|
|
223
|
+
this.servername = servername || getServerName(this.host) || null
|
|
224
|
+
|
|
225
|
+
this[kHandler] = handler
|
|
226
|
+
|
|
227
|
+
if (channels.create.hasSubscribers) {
|
|
228
|
+
channels.create.publish({ request: this })
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
onBodySent (chunk) {
|
|
233
|
+
if (channels.bodyChunkSent.hasSubscribers) {
|
|
234
|
+
channels.bodyChunkSent.publish({ request: this, chunk })
|
|
235
|
+
}
|
|
236
|
+
if (this[kHandler].onBodySent) {
|
|
237
|
+
try {
|
|
238
|
+
return this[kHandler].onBodySent(chunk)
|
|
239
|
+
} catch (err) {
|
|
240
|
+
this.abort(err)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
onRequestSent () {
|
|
246
|
+
if (channels.bodySent.hasSubscribers) {
|
|
247
|
+
channels.bodySent.publish({ request: this })
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this[kHandler].onRequestSent) {
|
|
251
|
+
try {
|
|
252
|
+
return this[kHandler].onRequestSent()
|
|
253
|
+
} catch (err) {
|
|
254
|
+
this.abort(err)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
onConnect (abort) {
|
|
260
|
+
assert(!this.aborted)
|
|
261
|
+
assert(!this.completed)
|
|
262
|
+
|
|
263
|
+
if (this.error) {
|
|
264
|
+
abort(this.error)
|
|
265
|
+
} else {
|
|
266
|
+
this.abort = abort
|
|
267
|
+
return this[kHandler].onConnect(abort)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
onResponseStarted () {
|
|
272
|
+
return this[kHandler].onResponseStarted?.()
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
onHeaders (statusCode, headers, resume, statusText) {
|
|
276
|
+
assert(!this.aborted)
|
|
277
|
+
assert(!this.completed)
|
|
278
|
+
|
|
279
|
+
if (channels.headers.hasSubscribers) {
|
|
280
|
+
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
return this[kHandler].onHeaders(statusCode, headers, resume, statusText)
|
|
285
|
+
} catch (err) {
|
|
286
|
+
this.abort(err)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
onData (chunk) {
|
|
291
|
+
assert(!this.aborted)
|
|
292
|
+
assert(!this.completed)
|
|
293
|
+
|
|
294
|
+
if (channels.bodyChunkReceived.hasSubscribers) {
|
|
295
|
+
channels.bodyChunkReceived.publish({ request: this, chunk })
|
|
296
|
+
}
|
|
297
|
+
try {
|
|
298
|
+
return this[kHandler].onData(chunk)
|
|
299
|
+
} catch (err) {
|
|
300
|
+
this.abort(err)
|
|
301
|
+
return false
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @param {number} statusCode
|
|
307
|
+
* @param {Buffer[]|string[]} headers
|
|
308
|
+
* @param {import('node:stream').Duplex} socket
|
|
309
|
+
* @param {string} [statusText]
|
|
310
|
+
*/
|
|
311
|
+
onUpgrade (statusCode, headers, socket, statusText = '') {
|
|
312
|
+
this.onFinally()
|
|
313
|
+
|
|
314
|
+
assert(!this.aborted)
|
|
315
|
+
assert(!this.completed)
|
|
316
|
+
|
|
317
|
+
if (channels.headers.hasSubscribers) {
|
|
318
|
+
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const result = this[kHandler].onUpgrade(statusCode, headers, socket)
|
|
322
|
+
|
|
323
|
+
if (!this.aborted) {
|
|
324
|
+
this.completed = true
|
|
325
|
+
if (channels.trailers.hasSubscribers) {
|
|
326
|
+
channels.trailers.publish({ request: this, trailers: [] })
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return result
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
onComplete (trailers) {
|
|
334
|
+
this.onFinally()
|
|
335
|
+
|
|
336
|
+
assert(!this.aborted)
|
|
337
|
+
assert(!this.completed)
|
|
338
|
+
|
|
339
|
+
this.completed = true
|
|
340
|
+
if (channels.trailers.hasSubscribers) {
|
|
341
|
+
channels.trailers.publish({ request: this, trailers })
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
try {
|
|
345
|
+
return this[kHandler].onComplete(trailers)
|
|
346
|
+
} catch (err) {
|
|
347
|
+
// TODO (fix): This might be a bad idea?
|
|
348
|
+
this.onError(err)
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
onError (error) {
|
|
353
|
+
this.onFinally()
|
|
354
|
+
|
|
355
|
+
if (channels.error.hasSubscribers) {
|
|
356
|
+
channels.error.publish({ request: this, error })
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (this.aborted) {
|
|
360
|
+
return
|
|
361
|
+
}
|
|
362
|
+
this.aborted = true
|
|
363
|
+
|
|
364
|
+
return this[kHandler].onError(error)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
onFinally () {
|
|
368
|
+
if (this.errorHandler) {
|
|
369
|
+
this.body.off('error', this.errorHandler)
|
|
370
|
+
this.errorHandler = null
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (this.endHandler) {
|
|
374
|
+
this.body.off('end', this.endHandler)
|
|
375
|
+
this.endHandler = null
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
addHeader (key, value) {
|
|
380
|
+
processHeader(this, key, value)
|
|
381
|
+
return this
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function processHeader (request, key, val) {
|
|
386
|
+
if (val && (typeof val === 'object' && !Array.isArray(val))) {
|
|
387
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
388
|
+
} else if (val === undefined) {
|
|
389
|
+
return
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
let headerName = headerNameLowerCasedRecord[key]
|
|
393
|
+
|
|
394
|
+
if (headerName === undefined) {
|
|
395
|
+
headerName = key.toLowerCase()
|
|
396
|
+
if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {
|
|
397
|
+
throw new InvalidArgumentError('invalid header key')
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (Array.isArray(val)) {
|
|
402
|
+
const arr = []
|
|
403
|
+
for (let i = 0; i < val.length; i++) {
|
|
404
|
+
if (typeof val[i] === 'string') {
|
|
405
|
+
if (!isValidHeaderValue(val[i])) {
|
|
406
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
407
|
+
}
|
|
408
|
+
arr.push(val[i])
|
|
409
|
+
} else if (val[i] === null) {
|
|
410
|
+
arr.push('')
|
|
411
|
+
} else if (typeof val[i] === 'object') {
|
|
412
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
413
|
+
} else {
|
|
414
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
415
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
416
|
+
const str = `${val[i]}`
|
|
417
|
+
if (!isValidHeaderValue(str)) {
|
|
418
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
419
|
+
}
|
|
420
|
+
arr.push(str)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
val = arr
|
|
424
|
+
} else if (typeof val === 'string') {
|
|
425
|
+
if (!isValidHeaderValue(val)) {
|
|
426
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
427
|
+
}
|
|
428
|
+
} else if (val === null) {
|
|
429
|
+
val = ''
|
|
430
|
+
} else {
|
|
431
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
432
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
433
|
+
val = `${val}`
|
|
434
|
+
if (!isValidHeaderValue(val)) {
|
|
435
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (headerName === 'host') {
|
|
440
|
+
if (request.host !== null) {
|
|
441
|
+
throw new InvalidArgumentError('duplicate host header')
|
|
442
|
+
}
|
|
443
|
+
if (typeof val !== 'string') {
|
|
444
|
+
throw new InvalidArgumentError('invalid host header')
|
|
445
|
+
}
|
|
446
|
+
// Consumed by Client
|
|
447
|
+
request.host = val
|
|
448
|
+
} else if (headerName === 'content-length') {
|
|
449
|
+
if (request.contentLength !== null) {
|
|
450
|
+
throw new InvalidArgumentError('duplicate content-length header')
|
|
451
|
+
}
|
|
452
|
+
if (!isValidContentLengthHeaderValue(val)) {
|
|
453
|
+
throw new InvalidArgumentError('invalid content-length header')
|
|
454
|
+
}
|
|
455
|
+
request.contentLength = parseInt(val, 10)
|
|
456
|
+
} else if (request.contentType === null && headerName === 'content-type') {
|
|
457
|
+
request.contentType = val
|
|
458
|
+
request.headers.push(key, val)
|
|
459
|
+
} else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {
|
|
460
|
+
throw new InvalidArgumentError(`invalid ${headerName} header`)
|
|
461
|
+
} else if (headerName === 'connection') {
|
|
462
|
+
// Per RFC 7230 Section 6.1, Connection header can contain
|
|
463
|
+
// a comma-separated list of connection option tokens (header names)
|
|
464
|
+
const value = typeof val === 'string' ? val : null
|
|
465
|
+
if (value === null) {
|
|
466
|
+
throw new InvalidArgumentError('invalid connection header')
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
for (const token of value.toLowerCase().split(',')) {
|
|
470
|
+
const trimmed = token.trim()
|
|
471
|
+
if (!isValidHTTPToken(trimmed)) {
|
|
472
|
+
throw new InvalidArgumentError('invalid connection header')
|
|
473
|
+
}
|
|
474
|
+
if (trimmed === 'close') {
|
|
475
|
+
request.reset = true
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
} else if (headerName === 'expect') {
|
|
479
|
+
throw new NotSupportedError('expect header not supported')
|
|
480
|
+
} else {
|
|
481
|
+
request.headers.push(key, val)
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
module.exports = Request
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
kClose: Symbol('close'),
|
|
5
|
+
kDestroy: Symbol('destroy'),
|
|
6
|
+
kDispatch: Symbol('dispatch'),
|
|
7
|
+
kUrl: Symbol('url'),
|
|
8
|
+
kWriting: Symbol('writing'),
|
|
9
|
+
kResuming: Symbol('resuming'),
|
|
10
|
+
kQueue: Symbol('queue'),
|
|
11
|
+
kConnect: Symbol('connect'),
|
|
12
|
+
kConnecting: Symbol('connecting'),
|
|
13
|
+
kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'),
|
|
14
|
+
kKeepAliveMaxTimeout: Symbol('max keep alive timeout'),
|
|
15
|
+
kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'),
|
|
16
|
+
kKeepAliveTimeoutValue: Symbol('keep alive timeout'),
|
|
17
|
+
kKeepAlive: Symbol('keep alive'),
|
|
18
|
+
kHeadersTimeout: Symbol('headers timeout'),
|
|
19
|
+
kBodyTimeout: Symbol('body timeout'),
|
|
20
|
+
kServerName: Symbol('server name'),
|
|
21
|
+
kLocalAddress: Symbol('local address'),
|
|
22
|
+
kHost: Symbol('host'),
|
|
23
|
+
kNoRef: Symbol('no ref'),
|
|
24
|
+
kBodyUsed: Symbol('used'),
|
|
25
|
+
kBody: Symbol('abstracted request body'),
|
|
26
|
+
kRunning: Symbol('running'),
|
|
27
|
+
kBlocking: Symbol('blocking'),
|
|
28
|
+
kPending: Symbol('pending'),
|
|
29
|
+
kSize: Symbol('size'),
|
|
30
|
+
kBusy: Symbol('busy'),
|
|
31
|
+
kQueued: Symbol('queued'),
|
|
32
|
+
kFree: Symbol('free'),
|
|
33
|
+
kConnected: Symbol('connected'),
|
|
34
|
+
kClosed: Symbol('closed'),
|
|
35
|
+
kNeedDrain: Symbol('need drain'),
|
|
36
|
+
kReset: Symbol('reset'),
|
|
37
|
+
kDestroyed: Symbol.for('nodejs.stream.destroyed'),
|
|
38
|
+
kResume: Symbol('resume'),
|
|
39
|
+
kOnError: Symbol('on error'),
|
|
40
|
+
kMaxHeadersSize: Symbol('max headers size'),
|
|
41
|
+
kRunningIdx: Symbol('running index'),
|
|
42
|
+
kPendingIdx: Symbol('pending index'),
|
|
43
|
+
kError: Symbol('error'),
|
|
44
|
+
kClients: Symbol('clients'),
|
|
45
|
+
kClient: Symbol('client'),
|
|
46
|
+
kParser: Symbol('parser'),
|
|
47
|
+
kOnDestroyed: Symbol('destroy callbacks'),
|
|
48
|
+
kPipelining: Symbol('pipelining'),
|
|
49
|
+
kSocket: Symbol('socket'),
|
|
50
|
+
kHostHeader: Symbol('host header'),
|
|
51
|
+
kConnector: Symbol('connector'),
|
|
52
|
+
kStrictContentLength: Symbol('strict content length'),
|
|
53
|
+
kMaxRedirections: Symbol('maxRedirections'),
|
|
54
|
+
kMaxRequests: Symbol('maxRequestsPerClient'),
|
|
55
|
+
kProxy: Symbol('proxy agent options'),
|
|
56
|
+
kCounter: Symbol('socket request counter'),
|
|
57
|
+
kMaxResponseSize: Symbol('max response size'),
|
|
58
|
+
kHTTP2Session: Symbol('http2Session'),
|
|
59
|
+
kHTTP2SessionState: Symbol('http2Session state'),
|
|
60
|
+
kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
|
|
61
|
+
kConstruct: Symbol('constructable'),
|
|
62
|
+
kListeners: Symbol('listeners'),
|
|
63
|
+
kHTTPContext: Symbol('http context'),
|
|
64
|
+
kMaxConcurrentStreams: Symbol('max concurrent streams'),
|
|
65
|
+
kHTTP2InitialWindowSize: Symbol('http2 initial window size'),
|
|
66
|
+
kHTTP2ConnectionWindowSize: Symbol('http2 connection window size'),
|
|
67
|
+
kEnableConnectProtocol: Symbol('http2session connect protocol'),
|
|
68
|
+
kRemoteSettings: Symbol('http2session remote settings'),
|
|
69
|
+
kHTTP2Stream: Symbol('http2session client stream'),
|
|
70
|
+
kPingInterval: Symbol('ping interval'),
|
|
71
|
+
kNoProxyAgent: Symbol('no proxy agent'),
|
|
72
|
+
kHttpProxyAgent: Symbol('http proxy agent'),
|
|
73
|
+
kHttpsProxyAgent: Symbol('https proxy agent'),
|
|
74
|
+
kSocks5ProxyAgent: Symbol('socks5 proxy agent')
|
|
75
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
wellknownHeaderNames,
|
|
5
|
+
headerNameLowerCasedRecord
|
|
6
|
+
} = require('./constants')
|
|
7
|
+
|
|
8
|
+
class TstNode {
|
|
9
|
+
/** @type {any} */
|
|
10
|
+
value = null
|
|
11
|
+
/** @type {null | TstNode} */
|
|
12
|
+
left = null
|
|
13
|
+
/** @type {null | TstNode} */
|
|
14
|
+
middle = null
|
|
15
|
+
/** @type {null | TstNode} */
|
|
16
|
+
right = null
|
|
17
|
+
/** @type {number} */
|
|
18
|
+
code
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} key
|
|
21
|
+
* @param {any} value
|
|
22
|
+
* @param {number} index
|
|
23
|
+
*/
|
|
24
|
+
constructor (key, value, index) {
|
|
25
|
+
if (index === undefined || index >= key.length) {
|
|
26
|
+
throw new TypeError('Unreachable')
|
|
27
|
+
}
|
|
28
|
+
const code = this.code = key.charCodeAt(index)
|
|
29
|
+
// check code is ascii string
|
|
30
|
+
if (code > 0x7F) {
|
|
31
|
+
throw new TypeError('key must be ascii string')
|
|
32
|
+
}
|
|
33
|
+
if (key.length !== ++index) {
|
|
34
|
+
this.middle = new TstNode(key, value, index)
|
|
35
|
+
} else {
|
|
36
|
+
this.value = value
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} key
|
|
42
|
+
* @param {any} value
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
add (key, value) {
|
|
46
|
+
const length = key.length
|
|
47
|
+
if (length === 0) {
|
|
48
|
+
throw new TypeError('Unreachable')
|
|
49
|
+
}
|
|
50
|
+
let index = 0
|
|
51
|
+
/**
|
|
52
|
+
* @type {TstNode}
|
|
53
|
+
*/
|
|
54
|
+
let node = this
|
|
55
|
+
while (true) {
|
|
56
|
+
const code = key.charCodeAt(index)
|
|
57
|
+
// check code is ascii string
|
|
58
|
+
if (code > 0x7F) {
|
|
59
|
+
throw new TypeError('key must be ascii string')
|
|
60
|
+
}
|
|
61
|
+
if (node.code === code) {
|
|
62
|
+
if (length === ++index) {
|
|
63
|
+
node.value = value
|
|
64
|
+
break
|
|
65
|
+
} else if (node.middle !== null) {
|
|
66
|
+
node = node.middle
|
|
67
|
+
} else {
|
|
68
|
+
node.middle = new TstNode(key, value, index)
|
|
69
|
+
break
|
|
70
|
+
}
|
|
71
|
+
} else if (node.code < code) {
|
|
72
|
+
if (node.left !== null) {
|
|
73
|
+
node = node.left
|
|
74
|
+
} else {
|
|
75
|
+
node.left = new TstNode(key, value, index)
|
|
76
|
+
break
|
|
77
|
+
}
|
|
78
|
+
} else if (node.right !== null) {
|
|
79
|
+
node = node.right
|
|
80
|
+
} else {
|
|
81
|
+
node.right = new TstNode(key, value, index)
|
|
82
|
+
break
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @param {Uint8Array} key
|
|
89
|
+
* @returns {TstNode | null}
|
|
90
|
+
*/
|
|
91
|
+
search (key) {
|
|
92
|
+
const keylength = key.length
|
|
93
|
+
let index = 0
|
|
94
|
+
/**
|
|
95
|
+
* @type {TstNode|null}
|
|
96
|
+
*/
|
|
97
|
+
let node = this
|
|
98
|
+
while (node !== null && index < keylength) {
|
|
99
|
+
let code = key[index]
|
|
100
|
+
// A-Z
|
|
101
|
+
// First check if it is bigger than 0x5a.
|
|
102
|
+
// Lowercase letters have higher char codes than uppercase ones.
|
|
103
|
+
// Also we assume that headers will mostly contain lowercase characters.
|
|
104
|
+
if (code <= 0x5a && code >= 0x41) {
|
|
105
|
+
// Lowercase for uppercase.
|
|
106
|
+
code |= 32
|
|
107
|
+
}
|
|
108
|
+
while (node !== null) {
|
|
109
|
+
if (code === node.code) {
|
|
110
|
+
if (keylength === ++index) {
|
|
111
|
+
// Returns Node since it is the last key.
|
|
112
|
+
return node
|
|
113
|
+
}
|
|
114
|
+
node = node.middle
|
|
115
|
+
break
|
|
116
|
+
}
|
|
117
|
+
node = node.code < code ? node.left : node.right
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return null
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class TernarySearchTree {
|
|
125
|
+
/** @type {TstNode | null} */
|
|
126
|
+
node = null
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} key
|
|
130
|
+
* @param {any} value
|
|
131
|
+
* @returns {void}
|
|
132
|
+
* */
|
|
133
|
+
insert (key, value) {
|
|
134
|
+
if (this.node === null) {
|
|
135
|
+
this.node = new TstNode(key, value, 0)
|
|
136
|
+
} else {
|
|
137
|
+
this.node.add(key, value)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @param {Uint8Array} key
|
|
143
|
+
* @returns {any}
|
|
144
|
+
*/
|
|
145
|
+
lookup (key) {
|
|
146
|
+
return this.node?.search(key)?.value ?? null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const tree = new TernarySearchTree()
|
|
151
|
+
|
|
152
|
+
for (let i = 0; i < wellknownHeaderNames.length; ++i) {
|
|
153
|
+
const key = headerNameLowerCasedRecord[wellknownHeaderNames[i]]
|
|
154
|
+
tree.insert(key, key)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
module.exports = {
|
|
158
|
+
TernarySearchTree,
|
|
159
|
+
tree
|
|
160
|
+
}
|