monitor-transfer-dsh 0.0.0-stage → 0.1.2
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/CHANGELOG.md +25 -0
- package/README.md +51 -2
- package/cordis.patch.yml +4 -0
- package/lib/client.js +381 -0
- package/lib/index.js +267 -0
- package/package.json +67 -3
- package/skill/SKILL.md +48 -0
- package/skill/tools/node_modules/.package-lock.json +163 -0
- package/skill/tools/node_modules/pg/LICENSE +21 -0
- package/skill/tools/node_modules/pg/README.md +96 -0
- package/skill/tools/node_modules/pg/esm/index.mjs +20 -0
- package/skill/tools/node_modules/pg/lib/client.js +846 -0
- package/skill/tools/node_modules/pg/lib/connection-parameters.js +184 -0
- package/skill/tools/node_modules/pg/lib/connection.js +250 -0
- package/skill/tools/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/skill/tools/node_modules/pg/lib/crypto/sasl.js +262 -0
- package/skill/tools/node_modules/pg/lib/crypto/utils.js +89 -0
- package/skill/tools/node_modules/pg/lib/defaults.js +94 -0
- package/skill/tools/node_modules/pg/lib/index.js +73 -0
- package/skill/tools/node_modules/pg/lib/native/client.js +428 -0
- package/skill/tools/node_modules/pg/lib/native/index.js +2 -0
- package/skill/tools/node_modules/pg/lib/native/query.js +167 -0
- package/skill/tools/node_modules/pg/lib/query.js +263 -0
- package/skill/tools/node_modules/pg/lib/result.js +109 -0
- package/skill/tools/node_modules/pg/lib/stream.js +83 -0
- package/skill/tools/node_modules/pg/lib/type-overrides.js +35 -0
- package/skill/tools/node_modules/pg/lib/utils.js +225 -0
- package/skill/tools/node_modules/pg/package.json +76 -0
- package/skill/tools/node_modules/pg-cloudflare/LICENSE +21 -0
- package/skill/tools/node_modules/pg-cloudflare/README.md +112 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/empty.js +6 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/index.d.ts +29 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/index.js +171 -0
- package/skill/tools/node_modules/pg-cloudflare/dist/index.js.map +1 -0
- package/skill/tools/node_modules/pg-cloudflare/esm/index.mjs +3 -0
- package/skill/tools/node_modules/pg-cloudflare/package.json +39 -0
- package/skill/tools/node_modules/pg-cloudflare/src/empty.ts +3 -0
- package/skill/tools/node_modules/pg-cloudflare/src/index.ts +187 -0
- package/skill/tools/node_modules/pg-cloudflare/src/types.d.ts +25 -0
- package/skill/tools/node_modules/pg-connection-string/LICENSE +21 -0
- package/skill/tools/node_modules/pg-connection-string/README.md +105 -0
- package/skill/tools/node_modules/pg-connection-string/esm/index.mjs +8 -0
- package/skill/tools/node_modules/pg-connection-string/index.d.ts +37 -0
- package/skill/tools/node_modules/pg-connection-string/index.js +237 -0
- package/skill/tools/node_modules/pg-connection-string/package.json +51 -0
- package/skill/tools/node_modules/pg-int8/LICENSE +13 -0
- package/skill/tools/node_modules/pg-int8/README.md +16 -0
- package/skill/tools/node_modules/pg-int8/index.js +100 -0
- package/skill/tools/node_modules/pg-int8/package.json +24 -0
- package/skill/tools/node_modules/pg-pool/LICENSE +21 -0
- package/skill/tools/node_modules/pg-pool/README.md +357 -0
- package/skill/tools/node_modules/pg-pool/esm/index.mjs +5 -0
- package/skill/tools/node_modules/pg-pool/index.js +517 -0
- package/skill/tools/node_modules/pg-pool/package.json +51 -0
- package/skill/tools/node_modules/pg-protocol/LICENSE +21 -0
- package/skill/tools/node_modules/pg-protocol/README.md +3 -0
- package/skill/tools/node_modules/pg-protocol/dist/b.d.ts +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/b.js +23 -0
- package/skill/tools/node_modules/pg-protocol/dist/b.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.d.ts +14 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.d.ts +21 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.js +113 -0
- package/skill/tools/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.js +538 -0
- package/skill/tools/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/index.d.ts +5 -0
- package/skill/tools/node_modules/pg-protocol/dist/index.js +15 -0
- package/skill/tools/node_modules/pg-protocol/dist/index.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/messages.d.ts +161 -0
- package/skill/tools/node_modules/pg-protocol/dist/messages.js +160 -0
- package/skill/tools/node_modules/pg-protocol/dist/messages.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.js +325 -0
- package/skill/tools/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/parser.d.ts +22 -0
- package/skill/tools/node_modules/pg-protocol/dist/parser.js +325 -0
- package/skill/tools/node_modules/pg-protocol/dist/parser.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
- package/skill/tools/node_modules/pg-protocol/dist/serializer.js +198 -0
- package/skill/tools/node_modules/pg-protocol/dist/serializer.js.map +1 -0
- package/skill/tools/node_modules/pg-protocol/esm/index.js +11 -0
- package/skill/tools/node_modules/pg-protocol/package.json +44 -0
- package/skill/tools/node_modules/pg-protocol/src/b.ts +25 -0
- package/skill/tools/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
- package/skill/tools/node_modules/pg-protocol/src/buffer-writer.ts +120 -0
- package/skill/tools/node_modules/pg-protocol/src/inbound-parser.test.ts +585 -0
- package/skill/tools/node_modules/pg-protocol/src/index.ts +11 -0
- package/skill/tools/node_modules/pg-protocol/src/messages.ts +262 -0
- package/skill/tools/node_modules/pg-protocol/src/outbound-serializer.test.ts +356 -0
- package/skill/tools/node_modules/pg-protocol/src/parser.ts +414 -0
- package/skill/tools/node_modules/pg-protocol/src/serializer.ts +286 -0
- package/skill/tools/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
- package/skill/tools/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
- package/skill/tools/node_modules/pg-types/.travis.yml +7 -0
- package/skill/tools/node_modules/pg-types/Makefile +14 -0
- package/skill/tools/node_modules/pg-types/README.md +75 -0
- package/skill/tools/node_modules/pg-types/index.d.ts +137 -0
- package/skill/tools/node_modules/pg-types/index.js +47 -0
- package/skill/tools/node_modules/pg-types/index.test-d.ts +21 -0
- package/skill/tools/node_modules/pg-types/lib/arrayParser.js +11 -0
- package/skill/tools/node_modules/pg-types/lib/binaryParsers.js +257 -0
- package/skill/tools/node_modules/pg-types/lib/builtins.js +73 -0
- package/skill/tools/node_modules/pg-types/lib/textParsers.js +215 -0
- package/skill/tools/node_modules/pg-types/package.json +42 -0
- package/skill/tools/node_modules/pg-types/test/index.js +24 -0
- package/skill/tools/node_modules/pg-types/test/types.js +597 -0
- package/skill/tools/node_modules/pgpass/README.md +74 -0
- package/skill/tools/node_modules/pgpass/lib/helper.js +233 -0
- package/skill/tools/node_modules/pgpass/lib/index.js +23 -0
- package/skill/tools/node_modules/pgpass/package.json +41 -0
- package/skill/tools/node_modules/postgres-array/index.d.ts +4 -0
- package/skill/tools/node_modules/postgres-array/index.js +97 -0
- package/skill/tools/node_modules/postgres-array/license +21 -0
- package/skill/tools/node_modules/postgres-array/package.json +35 -0
- package/skill/tools/node_modules/postgres-array/readme.md +43 -0
- package/skill/tools/node_modules/postgres-bytea/index.js +33 -0
- package/skill/tools/node_modules/postgres-bytea/license +21 -0
- package/skill/tools/node_modules/postgres-bytea/package.json +34 -0
- package/skill/tools/node_modules/postgres-bytea/readme.md +34 -0
- package/skill/tools/node_modules/postgres-date/index.js +116 -0
- package/skill/tools/node_modules/postgres-date/license +21 -0
- package/skill/tools/node_modules/postgres-date/package.json +33 -0
- package/skill/tools/node_modules/postgres-date/readme.md +49 -0
- package/skill/tools/node_modules/postgres-interval/index.d.ts +20 -0
- package/skill/tools/node_modules/postgres-interval/index.js +125 -0
- package/skill/tools/node_modules/postgres-interval/license +21 -0
- package/skill/tools/node_modules/postgres-interval/package.json +36 -0
- package/skill/tools/node_modules/postgres-interval/readme.md +48 -0
- package/skill/tools/node_modules/split2/LICENSE +13 -0
- package/skill/tools/node_modules/split2/README.md +85 -0
- package/skill/tools/node_modules/split2/bench.js +27 -0
- package/skill/tools/node_modules/split2/index.js +141 -0
- package/skill/tools/node_modules/split2/package.json +39 -0
- package/skill/tools/node_modules/split2/test.js +409 -0
- package/skill/tools/node_modules/undici/LICENSE +21 -0
- package/skill/tools/node_modules/undici/README.md +828 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Agent.md +291 -0
- package/skill/tools/node_modules/undici/docs/docs/api/BalancedPool.md +297 -0
- package/skill/tools/node_modules/undici/docs/docs/api/CacheStorage.md +188 -0
- package/skill/tools/node_modules/undici/docs/docs/api/CacheStore.md +375 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Client.md +538 -0
- package/skill/tools/node_modules/undici/docs/docs/api/ClientStats.md +93 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Connector.md +198 -0
- package/skill/tools/node_modules/undici/docs/docs/api/ContentType.md +97 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Cookies.md +179 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Debug.md +78 -0
- package/skill/tools/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +518 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Dispatcher.md +842 -0
- package/skill/tools/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +171 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Errors.md +624 -0
- package/skill/tools/node_modules/undici/docs/docs/api/EventSource.md +358 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Fetch.md +721 -0
- package/skill/tools/node_modules/undici/docs/docs/api/GlobalInstallation.md +121 -0
- package/skill/tools/node_modules/undici/docs/docs/api/H2CClient.md +386 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Interceptors.md +439 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockAgent.md +622 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockCallHistory.md +371 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +206 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockClient.md +199 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockErrors.md +63 -0
- package/skill/tools/node_modules/undici/docs/docs/api/MockPool.md +618 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Pool.md +278 -0
- package/skill/tools/node_modules/undici/docs/docs/api/PoolStats.md +141 -0
- package/skill/tools/node_modules/undici/docs/docs/api/ProxyAgent.md +248 -0
- package/skill/tools/node_modules/undici/docs/docs/api/RedirectHandler.md +279 -0
- package/skill/tools/node_modules/undici/docs/docs/api/RetryAgent.md +136 -0
- package/skill/tools/node_modules/undici/docs/docs/api/RetryHandler.md +200 -0
- package/skill/tools/node_modules/undici/docs/docs/api/RoundRobinPool.md +239 -0
- package/skill/tools/node_modules/undici/docs/docs/api/SnapshotAgent.md +361 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +256 -0
- package/skill/tools/node_modules/undici/docs/docs/api/Util.md +82 -0
- package/skill/tools/node_modules/undici/docs/docs/api/WebSocket.md +536 -0
- package/skill/tools/node_modules/undici/docs/docs/api/api-lifecycle.md +159 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/client-certificate.md +66 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/crawling.md +60 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +233 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/mocking-request.md +192 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/proxy.md +129 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +226 -0
- package/skill/tools/node_modules/undici/docs/docs/best-practices/writing-tests.md +65 -0
- package/skill/tools/node_modules/undici/docs/docs/getting-started.md +281 -0
- package/skill/tools/node_modules/undici/docs/docs/index.md +793 -0
- package/skill/tools/node_modules/undici/docs/docs/site.json +125 -0
- package/skill/tools/node_modules/undici/docs/docs/type-map.json +79 -0
- package/skill/tools/node_modules/undici/index-fetch.js +65 -0
- package/skill/tools/node_modules/undici/index.d.ts +3 -0
- package/skill/tools/node_modules/undici/index.js +236 -0
- package/skill/tools/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/skill/tools/node_modules/undici/lib/api/api-connect.js +112 -0
- package/skill/tools/node_modules/undici/lib/api/api-pipeline.js +265 -0
- package/skill/tools/node_modules/undici/lib/api/api-request.js +244 -0
- package/skill/tools/node_modules/undici/lib/api/api-stream.js +270 -0
- package/skill/tools/node_modules/undici/lib/api/api-upgrade.js +121 -0
- package/skill/tools/node_modules/undici/lib/api/index.js +7 -0
- package/skill/tools/node_modules/undici/lib/api/readable.js +615 -0
- package/skill/tools/node_modules/undici/lib/cache/memory-cache-store.js +314 -0
- package/skill/tools/node_modules/undici/lib/cache/sqlite-cache-store.js +593 -0
- package/skill/tools/node_modules/undici/lib/core/connect.js +198 -0
- package/skill/tools/node_modules/undici/lib/core/constants.js +131 -0
- package/skill/tools/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/skill/tools/node_modules/undici/lib/core/errors.js +534 -0
- package/skill/tools/node_modules/undici/lib/core/request.js +582 -0
- package/skill/tools/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/skill/tools/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/skill/tools/node_modules/undici/lib/core/symbols.js +81 -0
- package/skill/tools/node_modules/undici/lib/core/tree.js +160 -0
- package/skill/tools/node_modules/undici/lib/core/util.js +1035 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/agent.js +181 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/balanced-pool.js +217 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/client-h1.js +1846 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/client-h2.js +1989 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/client.js +749 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher-base.js +198 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher.js +58 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +127 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +190 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/parser-h1.js +1065 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/pool-base.js +347 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/pool.js +229 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/proxy-agent.js +418 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/retry-agent.js +48 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/round-robin-pool.js +169 -0
- package/skill/tools/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +350 -0
- package/skill/tools/node_modules/undici/lib/encoding/index.js +33 -0
- package/skill/tools/node_modules/undici/lib/global.js +82 -0
- package/skill/tools/node_modules/undici/lib/handler/cache-handler.js +1222 -0
- package/skill/tools/node_modules/undici/lib/handler/cache-revalidation-handler.js +134 -0
- package/skill/tools/node_modules/undici/lib/handler/decorator-handler.js +76 -0
- package/skill/tools/node_modules/undici/lib/handler/deduplication-handler.js +540 -0
- package/skill/tools/node_modules/undici/lib/handler/redirect-handler.js +284 -0
- package/skill/tools/node_modules/undici/lib/handler/retry-handler.js +686 -0
- package/skill/tools/node_modules/undici/lib/interceptor/cache.js +771 -0
- package/skill/tools/node_modules/undici/lib/interceptor/decompress.js +574 -0
- package/skill/tools/node_modules/undici/lib/interceptor/deduplicate.js +118 -0
- package/skill/tools/node_modules/undici/lib/interceptor/dns.js +593 -0
- package/skill/tools/node_modules/undici/lib/interceptor/dump.js +99 -0
- package/skill/tools/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/skill/tools/node_modules/undici/lib/interceptor/response-error.js +139 -0
- package/skill/tools/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/skill/tools/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/skill/tools/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/skill/tools/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/skill/tools/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/skill/tools/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/skill/tools/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/skill/tools/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/skill/tools/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/skill/tools/node_modules/undici/lib/milo/simd.js +1002 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-agent.js +255 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-interceptor.js +227 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/skill/tools/node_modules/undici/lib/mock/mock-utils.js +730 -0
- package/skill/tools/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/skill/tools/node_modules/undici/lib/mock/snapshot-agent.js +371 -0
- package/skill/tools/node_modules/undici/lib/mock/snapshot-recorder.js +624 -0
- package/skill/tools/node_modules/undici/lib/mock/snapshot-utils.js +159 -0
- package/skill/tools/node_modules/undici/lib/util/cache.js +764 -0
- package/skill/tools/node_modules/undici/lib/util/date.js +670 -0
- package/skill/tools/node_modules/undici/lib/util/runtime-features.js +93 -0
- package/skill/tools/node_modules/undici/lib/util/stats.js +32 -0
- package/skill/tools/node_modules/undici/lib/util/timers.js +425 -0
- package/skill/tools/node_modules/undici/lib/web/cache/cache.js +871 -0
- package/skill/tools/node_modules/undici/lib/web/cache/cachestorage.js +158 -0
- package/skill/tools/node_modules/undici/lib/web/cache/util.js +45 -0
- package/skill/tools/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/skill/tools/node_modules/undici/lib/web/cookies/index.js +211 -0
- package/skill/tools/node_modules/undici/lib/web/cookies/parse.js +318 -0
- package/skill/tools/node_modules/undici/lib/web/cookies/util.js +371 -0
- package/skill/tools/node_modules/undici/lib/web/eventsource/eventsource-stream.js +575 -0
- package/skill/tools/node_modules/undici/lib/web/eventsource/eventsource.js +547 -0
- package/skill/tools/node_modules/undici/lib/web/eventsource/util.js +60 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/body.js +583 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/formdata-parser.js +594 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/formdata.js +272 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/headers.js +722 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/index.js +2451 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/request.js +1117 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/response.js +638 -0
- package/skill/tools/node_modules/undici/lib/web/fetch/util.js +1530 -0
- package/skill/tools/node_modules/undici/lib/web/infra/index.js +244 -0
- package/skill/tools/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/skill/tools/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/skill/tools/node_modules/undici/lib/web/webidl/index.js +992 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/connection.js +350 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/events.js +348 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/frame.js +127 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/receiver.js +530 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/stream/websocketerror.js +107 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/stream/websocketstream.js +511 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/skill/tools/node_modules/undici/lib/web/websocket/websocket.js +783 -0
- package/skill/tools/node_modules/undici/package.json +154 -0
- package/skill/tools/node_modules/undici/scripts/strip-comments.js +10 -0
- package/skill/tools/node_modules/undici/types/README.md +6 -0
- package/skill/tools/node_modules/undici/types/agent.d.ts +30 -0
- package/skill/tools/node_modules/undici/types/api.d.ts +43 -0
- package/skill/tools/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/skill/tools/node_modules/undici/types/cache-interceptor.d.ts +189 -0
- package/skill/tools/node_modules/undici/types/cache.d.ts +36 -0
- package/skill/tools/node_modules/undici/types/client-stats.d.ts +15 -0
- package/skill/tools/node_modules/undici/types/client.d.ts +190 -0
- package/skill/tools/node_modules/undici/types/connector.d.ts +37 -0
- package/skill/tools/node_modules/undici/types/content-type.d.ts +21 -0
- package/skill/tools/node_modules/undici/types/cookies.d.ts +30 -0
- package/skill/tools/node_modules/undici/types/diagnostics-channel.d.ts +75 -0
- package/skill/tools/node_modules/undici/types/dispatcher.d.ts +253 -0
- package/skill/tools/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
- package/skill/tools/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/skill/tools/node_modules/undici/types/errors.d.ts +202 -0
- package/skill/tools/node_modules/undici/types/eventsource.d.ts +66 -0
- package/skill/tools/node_modules/undici/types/fetch.d.ts +235 -0
- package/skill/tools/node_modules/undici/types/formdata.d.ts +108 -0
- package/skill/tools/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/skill/tools/node_modules/undici/types/global-origin.d.ts +7 -0
- package/skill/tools/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/skill/tools/node_modules/undici/types/handlers.d.ts +16 -0
- package/skill/tools/node_modules/undici/types/header.d.ts +165 -0
- package/skill/tools/node_modules/undici/types/index.d.ts +93 -0
- package/skill/tools/node_modules/undici/types/interceptors.d.ts +87 -0
- package/skill/tools/node_modules/undici/types/mock-agent.d.ts +69 -0
- package/skill/tools/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/skill/tools/node_modules/undici/types/mock-client.d.ts +27 -0
- package/skill/tools/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/skill/tools/node_modules/undici/types/mock-interceptor.d.ts +98 -0
- package/skill/tools/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/skill/tools/node_modules/undici/types/patch.d.ts +29 -0
- package/skill/tools/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/skill/tools/node_modules/undici/types/pool.d.ts +39 -0
- package/skill/tools/node_modules/undici/types/proxy-agent.d.ts +36 -0
- package/skill/tools/node_modules/undici/types/readable.d.ts +68 -0
- package/skill/tools/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/skill/tools/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/skill/tools/node_modules/undici/types/round-robin-pool.d.ts +39 -0
- package/skill/tools/node_modules/undici/types/snapshot-agent.d.ts +113 -0
- package/skill/tools/node_modules/undici/types/socks5-proxy-agent.d.ts +27 -0
- package/skill/tools/node_modules/undici/types/util.d.ts +18 -0
- package/skill/tools/node_modules/undici/types/utility.d.ts +7 -0
- package/skill/tools/node_modules/undici/types/webidl.d.ts +352 -0
- package/skill/tools/node_modules/undici/types/websocket.d.ts +188 -0
- package/skill/tools/node_modules/xtend/.jshintrc +30 -0
- package/skill/tools/node_modules/xtend/LICENSE +20 -0
- package/skill/tools/node_modules/xtend/README.md +32 -0
- package/skill/tools/node_modules/xtend/immutable.js +19 -0
- package/skill/tools/node_modules/xtend/mutable.js +17 -0
- package/skill/tools/node_modules/xtend/package.json +55 -0
- package/skill/tools/node_modules/xtend/test.js +103 -0
- package/skill/tools/package-lock.json +172 -0
- package/skill/tools/package.json +9 -0
- package/skill/tools/transfer_core.js +414 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# RedirectHandler
|
|
2
|
+
|
|
3
|
+
<!--introduced_in=v4.0.0-->
|
|
4
|
+
<!--type=module-->
|
|
5
|
+
<!-- source_link=lib/handler/redirect-handler.js -->
|
|
6
|
+
|
|
7
|
+
> Stability: 2 - Stable
|
|
8
|
+
|
|
9
|
+
A dispatch handler that follows HTTP redirects on behalf of another handler. It
|
|
10
|
+
wraps a downstream `handler` and a `dispatch` function: when a redirectable
|
|
11
|
+
response is received it transparently re-dispatches the request to the new
|
|
12
|
+
location, forwarding the lifecycle callbacks to the wrapped `handler` only once a
|
|
13
|
+
final (non-redirect) response is reached.
|
|
14
|
+
|
|
15
|
+
Redirects are followed for the `300`, `301`, `302`, `303`, `307`, and `308`
|
|
16
|
+
status codes, up to `maxRedirections` hops. Following the relevant HTTP
|
|
17
|
+
specifications, the method is downgraded to `GET` for `301`/`302` `POST`
|
|
18
|
+
responses and for `303` responses with any method other than `HEAD`, request
|
|
19
|
+
bodies that have already been consumed are not replayed, and headers that refer
|
|
20
|
+
to the original URL (such as `host`) are stripped on each hop, with additional
|
|
21
|
+
credential headers removed on cross-origin redirects.
|
|
22
|
+
|
|
23
|
+
```mjs
|
|
24
|
+
import { RedirectHandler } from 'undici'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```cjs
|
|
28
|
+
const { RedirectHandler } = require('undici')
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Most users do not construct `RedirectHandler` directly. The `maxRedirections`
|
|
32
|
+
option on [`Dispatcher`][] methods and the higher-level clients use it
|
|
33
|
+
internally.
|
|
34
|
+
|
|
35
|
+
## Class: `RedirectHandler`
|
|
36
|
+
|
|
37
|
+
<!-- YAML
|
|
38
|
+
added: v4.0.0
|
|
39
|
+
-->
|
|
40
|
+
|
|
41
|
+
* Extends: {DispatchHandler}
|
|
42
|
+
|
|
43
|
+
Implements the [`DispatchHandler`][] interface, delegating every callback to the
|
|
44
|
+
wrapped `handler` while intercepting redirect responses.
|
|
45
|
+
|
|
46
|
+
### `new RedirectHandler(dispatch, maxRedirections, opts, handler)`
|
|
47
|
+
|
|
48
|
+
<!-- YAML
|
|
49
|
+
added: v4.0.0
|
|
50
|
+
-->
|
|
51
|
+
|
|
52
|
+
* `dispatch` {Function} The dispatch function used to issue the original request
|
|
53
|
+
and every subsequent redirect. Called as `dispatch(options, handler)`.
|
|
54
|
+
* `maxRedirections` {number|null} The maximum number of redirects to follow. Must
|
|
55
|
+
be a non-negative integer or `null`. When `null` or `0`, no redirects are
|
|
56
|
+
followed and redirect responses are passed through to the wrapped `handler`.
|
|
57
|
+
* `opts` {DispatchOptions} The dispatch options for the request. In addition to
|
|
58
|
+
the standard dispatch options, the following redirect-specific fields are
|
|
59
|
+
recognized:
|
|
60
|
+
* `throwOnMaxRedirect` {boolean} When `true`, an error is thrown when a
|
|
61
|
+
redirect would be followed but `maxRedirections` has been reached, instead of
|
|
62
|
+
returning that redirect response. A non-redirect response after exactly
|
|
63
|
+
`maxRedirections` redirects is returned normally. **Default:** `false`.
|
|
64
|
+
* `stripHeadersOnRedirect` {string[]} Header names to remove from the request on
|
|
65
|
+
every redirect hop. **Default:** `null`.
|
|
66
|
+
* `stripHeadersOnCrossOriginRedirect` {string[]} Additional header names to
|
|
67
|
+
remove from the request when a redirect points to a different origin.
|
|
68
|
+
**Default:** `null`.
|
|
69
|
+
* `handler` {DispatchHandler} The downstream handler that receives the lifecycle
|
|
70
|
+
callbacks for the final response.
|
|
71
|
+
|
|
72
|
+
Throws an [`InvalidArgumentError`][] when `maxRedirections` is not a non-negative
|
|
73
|
+
integer, when `throwOnMaxRedirect` is not a boolean, or when either
|
|
74
|
+
`stripHeadersOnRedirect` or `stripHeadersOnCrossOriginRedirect` is not an array of
|
|
75
|
+
header-name strings.
|
|
76
|
+
|
|
77
|
+
```mjs
|
|
78
|
+
import { Client, RedirectHandler } from 'undici'
|
|
79
|
+
|
|
80
|
+
const client = new Client('http://example.com')
|
|
81
|
+
const dispatch = client.dispatch.bind(client)
|
|
82
|
+
|
|
83
|
+
const handler = new RedirectHandler(dispatch, 5, {
|
|
84
|
+
method: 'GET',
|
|
85
|
+
path: '/',
|
|
86
|
+
origin: 'http://example.com',
|
|
87
|
+
}, {
|
|
88
|
+
onRequestStart () {},
|
|
89
|
+
onResponseStart (controller, statusCode, headers) {
|
|
90
|
+
console.log(statusCode)
|
|
91
|
+
},
|
|
92
|
+
onResponseData (controller, chunk) {},
|
|
93
|
+
onResponseEnd () {},
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
dispatch({ method: 'GET', path: '/', origin: 'http://example.com' }, handler)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Static method: `RedirectHandler.buildDispatch(dispatcher, maxRedirections)`
|
|
100
|
+
|
|
101
|
+
<!-- YAML
|
|
102
|
+
added: v7.0.0
|
|
103
|
+
-->
|
|
104
|
+
|
|
105
|
+
* `dispatcher` {Dispatcher} The dispatcher whose `dispatch` method is wrapped.
|
|
106
|
+
* `maxRedirections` {number|null} The maximum number of redirects to follow. Must
|
|
107
|
+
be a non-negative integer or `null`.
|
|
108
|
+
* Returns: {Function} A `dispatch(options, handler)` function that wraps each call
|
|
109
|
+
in a `RedirectHandler` before delegating to `dispatcher`.
|
|
110
|
+
|
|
111
|
+
Builds a redirect-aware dispatch function from an existing dispatcher. The
|
|
112
|
+
returned function has the same shape as `dispatcher.dispatch` but follows
|
|
113
|
+
redirects automatically. Throws an [`InvalidArgumentError`][] when
|
|
114
|
+
`maxRedirections` is not a non-negative integer.
|
|
115
|
+
|
|
116
|
+
```mjs
|
|
117
|
+
import { Client, RedirectHandler } from 'undici'
|
|
118
|
+
|
|
119
|
+
const client = new Client('http://example.com')
|
|
120
|
+
const dispatch = RedirectHandler.buildDispatch(client, 5)
|
|
121
|
+
|
|
122
|
+
dispatch({ method: 'GET', path: '/', origin: 'http://example.com' }, {
|
|
123
|
+
onRequestStart () {},
|
|
124
|
+
onResponseStart (controller, statusCode) {
|
|
125
|
+
console.log(statusCode)
|
|
126
|
+
},
|
|
127
|
+
onResponseData () {},
|
|
128
|
+
onResponseEnd () {},
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `redirectHandler.onRequestStart(controller, context)`
|
|
133
|
+
|
|
134
|
+
<!-- YAML
|
|
135
|
+
added: v7.0.0
|
|
136
|
+
-->
|
|
137
|
+
|
|
138
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
139
|
+
* `context` {Object} The dispatch context.
|
|
140
|
+
|
|
141
|
+
Forwards the request-start event to the wrapped `handler`, augmenting `context`
|
|
142
|
+
with the current redirect `history`.
|
|
143
|
+
|
|
144
|
+
### `redirectHandler.onRequestUpgrade(controller, statusCode, headers, socket)`
|
|
145
|
+
|
|
146
|
+
<!-- YAML
|
|
147
|
+
added: v7.0.0
|
|
148
|
+
-->
|
|
149
|
+
|
|
150
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
151
|
+
* `statusCode` {number} The HTTP status code of the upgrade response.
|
|
152
|
+
* `headers` {Object} The response headers.
|
|
153
|
+
* `socket` {Duplex} The upgraded socket.
|
|
154
|
+
|
|
155
|
+
Forwards a connection upgrade to the wrapped `handler`.
|
|
156
|
+
|
|
157
|
+
### `redirectHandler.onResponseStart(controller, statusCode, headers, statusMessage)`
|
|
158
|
+
|
|
159
|
+
<!-- YAML
|
|
160
|
+
added: v7.0.0
|
|
161
|
+
-->
|
|
162
|
+
|
|
163
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
164
|
+
* `statusCode` {number} The HTTP status code of the response.
|
|
165
|
+
* `headers` {Object} The response headers.
|
|
166
|
+
* `statusMessage` {string} The HTTP status message.
|
|
167
|
+
|
|
168
|
+
Inspects the response headers to decide whether to follow a redirect. When the
|
|
169
|
+
status code is redirectable, the response has a `Location` header, the
|
|
170
|
+
`maxRedirections` limit has not been reached, and the request body has not been
|
|
171
|
+
consumed, the `location` property is set, the method and headers are adjusted
|
|
172
|
+
for the next hop, and the response is not forwarded. Otherwise the event is
|
|
173
|
+
forwarded to the wrapped `handler`.
|
|
174
|
+
|
|
175
|
+
Throws when `throwOnMaxRedirect` is `true` and a redirect that would otherwise be
|
|
176
|
+
followed arrives after `maxRedirections` redirects have already been followed,
|
|
177
|
+
and throws an [`InvalidArgumentError`][] if a
|
|
178
|
+
redirect loop is detected (for example when a [`Client`][] or [`Pool`][] is used
|
|
179
|
+
for a cross-origin redirect; use an [`Agent`][] instead).
|
|
180
|
+
|
|
181
|
+
### `redirectHandler.onResponseData(controller, chunk)`
|
|
182
|
+
|
|
183
|
+
<!-- YAML
|
|
184
|
+
added: v7.0.0
|
|
185
|
+
-->
|
|
186
|
+
|
|
187
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
188
|
+
* `chunk` {Buffer} A chunk of the response body.
|
|
189
|
+
|
|
190
|
+
Forwards body data to the wrapped `handler`. While a redirect is pending
|
|
191
|
+
(`location` is set), the `3xx` response body is ignored.
|
|
192
|
+
|
|
193
|
+
### `redirectHandler.onResponseEnd(controller, trailers)`
|
|
194
|
+
|
|
195
|
+
<!-- YAML
|
|
196
|
+
added: v7.0.0
|
|
197
|
+
-->
|
|
198
|
+
|
|
199
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
200
|
+
* `trailers` {Object} The response trailers.
|
|
201
|
+
|
|
202
|
+
Completes the response. When a redirect is pending, the request is re-dispatched
|
|
203
|
+
to the new `location`; otherwise the end event is forwarded to the wrapped
|
|
204
|
+
`handler`.
|
|
205
|
+
|
|
206
|
+
### `redirectHandler.onResponseError(controller, error)`
|
|
207
|
+
|
|
208
|
+
<!-- YAML
|
|
209
|
+
added: v7.0.0
|
|
210
|
+
-->
|
|
211
|
+
|
|
212
|
+
* `controller` {DispatchController} The controller for the in-flight request.
|
|
213
|
+
* `error` {Error} The error that occurred.
|
|
214
|
+
|
|
215
|
+
Forwards the error to the wrapped `handler`.
|
|
216
|
+
|
|
217
|
+
### `redirectHandler.location`
|
|
218
|
+
|
|
219
|
+
<!-- YAML
|
|
220
|
+
added: v4.0.0
|
|
221
|
+
-->
|
|
222
|
+
|
|
223
|
+
* Type: {string|null}
|
|
224
|
+
|
|
225
|
+
The `Location` header value of the redirect currently being followed, or `null`
|
|
226
|
+
when no redirect is pending and the response is being passed through to the
|
|
227
|
+
wrapped `handler`.
|
|
228
|
+
|
|
229
|
+
### `redirectHandler.opts`
|
|
230
|
+
|
|
231
|
+
<!-- YAML
|
|
232
|
+
added: v7.12.0
|
|
233
|
+
-->
|
|
234
|
+
|
|
235
|
+
* Type: {DispatchOptions}
|
|
236
|
+
|
|
237
|
+
A copy of the dispatch options for the next request. It excludes the redirect
|
|
238
|
+
control fields (`maxRedirections`, `stripHeadersOnRedirect`, and
|
|
239
|
+
`stripHeadersOnCrossOriginRedirect`) and is mutated on each hop to reflect the
|
|
240
|
+
updated method, path, origin, and headers.
|
|
241
|
+
|
|
242
|
+
### `redirectHandler.maxRedirections`
|
|
243
|
+
|
|
244
|
+
<!-- YAML
|
|
245
|
+
added: v4.0.0
|
|
246
|
+
-->
|
|
247
|
+
|
|
248
|
+
* Type: {number|null}
|
|
249
|
+
|
|
250
|
+
The maximum number of redirects this handler will follow.
|
|
251
|
+
|
|
252
|
+
### `redirectHandler.handler`
|
|
253
|
+
|
|
254
|
+
<!-- YAML
|
|
255
|
+
added: v4.0.0
|
|
256
|
+
-->
|
|
257
|
+
|
|
258
|
+
* Type: {DispatchHandler}
|
|
259
|
+
|
|
260
|
+
The wrapped downstream handler that receives the lifecycle callbacks for the final
|
|
261
|
+
response.
|
|
262
|
+
|
|
263
|
+
### `redirectHandler.history`
|
|
264
|
+
|
|
265
|
+
<!-- YAML
|
|
266
|
+
added: v4.0.0
|
|
267
|
+
-->
|
|
268
|
+
|
|
269
|
+
* Type: {URL[]}
|
|
270
|
+
|
|
271
|
+
The ordered list of URLs visited while following redirects. It is used to enforce
|
|
272
|
+
`maxRedirections` and to detect redirect loops.
|
|
273
|
+
|
|
274
|
+
[`Agent`]: Agent.md#class-agent
|
|
275
|
+
[`Client`]: Client.md#class-client
|
|
276
|
+
[`Dispatcher`]: Dispatcher.md#class-dispatcher
|
|
277
|
+
[`DispatchHandler`]: Dispatcher.md#parameter-dispatchhandler
|
|
278
|
+
[`InvalidArgumentError`]: Errors.md#class-invalidargumenterror
|
|
279
|
+
[`Pool`]: Pool.md#class-pool
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# RetryAgent
|
|
2
|
+
|
|
3
|
+
<!--introduced_in=v6.7.0-->
|
|
4
|
+
<!--type=module-->
|
|
5
|
+
<!-- source_link=lib/dispatcher/retry-agent.js -->
|
|
6
|
+
|
|
7
|
+
> Stability: 2 - Stable
|
|
8
|
+
|
|
9
|
+
A [`Dispatcher`][] that automatically retries failed requests by wrapping
|
|
10
|
+
another dispatcher with the retry logic of [`RetryHandler`][]. Requests that fail
|
|
11
|
+
with a retryable status code or transport error are re-dispatched according to
|
|
12
|
+
the configured retry policy.
|
|
13
|
+
|
|
14
|
+
```mjs
|
|
15
|
+
import { RetryAgent } from 'undici'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Class: `RetryAgent`
|
|
19
|
+
|
|
20
|
+
<!-- YAML
|
|
21
|
+
added: v6.7.0
|
|
22
|
+
-->
|
|
23
|
+
|
|
24
|
+
* Extends: {Dispatcher}
|
|
25
|
+
|
|
26
|
+
Wraps an existing dispatcher and applies retry behaviour to every request it
|
|
27
|
+
dispatches. Lifecycle methods such as [`retryAgent.close()`][] and
|
|
28
|
+
[`retryAgent.destroy()`][] are forwarded to the wrapped dispatcher.
|
|
29
|
+
|
|
30
|
+
### `new RetryAgent(dispatcher[, options])`
|
|
31
|
+
|
|
32
|
+
<!-- YAML
|
|
33
|
+
added: v6.7.0
|
|
34
|
+
-->
|
|
35
|
+
|
|
36
|
+
* `dispatcher` {Dispatcher} The dispatcher to wrap and add retry behaviour to.
|
|
37
|
+
* `options` {RetryOptions} (optional)
|
|
38
|
+
* `throwOnError` {boolean} When `true`, an error is thrown on the final retry
|
|
39
|
+
attempt, preventing the following handlers from being called and destroying
|
|
40
|
+
the socket. Disable it when you need the response body for error responses
|
|
41
|
+
or when you provide a custom error handler. **Default:** `true`.
|
|
42
|
+
* `retry` {Function} Callback invoked on every retry iteration. It receives the
|
|
43
|
+
error, the current retry state, and a callback. Pass an error to the callback
|
|
44
|
+
to stop retrying, or call it with no argument to perform the retry.
|
|
45
|
+
* `err` {Error} The error that caused the retry attempt.
|
|
46
|
+
* `context` {RetryContext} The current retry context.
|
|
47
|
+
* `state` {RetryState} The mutable retry state.
|
|
48
|
+
* `counter` {number} The number of retries performed so far.
|
|
49
|
+
* `opts` {Object} The options passed to the retry handler, combining the
|
|
50
|
+
dispatch options with `retryOptions`.
|
|
51
|
+
* `callback` {Function} Called to continue. Pass an `Error` to stop retrying,
|
|
52
|
+
or `null`/`undefined` to perform the next retry.
|
|
53
|
+
* `maxRetries` {number} Maximum number of retries to allow. **Default:** `5`.
|
|
54
|
+
* `maxTimeout` {number} Maximum number of milliseconds to wait between retries.
|
|
55
|
+
**Default:** `30000` (30 seconds).
|
|
56
|
+
* `minTimeout` {number} Initial number of milliseconds to wait before the first
|
|
57
|
+
retry. **Default:** `500` (half a second).
|
|
58
|
+
* `timeoutFactor` {number} Factor by which the timeout is multiplied between
|
|
59
|
+
retries. **Default:** `2`.
|
|
60
|
+
* `retryAfter` {boolean} When `true`, the delay between retries is inferred from
|
|
61
|
+
the `Retry-After` response header when present. **Default:** `true`.
|
|
62
|
+
* `methods` {string[]} HTTP methods that are eligible for retry.
|
|
63
|
+
**Default:** `['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE', 'QUERY']`.
|
|
64
|
+
* `statusCodes` {number[]} HTTP status codes that trigger a retry.
|
|
65
|
+
**Default:** `[500, 502, 503, 504, 429]`.
|
|
66
|
+
* `errorCodes` {string[]} Transport error codes that trigger a retry.
|
|
67
|
+
**Default:** `['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'ENETDOWN', 'ENETUNREACH', 'EHOSTDOWN', 'EHOSTUNREACH', 'EPIPE', 'UND_ERR_SOCKET']`.
|
|
68
|
+
|
|
69
|
+
Creates a new `RetryAgent` that wraps `dispatcher`. The `options` are stored and
|
|
70
|
+
used to construct a [`RetryHandler`][] for each dispatched request.
|
|
71
|
+
|
|
72
|
+
```mjs
|
|
73
|
+
import { Agent, RetryAgent } from 'undici'
|
|
74
|
+
|
|
75
|
+
const agent = new RetryAgent(new Agent(), {
|
|
76
|
+
maxRetries: 3,
|
|
77
|
+
minTimeout: 1000,
|
|
78
|
+
timeoutFactor: 2,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const res = await agent.request({
|
|
82
|
+
method: 'GET',
|
|
83
|
+
origin: 'http://example.com',
|
|
84
|
+
path: '/',
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
console.log(res.statusCode)
|
|
88
|
+
console.log(await res.body.text())
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `retryAgent.dispatch(options, handler)`
|
|
92
|
+
|
|
93
|
+
<!-- YAML
|
|
94
|
+
added: v6.7.0
|
|
95
|
+
-->
|
|
96
|
+
|
|
97
|
+
* `options` {DispatchOptions} The dispatch options, identical to
|
|
98
|
+
[`dispatcher.dispatch()`][].
|
|
99
|
+
* `handler` {DispatchHandler} The dispatch handler.
|
|
100
|
+
* Returns: {boolean}
|
|
101
|
+
|
|
102
|
+
Dispatches `options` through the wrapped dispatcher, installing a
|
|
103
|
+
[`RetryHandler`][] that applies the configured retry policy before delegating to
|
|
104
|
+
`handler`. Returns `false` if the dispatcher is busy and the caller should wait
|
|
105
|
+
before dispatching again, otherwise `true`.
|
|
106
|
+
|
|
107
|
+
### `retryAgent.close()`
|
|
108
|
+
|
|
109
|
+
<!-- YAML
|
|
110
|
+
added: v6.7.0
|
|
111
|
+
-->
|
|
112
|
+
|
|
113
|
+
* Returns: {Promise} Resolves when the wrapped dispatcher has closed.
|
|
114
|
+
|
|
115
|
+
Gracefully closes the wrapped dispatcher, waiting for in-flight requests to
|
|
116
|
+
complete. Equivalent to calling [`dispatcher.close()`][] on the wrapped
|
|
117
|
+
dispatcher.
|
|
118
|
+
|
|
119
|
+
### `retryAgent.destroy()`
|
|
120
|
+
|
|
121
|
+
<!-- YAML
|
|
122
|
+
added: v6.7.0
|
|
123
|
+
-->
|
|
124
|
+
|
|
125
|
+
* Returns: {Promise} Resolves when the wrapped dispatcher has been destroyed.
|
|
126
|
+
|
|
127
|
+
Forcefully destroys the wrapped dispatcher, aborting all pending requests.
|
|
128
|
+
Equivalent to calling [`dispatcher.destroy()`][] on the wrapped dispatcher.
|
|
129
|
+
|
|
130
|
+
[`Dispatcher`]: Dispatcher.md#class-dispatcher
|
|
131
|
+
[`RetryHandler`]: RetryHandler.md#class-retryhandler
|
|
132
|
+
[`dispatcher.close()`]: Dispatcher.md#dispatcherclosecallback
|
|
133
|
+
[`dispatcher.destroy()`]: Dispatcher.md#dispatcherdestroyerror-callback
|
|
134
|
+
[`dispatcher.dispatch()`]: Dispatcher.md#dispatcherdispatchoptions-handler
|
|
135
|
+
[`retryAgent.close()`]: #retryagentclose
|
|
136
|
+
[`retryAgent.destroy()`]: #retryagentdestroy
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# RetryHandler
|
|
2
|
+
|
|
3
|
+
<!--introduced_in=v5.28.0-->
|
|
4
|
+
<!--type=module-->
|
|
5
|
+
<!-- source_link=lib/handler/retry-handler.js -->
|
|
6
|
+
|
|
7
|
+
> Stability: 2 - Stable
|
|
8
|
+
|
|
9
|
+
A [`Dispatcher`][] handler that automatically retries a request when it fails
|
|
10
|
+
with a recoverable network error or an eligible HTTP status code. It wraps an
|
|
11
|
+
inner handler and re-dispatches the request, applying an exponential backoff and
|
|
12
|
+
honouring the `Retry-After` response header. When a response is partially
|
|
13
|
+
consumed before the failure, the handler resumes the download with a `Range`
|
|
14
|
+
request guarded by the original `ETag`.
|
|
15
|
+
|
|
16
|
+
The handler is most often used indirectly through [`RetryAgent`][], but it can
|
|
17
|
+
also be supplied directly to [`dispatcher.dispatch()`][] for fine-grained
|
|
18
|
+
control over the retry behaviour.
|
|
19
|
+
|
|
20
|
+
```mjs
|
|
21
|
+
import { RetryHandler } from 'undici'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Class: `RetryHandler`
|
|
25
|
+
|
|
26
|
+
<!-- YAML
|
|
27
|
+
added: v5.28.0
|
|
28
|
+
-->
|
|
29
|
+
|
|
30
|
+
* Extends: {DispatchHandler}
|
|
31
|
+
|
|
32
|
+
Implements the [`DispatchHandler`][] interface. An instance is consumed by a
|
|
33
|
+
single dispatch call and forwards the dispatch lifecycle to the inner `handler`,
|
|
34
|
+
re-issuing the request through the supplied `dispatch` function whenever a retry
|
|
35
|
+
is warranted.
|
|
36
|
+
|
|
37
|
+
> **Note:** The `RetryHandler` does not retry over stateful bodies (for example
|
|
38
|
+
> streams or `AsyncIterable`), because once consumed they cannot be replayed. In
|
|
39
|
+
> these situations the body is identified as stateful and the request is rejected
|
|
40
|
+
> with the `UND_ERR_REQ_RETRY` error instead of being retried.
|
|
41
|
+
|
|
42
|
+
### `new RetryHandler(options, retryHandlers)`
|
|
43
|
+
|
|
44
|
+
<!-- YAML
|
|
45
|
+
added: v5.28.0
|
|
46
|
+
changes:
|
|
47
|
+
- version: v7.0.0
|
|
48
|
+
pr-url: https://github.com/nodejs/undici/pull/3883
|
|
49
|
+
description: Reimplemented on top of the new dispatch lifecycle hooks.
|
|
50
|
+
-->
|
|
51
|
+
|
|
52
|
+
* `options` {DispatchOptions} The dispatch options for the request, extended with
|
|
53
|
+
an optional `retryOptions` field. Type is
|
|
54
|
+
`DispatchOptions & { retryOptions?: RetryOptions }`.
|
|
55
|
+
* `retryOptions` {RetryOptions} (optional) Configuration controlling when and
|
|
56
|
+
how the request is retried. See [`RetryOptions`](#retryoptions).
|
|
57
|
+
* `retryHandlers` {RetryHandlers} The handlers used to drive the retry loop. See
|
|
58
|
+
[`RetryHandlers`](#parameter-retryhandlers).
|
|
59
|
+
* Returns: {RetryHandler}
|
|
60
|
+
|
|
61
|
+
#### `RetryOptions`
|
|
62
|
+
|
|
63
|
+
* `throwOnError` {boolean} When `true`, an error is thrown on the last retry
|
|
64
|
+
attempt and propagated to the inner handler; when `false`, the failing response
|
|
65
|
+
is passed through instead, which is useful when the error body is needed or a
|
|
66
|
+
custom error handler is in place. **Default:** `true`.
|
|
67
|
+
* `retry` {Function} Callback invoked on every retry iteration to decide whether
|
|
68
|
+
another attempt should be made. It receives the error, the retry context, and a
|
|
69
|
+
callback. Call the callback with an `Error` to stop retrying, or with `null` to
|
|
70
|
+
schedule another attempt. **Default:** the built-in retry strategy described
|
|
71
|
+
below.
|
|
72
|
+
* `err` {Error} The error that triggered the retry.
|
|
73
|
+
* `context` {RetryContext} The current retry context. See
|
|
74
|
+
[`RetryContext`](#retrycontext).
|
|
75
|
+
* `callback` {Function} Signals the outcome of this iteration.
|
|
76
|
+
* `result` {Error|null} (optional) An `Error` to abort retrying, or `null` to
|
|
77
|
+
retry.
|
|
78
|
+
* `maxRetries` {number} Maximum number of retries allowed. **Default:** `5`.
|
|
79
|
+
* `maxTimeout` {number} Maximum number of milliseconds to wait between retries.
|
|
80
|
+
**Default:** `30000` (30 seconds).
|
|
81
|
+
* `minTimeout` {number} Initial number of milliseconds to wait before the first
|
|
82
|
+
retry. **Default:** `500` (half a second).
|
|
83
|
+
* `timeoutFactor` {number} Multiplier applied to the timeout between successive
|
|
84
|
+
retries to produce an exponential backoff. **Default:** `2`.
|
|
85
|
+
* `retryAfter` {boolean} When `true`, the delay before the next retry is inferred
|
|
86
|
+
from the `Retry-After` response header when present. **Default:** `true`.
|
|
87
|
+
* `methods` {string[]} HTTP methods that are eligible for retrying. **Default:**
|
|
88
|
+
`['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE', 'QUERY']`.
|
|
89
|
+
* `statusCodes` {number[]} HTTP status codes that trigger a retry. **Default:**
|
|
90
|
+
`[500, 502, 503, 504, 429]`.
|
|
91
|
+
* `errorCodes` {string[]} Network error codes that trigger a retry. **Default:**
|
|
92
|
+
`['ECONNRESET', 'ECONNREFUSED', 'ENOTFOUND', 'ENETDOWN', 'ENETUNREACH', 'EHOSTDOWN', 'EHOSTUNREACH', 'EPIPE', 'UND_ERR_SOCKET']`.
|
|
93
|
+
|
|
94
|
+
The default `retry` strategy computes the delay before the next attempt as
|
|
95
|
+
`minTimeout * timeoutFactor ** (counter - 1)`, capped at `maxTimeout`. When a
|
|
96
|
+
`Retry-After` header is present it takes precedence (interpreted as seconds, or as
|
|
97
|
+
an HTTP date), still capped at `maxTimeout`. The default strategy stops retrying
|
|
98
|
+
once `counter` exceeds `maxRetries`, when the error code is not in `errorCodes`,
|
|
99
|
+
when the method is not in `methods`, or when the response status code is not in
|
|
100
|
+
`statusCodes`.
|
|
101
|
+
|
|
102
|
+
#### `RetryContext`
|
|
103
|
+
|
|
104
|
+
* `state` {RetryState} The current retry state. See [`RetryState`](#retrystate).
|
|
105
|
+
* `opts` {DispatchOptions} The dispatch options passed to the handler, including
|
|
106
|
+
the resolved `retryOptions`. Type is
|
|
107
|
+
`DispatchOptions & { retryOptions?: RetryOptions }`.
|
|
108
|
+
|
|
109
|
+
The context object passed as the second argument to the `retry` callback.
|
|
110
|
+
|
|
111
|
+
#### `RetryState`
|
|
112
|
+
|
|
113
|
+
* `counter` {number} The current retry attempt, starting at `1` for the first
|
|
114
|
+
retry.
|
|
115
|
+
|
|
116
|
+
Represents the retry state for a given request.
|
|
117
|
+
|
|
118
|
+
#### Parameter: `RetryHandlers`
|
|
119
|
+
|
|
120
|
+
* `dispatch` {Function} The dispatch function called to (re-)issue the request on
|
|
121
|
+
every attempt. Type is `(options, handler) => boolean`.
|
|
122
|
+
* `handler` {DispatchHandler} The inner handler invoked once the request succeeds
|
|
123
|
+
or the retries are exhausted.
|
|
124
|
+
|
|
125
|
+
### Examples
|
|
126
|
+
|
|
127
|
+
```mjs
|
|
128
|
+
import { Client, RetryHandler } from 'undici'
|
|
129
|
+
|
|
130
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
131
|
+
const chunks = []
|
|
132
|
+
|
|
133
|
+
const handler = new RetryHandler(
|
|
134
|
+
{
|
|
135
|
+
...dispatchOptions,
|
|
136
|
+
retryOptions: {
|
|
137
|
+
// Custom retry decision function.
|
|
138
|
+
retry (err, { state, opts }, callback) {
|
|
139
|
+
if (err.code === 'UND_ERR_DESTROYED') {
|
|
140
|
+
callback(err)
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (err.statusCode === 206) {
|
|
145
|
+
callback(err)
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
setTimeout(() => callback(null), 1000)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
dispatch (...args) {
|
|
155
|
+
return client.dispatch(...args)
|
|
156
|
+
},
|
|
157
|
+
handler: {
|
|
158
|
+
onRequestStart () {},
|
|
159
|
+
onResponseStart (controller, status, headers) {
|
|
160
|
+
// Do something with the response headers.
|
|
161
|
+
},
|
|
162
|
+
onResponseData (controller, chunk) {
|
|
163
|
+
chunks.push(chunk)
|
|
164
|
+
},
|
|
165
|
+
onResponseEnd () {},
|
|
166
|
+
onResponseError (controller, err) {
|
|
167
|
+
// Handle the error.
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
client.dispatch(dispatchOptions, handler)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
A minimal handler that relies entirely on the default retry options:
|
|
177
|
+
|
|
178
|
+
```mjs
|
|
179
|
+
import { Client, RetryHandler } from 'undici'
|
|
180
|
+
|
|
181
|
+
const client = new Client(`http://localhost:${server.address().port}`)
|
|
182
|
+
|
|
183
|
+
const handler = new RetryHandler(dispatchOptions, {
|
|
184
|
+
dispatch: client.dispatch.bind(client),
|
|
185
|
+
handler: {
|
|
186
|
+
onRequestStart () {},
|
|
187
|
+
onResponseStart (controller, status, headers) {},
|
|
188
|
+
onResponseData (controller, chunk) {},
|
|
189
|
+
onResponseEnd () {},
|
|
190
|
+
onResponseError (controller, err) {}
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
client.dispatch(dispatchOptions, handler)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
[`Dispatcher`]: Dispatcher.md#class-dispatcher
|
|
198
|
+
[`DispatchHandler`]: Dispatcher.md#parameter-dispatchhandler
|
|
199
|
+
[`RetryAgent`]: RetryAgent.md#class-retryagent
|
|
200
|
+
[`dispatcher.dispatch()`]: Dispatcher.md#dispatcherdispatchoptions-handler
|