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,188 @@
|
|
|
1
|
+
# CacheStorage
|
|
2
|
+
|
|
3
|
+
<!--introduced_in=v5.22.1-->
|
|
4
|
+
<!--type=module-->
|
|
5
|
+
<!-- source_link=lib/web/cache/cachestorage.js -->
|
|
6
|
+
|
|
7
|
+
> Stability: 2 - Stable
|
|
8
|
+
|
|
9
|
+
undici provides a spec-compliant implementation of the [W3C Service Worker
|
|
10
|
+
`CacheStorage`][] and [`Cache`][] interfaces. A `CacheStorage` is a named
|
|
11
|
+
collection of [`Cache`][] objects, each of which stores `Request`/`Response`
|
|
12
|
+
pairs.
|
|
13
|
+
|
|
14
|
+
The class itself is not exported; instead, undici exposes a single shared
|
|
15
|
+
`CacheStorage` instance named `caches`. Import it from `'undici'`:
|
|
16
|
+
|
|
17
|
+
```mjs
|
|
18
|
+
import { caches } from 'undici'
|
|
19
|
+
|
|
20
|
+
const cache = await caches.open('v1')
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```cjs
|
|
24
|
+
const { caches } = require('undici')
|
|
25
|
+
|
|
26
|
+
caches.open('v1').then((cache) => {
|
|
27
|
+
// ...
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## `caches`
|
|
32
|
+
|
|
33
|
+
<!-- YAML
|
|
34
|
+
added: v5.22.1
|
|
35
|
+
-->
|
|
36
|
+
|
|
37
|
+
* Type: {CacheStorage}
|
|
38
|
+
|
|
39
|
+
The shared [`CacheStorage`](#class-cachestorage) instance exported by undici.
|
|
40
|
+
All caches opened through `caches` live for the lifetime of the process.
|
|
41
|
+
|
|
42
|
+
```mjs
|
|
43
|
+
import { caches } from 'undici'
|
|
44
|
+
|
|
45
|
+
await caches.open('v1')
|
|
46
|
+
console.log(await caches.keys()) // ['v1']
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Class: `CacheStorage`
|
|
50
|
+
|
|
51
|
+
<!-- YAML
|
|
52
|
+
added: v5.22.1
|
|
53
|
+
-->
|
|
54
|
+
|
|
55
|
+
Represents the storage for [`Cache`][] objects. Each `CacheStorage` keeps a
|
|
56
|
+
mapping of cache names to their backing list of cached responses.
|
|
57
|
+
|
|
58
|
+
The constructor is not public: attempting to instantiate `CacheStorage`
|
|
59
|
+
directly throws a `TypeError`. Use the exported [`caches`](#caches) instance
|
|
60
|
+
instead.
|
|
61
|
+
|
|
62
|
+
### `caches.match(request[, options])`
|
|
63
|
+
|
|
64
|
+
<!-- YAML
|
|
65
|
+
added: v5.22.1
|
|
66
|
+
-->
|
|
67
|
+
|
|
68
|
+
* `request` {Request|string} The request to match against. A string is treated
|
|
69
|
+
as a URL.
|
|
70
|
+
* `options` {Object} (optional)
|
|
71
|
+
* `ignoreSearch` {boolean} When `true`, ignores the query string of the URL
|
|
72
|
+
when matching. **Default:** `false`.
|
|
73
|
+
* `ignoreMethod` {boolean} When `true`, prevents matching operations from
|
|
74
|
+
validating the `Request` `http` method. **Default:** `false`.
|
|
75
|
+
* `ignoreVary` {boolean} When `true`, ignores the `Vary` header when matching.
|
|
76
|
+
**Default:** `false`.
|
|
77
|
+
* `cacheName` {string} When set, restricts the search to the cache with this
|
|
78
|
+
name. **Default:** `undefined`.
|
|
79
|
+
* Returns: {Promise} Fulfills with the first matching {Response}, or
|
|
80
|
+
`undefined` if no response matched.
|
|
81
|
+
|
|
82
|
+
Searches the caches for a response matching `request`. When `options.cacheName`
|
|
83
|
+
is provided, only that cache is searched; otherwise every cache is searched in
|
|
84
|
+
insertion order and the first match is returned.
|
|
85
|
+
|
|
86
|
+
```mjs
|
|
87
|
+
import { caches } from 'undici'
|
|
88
|
+
|
|
89
|
+
const response = await caches.match('https://example.com/data', {
|
|
90
|
+
cacheName: 'v1'
|
|
91
|
+
})
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `caches.has(cacheName)`
|
|
95
|
+
|
|
96
|
+
<!-- YAML
|
|
97
|
+
added: v5.22.1
|
|
98
|
+
-->
|
|
99
|
+
|
|
100
|
+
* `cacheName` {string} The name of the cache to look up.
|
|
101
|
+
* Returns: {Promise} Fulfills with `true` if a cache named `cacheName` exists,
|
|
102
|
+
otherwise `false`.
|
|
103
|
+
|
|
104
|
+
Checks whether a cache with the given name exists in the storage.
|
|
105
|
+
|
|
106
|
+
```mjs
|
|
107
|
+
import { caches } from 'undici'
|
|
108
|
+
|
|
109
|
+
await caches.open('v1')
|
|
110
|
+
console.log(await caches.has('v1')) // true
|
|
111
|
+
console.log(await caches.has('v2')) // false
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `caches.open(cacheName)`
|
|
115
|
+
|
|
116
|
+
<!-- YAML
|
|
117
|
+
added: v5.22.1
|
|
118
|
+
-->
|
|
119
|
+
|
|
120
|
+
* `cacheName` {string} The name of the cache to open.
|
|
121
|
+
* Returns: {Promise} Fulfills with the {Cache} named `cacheName`.
|
|
122
|
+
|
|
123
|
+
Opens the cache named `cacheName`, creating it if it does not already exist.
|
|
124
|
+
|
|
125
|
+
Each call returns a new [`Cache`][] object, but caches opened with the same name
|
|
126
|
+
share their underlying list of cached responses. As a result, a response stored
|
|
127
|
+
through one instance is visible through another instance with the same name.
|
|
128
|
+
|
|
129
|
+
```mjs
|
|
130
|
+
import { caches } from 'undici'
|
|
131
|
+
import assert from 'node:assert'
|
|
132
|
+
|
|
133
|
+
const cache1 = await caches.open('v1')
|
|
134
|
+
const cache2 = await caches.open('v1')
|
|
135
|
+
|
|
136
|
+
// open() returns distinct objects,
|
|
137
|
+
assert(cache1 !== cache2)
|
|
138
|
+
// but they share the same cached responses.
|
|
139
|
+
assert.deepStrictEqual(await cache1.match('/req'), await cache2.match('/req'))
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `caches.delete(cacheName)`
|
|
143
|
+
|
|
144
|
+
<!-- YAML
|
|
145
|
+
added: v5.22.1
|
|
146
|
+
-->
|
|
147
|
+
|
|
148
|
+
* `cacheName` {string} The name of the cache to delete.
|
|
149
|
+
* Returns: {Promise} Fulfills with `true` if the cache existed and was deleted,
|
|
150
|
+
otherwise `false`.
|
|
151
|
+
|
|
152
|
+
Removes the cache named `cacheName` from the storage. Any [`Cache`][] objects
|
|
153
|
+
already obtained for that name, along with the `Request`/`Response` pairs they
|
|
154
|
+
returned, remain usable after deletion.
|
|
155
|
+
|
|
156
|
+
```mjs
|
|
157
|
+
import { caches } from 'undici'
|
|
158
|
+
|
|
159
|
+
const cache = await caches.open('v1')
|
|
160
|
+
const response = await cache.match('/req')
|
|
161
|
+
|
|
162
|
+
await caches.delete('v1')
|
|
163
|
+
|
|
164
|
+
// The already-retrieved response is still usable.
|
|
165
|
+
await response.text()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `caches.keys()`
|
|
169
|
+
|
|
170
|
+
<!-- YAML
|
|
171
|
+
added: v5.22.1
|
|
172
|
+
-->
|
|
173
|
+
|
|
174
|
+
* Returns: {Promise} Fulfills with a {string[]} of cache names in insertion
|
|
175
|
+
order.
|
|
176
|
+
|
|
177
|
+
Returns the names of all caches currently held by the storage.
|
|
178
|
+
|
|
179
|
+
```mjs
|
|
180
|
+
import { caches } from 'undici'
|
|
181
|
+
|
|
182
|
+
await caches.open('v1')
|
|
183
|
+
await caches.open('v2')
|
|
184
|
+
console.log(await caches.keys()) // ['v1', 'v2']
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
[W3C Service Worker `CacheStorage`]: https://w3c.github.io/ServiceWorker/#cachestorage-interface
|
|
188
|
+
[`Cache`]: https://w3c.github.io/ServiceWorker/#cache-interface
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# Cache Store
|
|
2
|
+
|
|
3
|
+
<!--introduced_in=v7.0.0-->
|
|
4
|
+
<!--type=module-->
|
|
5
|
+
<!-- source_link=lib/cache/memory-cache-store.js -->
|
|
6
|
+
|
|
7
|
+
> Stability: 2 - Stable
|
|
8
|
+
|
|
9
|
+
A cache store is the storage backend used by the cache interceptor to persist
|
|
10
|
+
and retrieve cached responses. A store decides which stored response to serve
|
|
11
|
+
for a request by comparing the request against the response's `Vary` header, and
|
|
12
|
+
is expected to be compliant with [RFC 9111][].
|
|
13
|
+
|
|
14
|
+
undici ships two stores. `MemoryCacheStore` keeps responses in memory, while
|
|
15
|
+
`SqliteCacheStore` persists them to a SQLite database. Both are available under
|
|
16
|
+
the `cacheStores` export:
|
|
17
|
+
|
|
18
|
+
```mjs
|
|
19
|
+
import { cacheStores } from 'undici'
|
|
20
|
+
|
|
21
|
+
const { MemoryCacheStore, SqliteCacheStore } = cacheStores
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`SqliteCacheStore` requires the [`node:sqlite`][] API. The class is always
|
|
25
|
+
exported, but constructing one throws if `node:sqlite` is not available in the
|
|
26
|
+
running Node.js version.
|
|
27
|
+
|
|
28
|
+
A cache store implements three methods — `get(key)`, `createWriteStream(key,
|
|
29
|
+
value)`, and `delete(key)` — that operate on a [`CacheKey`](#cachekey) and a
|
|
30
|
+
[`CacheValue`](#cachevalue). Any object implementing this contract can be passed
|
|
31
|
+
to the cache interceptor, so custom stores (for example, backed by Redis or a
|
|
32
|
+
remote service) are supported as well.
|
|
33
|
+
|
|
34
|
+
## Class: `MemoryCacheStore`
|
|
35
|
+
|
|
36
|
+
<!-- YAML
|
|
37
|
+
added: v7.0.0
|
|
38
|
+
-->
|
|
39
|
+
|
|
40
|
+
* Extends: {EventEmitter}
|
|
41
|
+
|
|
42
|
+
Stores cached responses in memory. The store enforces upper bounds on the total
|
|
43
|
+
number of responses, the total size of all responses, and the size of any single
|
|
44
|
+
response. When a limit is exceeded, the store evicts approximately half of its
|
|
45
|
+
entries, least recently used first, and emits a
|
|
46
|
+
[`'maxSizeExceeded'`](#event-maxsizeexceeded) event.
|
|
47
|
+
|
|
48
|
+
```mjs
|
|
49
|
+
import { interceptors, cacheStores, Agent, setGlobalDispatcher } from 'undici'
|
|
50
|
+
|
|
51
|
+
const store = new cacheStores.MemoryCacheStore({ maxSize: 50 * 1024 * 1024 })
|
|
52
|
+
|
|
53
|
+
setGlobalDispatcher(
|
|
54
|
+
new Agent().compose(interceptors.cache({ store }))
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `new MemoryCacheStore([options])`
|
|
59
|
+
|
|
60
|
+
<!-- YAML
|
|
61
|
+
added: v7.0.0
|
|
62
|
+
-->
|
|
63
|
+
|
|
64
|
+
* `options` {Object} (optional)
|
|
65
|
+
* `maxCount` {number} The maximum number of responses to store. **Default:**
|
|
66
|
+
`1024`.
|
|
67
|
+
* `maxSize` {number} The maximum total size, in bytes, of all stored
|
|
68
|
+
responses. **Default:** `104857600` (100 MiB).
|
|
69
|
+
* `maxEntrySize` {number} The maximum size, in bytes, of a single response
|
|
70
|
+
body. Responses whose body exceeds this value are not cached. **Default:**
|
|
71
|
+
`5242880` (5 MiB).
|
|
72
|
+
* `errorCallback` {Function} A callback invoked with any error raised by the
|
|
73
|
+
store. (optional)
|
|
74
|
+
* `err` {Error}
|
|
75
|
+
|
|
76
|
+
Each of `maxCount`, `maxSize`, and `maxEntrySize` must be a non-negative
|
|
77
|
+
integer; a `TypeError` is thrown otherwise.
|
|
78
|
+
|
|
79
|
+
### `memoryCacheStore.size`
|
|
80
|
+
|
|
81
|
+
<!-- YAML
|
|
82
|
+
added: v7.0.0
|
|
83
|
+
-->
|
|
84
|
+
|
|
85
|
+
* Type: {number}
|
|
86
|
+
|
|
87
|
+
The current total size, in bytes, of all stored response bodies.
|
|
88
|
+
|
|
89
|
+
### `memoryCacheStore.isFull()`
|
|
90
|
+
|
|
91
|
+
<!-- YAML
|
|
92
|
+
added: v7.0.0
|
|
93
|
+
-->
|
|
94
|
+
|
|
95
|
+
* Returns: {boolean} `true` when the store has reached its `maxSize` or
|
|
96
|
+
`maxCount` limit, `false` otherwise.
|
|
97
|
+
|
|
98
|
+
### `memoryCacheStore.get(key)`
|
|
99
|
+
|
|
100
|
+
<!-- YAML
|
|
101
|
+
added: v7.0.0
|
|
102
|
+
-->
|
|
103
|
+
|
|
104
|
+
* `key` {CacheKey} The request to look up. See [`CacheKey`](#cachekey).
|
|
105
|
+
* Returns: {GetResult|undefined} The matching cached response, or `undefined`
|
|
106
|
+
when there is no fresh entry for `key`. See [`GetResult`](#getresult).
|
|
107
|
+
|
|
108
|
+
Looks up a cached response for `key`. A stored entry matches only when its
|
|
109
|
+
`method` equals `key.method`, its `deleteAt` time is in the future, and every
|
|
110
|
+
header listed in its `vary` map matches the corresponding header in
|
|
111
|
+
`key.headers`.
|
|
112
|
+
|
|
113
|
+
### `memoryCacheStore.createWriteStream(key, value)`
|
|
114
|
+
|
|
115
|
+
<!-- YAML
|
|
116
|
+
added: v7.0.0
|
|
117
|
+
-->
|
|
118
|
+
|
|
119
|
+
* `key` {CacheKey} The request the response is being cached for. See
|
|
120
|
+
[`CacheKey`](#cachekey).
|
|
121
|
+
* `value` {CacheValue} The response metadata to store. See
|
|
122
|
+
[`CacheValue`](#cachevalue).
|
|
123
|
+
* Returns: {Writable|undefined} A writable stream that the response body is
|
|
124
|
+
written to, or `undefined` when the response cannot be cached.
|
|
125
|
+
|
|
126
|
+
Returns a {Writable} stream used to write the response body into the store. When
|
|
127
|
+
the stream finishes, the entry is committed; if its accumulated size exceeds
|
|
128
|
+
`maxEntrySize`, the stream is destroyed and nothing is stored. Writing a new
|
|
129
|
+
entry whose `key` matches an existing one replaces that entry.
|
|
130
|
+
|
|
131
|
+
### `memoryCacheStore.delete(key)`
|
|
132
|
+
|
|
133
|
+
<!-- YAML
|
|
134
|
+
added: v7.0.0
|
|
135
|
+
-->
|
|
136
|
+
|
|
137
|
+
* `key` {CacheKey} The request whose cached responses should be removed. See
|
|
138
|
+
[`CacheKey`](#cachekey).
|
|
139
|
+
* Returns: {undefined}
|
|
140
|
+
|
|
141
|
+
Removes every cached response stored for `key.origin` and `key.path`. Throws a
|
|
142
|
+
`TypeError` if `key` is not an object.
|
|
143
|
+
|
|
144
|
+
### Event: `'maxSizeExceeded'`
|
|
145
|
+
|
|
146
|
+
<!-- YAML
|
|
147
|
+
added: v7.10.0
|
|
148
|
+
-->
|
|
149
|
+
|
|
150
|
+
* `data` {Object}
|
|
151
|
+
* `size` {number} The current total size, in bytes, of all stored responses.
|
|
152
|
+
* `maxSize` {number} The configured `maxSize` limit.
|
|
153
|
+
* `count` {number} The current number of stored responses.
|
|
154
|
+
* `maxCount` {number} The configured `maxCount` limit.
|
|
155
|
+
|
|
156
|
+
Emitted when the store exceeds its `maxSize` or `maxCount` limit, immediately
|
|
157
|
+
before entries are evicted. The event fires only once per overflow; it is not
|
|
158
|
+
emitted again until the store drops back below both limits.
|
|
159
|
+
|
|
160
|
+
## Class: `SqliteCacheStore`
|
|
161
|
+
|
|
162
|
+
<!-- YAML
|
|
163
|
+
added: v7.0.0
|
|
164
|
+
-->
|
|
165
|
+
|
|
166
|
+
Stores cached responses in a SQLite database using the [`node:sqlite`][] API.
|
|
167
|
+
The constructor throws when [`node:sqlite`][] is not available. Response bodies
|
|
168
|
+
larger than `compressThreshold` are stored compressed with zstd and
|
|
169
|
+
decompressed when read back, saving database space.
|
|
170
|
+
|
|
171
|
+
```mjs
|
|
172
|
+
import { interceptors, cacheStores, Agent, setGlobalDispatcher } from 'undici'
|
|
173
|
+
|
|
174
|
+
const store = new cacheStores.SqliteCacheStore({ location: './cache.db' })
|
|
175
|
+
|
|
176
|
+
setGlobalDispatcher(
|
|
177
|
+
new Agent().compose(interceptors.cache({ store }))
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### `new SqliteCacheStore([options])`
|
|
182
|
+
|
|
183
|
+
<!-- YAML
|
|
184
|
+
added: v7.0.0
|
|
185
|
+
-->
|
|
186
|
+
|
|
187
|
+
* `options` {Object} (optional)
|
|
188
|
+
* `location` {string} The location of the SQLite database. Use `':memory:'`
|
|
189
|
+
for an in-memory database. **Default:** `':memory:'`.
|
|
190
|
+
* `maxCount` {number} The maximum number of responses to store. **Default:**
|
|
191
|
+
`Infinity`.
|
|
192
|
+
* `maxEntrySize` {number} The maximum size, in bytes, of a single response
|
|
193
|
+
body. Responses whose body exceeds this value are not cached. Must not
|
|
194
|
+
exceed `2000000000` (2 GB). **Default:** `2000000000` (2 GB).
|
|
195
|
+
* `compressThreshold` {number} The size, in bytes, above which a response
|
|
196
|
+
body is stored compressed with zstd. Responses with an easily compressible
|
|
197
|
+
Content-Type (e.g. json, xml, plain text) are compressed regardless of
|
|
198
|
+
size. Requires a Node version with zstd
|
|
199
|
+
support (22.19+); when unavailable, bodies are stored uncompressed.
|
|
200
|
+
**Default:** `1048576` (1 MiB).
|
|
201
|
+
|
|
202
|
+
`maxCount`, `maxEntrySize`, and `compressThreshold` must be non-negative
|
|
203
|
+
integers; a `TypeError` is thrown otherwise, or if `maxEntrySize` is greater
|
|
204
|
+
than 2 GB.
|
|
205
|
+
|
|
206
|
+
### `sqliteCacheStore.close()`
|
|
207
|
+
|
|
208
|
+
<!-- YAML
|
|
209
|
+
added: v7.0.0
|
|
210
|
+
-->
|
|
211
|
+
|
|
212
|
+
* Returns: {undefined}
|
|
213
|
+
|
|
214
|
+
Closes the connection to the underlying SQLite database.
|
|
215
|
+
|
|
216
|
+
### `sqliteCacheStore.size`
|
|
217
|
+
|
|
218
|
+
<!-- YAML
|
|
219
|
+
added: v7.0.0
|
|
220
|
+
-->
|
|
221
|
+
|
|
222
|
+
* Type: {number}
|
|
223
|
+
|
|
224
|
+
The number of responses currently stored in the database.
|
|
225
|
+
|
|
226
|
+
### `sqliteCacheStore.get(key)`
|
|
227
|
+
|
|
228
|
+
<!-- YAML
|
|
229
|
+
added: v7.0.0
|
|
230
|
+
-->
|
|
231
|
+
|
|
232
|
+
* `key` {CacheKey} The request to look up. See [`CacheKey`](#cachekey).
|
|
233
|
+
* Returns: {GetResult|undefined} The matching cached response, or `undefined`
|
|
234
|
+
when there is no fresh entry for `key`. The returned `body` is a {Buffer}.
|
|
235
|
+
See [`GetResult`](#getresult).
|
|
236
|
+
|
|
237
|
+
Looks up a cached response for `key`, comparing the request method and every
|
|
238
|
+
header named in the stored `vary` map. A body that was stored compressed is
|
|
239
|
+
decompressed before being returned.
|
|
240
|
+
|
|
241
|
+
### `sqliteCacheStore.set(key, value)`
|
|
242
|
+
|
|
243
|
+
<!-- YAML
|
|
244
|
+
added: v7.0.0
|
|
245
|
+
-->
|
|
246
|
+
|
|
247
|
+
* `key` {CacheKey} The request the response is being cached for. See
|
|
248
|
+
[`CacheKey`](#cachekey).
|
|
249
|
+
* `value` {CacheValue} The response to store, with its `body` set to a {Buffer},
|
|
250
|
+
an {Array} of {Buffer}, or `null`. See [`CacheValue`](#cachevalue).
|
|
251
|
+
* Returns: {undefined}
|
|
252
|
+
|
|
253
|
+
Writes a response into the database directly, without going through a stream. If
|
|
254
|
+
the body exceeds `maxEntrySize`, nothing is stored. A body larger than
|
|
255
|
+
`compressThreshold`, or with an easily compressible Content-Type (e.g. json,
|
|
256
|
+
xml, plain text), is compressed with zstd before being written. When an entry
|
|
257
|
+
already exists for `key` it is overwritten; otherwise a new row is inserted and
|
|
258
|
+
old entries are pruned to honour `maxCount`. This method is used internally by
|
|
259
|
+
[`sqliteCacheStore.createWriteStream()`](#sqlitecachestorecreatewritestreamkey-value).
|
|
260
|
+
|
|
261
|
+
### `sqliteCacheStore.createWriteStream(key, value)`
|
|
262
|
+
|
|
263
|
+
<!-- YAML
|
|
264
|
+
added: v7.0.0
|
|
265
|
+
-->
|
|
266
|
+
|
|
267
|
+
* `key` {CacheKey} The request the response is being cached for. See
|
|
268
|
+
[`CacheKey`](#cachekey).
|
|
269
|
+
* `value` {CacheValue} The response metadata to store. See
|
|
270
|
+
[`CacheValue`](#cachevalue).
|
|
271
|
+
* Returns: {Writable|undefined} A writable stream that the response body is
|
|
272
|
+
written to, or `undefined` when the response cannot be cached.
|
|
273
|
+
|
|
274
|
+
Returns a {Writable} stream used to write the response body into the store. When
|
|
275
|
+
the stream finishes, the buffered body is committed via
|
|
276
|
+
[`sqliteCacheStore.set()`](#sqlitecachestoresetkey-value), where bodies larger
|
|
277
|
+
than `compressThreshold` or with an easily compressible Content-Type are
|
|
278
|
+
compressed with zstd. If the body exceeds
|
|
279
|
+
`maxEntrySize`, the stream is destroyed and nothing is stored.
|
|
280
|
+
|
|
281
|
+
### `sqliteCacheStore.delete(key)`
|
|
282
|
+
|
|
283
|
+
<!-- YAML
|
|
284
|
+
added: v7.0.0
|
|
285
|
+
-->
|
|
286
|
+
|
|
287
|
+
* `key` {CacheKey} The request whose cached responses should be removed. See
|
|
288
|
+
[`CacheKey`](#cachekey).
|
|
289
|
+
* Returns: {undefined}
|
|
290
|
+
|
|
291
|
+
Removes every cached response stored for the URL derived from `key.origin` and
|
|
292
|
+
`key.path`. Throws a `TypeError` if `key` is not an object.
|
|
293
|
+
|
|
294
|
+
## Implementing a custom cache store
|
|
295
|
+
|
|
296
|
+
A cache store is any object that implements the `CacheStore` interface:
|
|
297
|
+
|
|
298
|
+
* `get(key)` — Look up a response. Returns a [`GetResult`](#getresult),
|
|
299
|
+
`undefined`, or a {Promise} resolving to either.
|
|
300
|
+
* `createWriteStream(key, value)` — Return a {Writable} to receive the response
|
|
301
|
+
body, or `undefined` if the response cannot be stored.
|
|
302
|
+
* `delete(key)` — Remove all responses for `key`. May return a {Promise}.
|
|
303
|
+
|
|
304
|
+
Returning a {Promise} from `get` or `delete` lets a store be backed by an
|
|
305
|
+
asynchronous resource; the cache interceptor awaits these values, including on
|
|
306
|
+
the revalidation and stale-while-revalidate paths.
|
|
307
|
+
|
|
308
|
+
### `CacheKey`
|
|
309
|
+
|
|
310
|
+
The request a response is being looked up or stored for.
|
|
311
|
+
|
|
312
|
+
* `origin` {string} The request origin.
|
|
313
|
+
* `method` {string} The request method.
|
|
314
|
+
* `path` {string} The request path.
|
|
315
|
+
* `headers` {Record<string, string|string[]>} The request headers, used to
|
|
316
|
+
satisfy `Vary`. (optional)
|
|
317
|
+
|
|
318
|
+
### `CacheValue`
|
|
319
|
+
|
|
320
|
+
The metadata of a cached response, excluding its body.
|
|
321
|
+
|
|
322
|
+
* `statusCode` {number} The response's HTTP status code.
|
|
323
|
+
* `statusMessage` {string} The response's HTTP status message.
|
|
324
|
+
* `headers` {Record<string, string|string[]>} The response headers.
|
|
325
|
+
* `vary` {Record<string, string|string[]|null>} The header names listed in the
|
|
326
|
+
response's `Vary` header mapped to the values they had in the original
|
|
327
|
+
request. A value is `null` when that header was absent from the original
|
|
328
|
+
request. (optional)
|
|
329
|
+
* `etag` {string} The response's entity tag. (optional)
|
|
330
|
+
* `cacheControlDirectives` {Object} The parsed `Cache-Control` directives of the
|
|
331
|
+
response. (optional)
|
|
332
|
+
* `cachedAt` {number} The time, in milliseconds, at which the response was
|
|
333
|
+
cached.
|
|
334
|
+
* `staleAt` {number} The time, in milliseconds, at which the response becomes
|
|
335
|
+
stale.
|
|
336
|
+
* `deleteAt` {number} The time, in milliseconds, at which the response must be
|
|
337
|
+
evicted. A store must not return a response once this time has passed.
|
|
338
|
+
|
|
339
|
+
The `vary` map drives response selection. For a response such as:
|
|
340
|
+
|
|
341
|
+
```http
|
|
342
|
+
Vary: content-encoding, accept
|
|
343
|
+
content-encoding: utf8
|
|
344
|
+
accept: application/json
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
the recorded map is:
|
|
348
|
+
|
|
349
|
+
```js
|
|
350
|
+
{
|
|
351
|
+
'content-encoding': 'utf8',
|
|
352
|
+
accept: 'application/json'
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
If the original request did not include the `accept` header, its value is
|
|
357
|
+
recorded as `null`:
|
|
358
|
+
|
|
359
|
+
```js
|
|
360
|
+
{
|
|
361
|
+
'content-encoding': 'utf8',
|
|
362
|
+
accept: null
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### `GetResult`
|
|
367
|
+
|
|
368
|
+
The value returned by `get`. It contains every field of
|
|
369
|
+
[`CacheValue`](#cachevalue) plus the response body.
|
|
370
|
+
|
|
371
|
+
* `body` {Readable|Iterable|AsyncIterable|Buffer|string} The cached response
|
|
372
|
+
body. (optional)
|
|
373
|
+
|
|
374
|
+
[RFC 9111]: https://www.rfc-editor.org/rfc/rfc9111.html
|
|
375
|
+
[`node:sqlite`]: https://nodejs.org/api/sqlite.html
|