@openclaw/slack 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/.setup/{account-inspect-DP1Bcwj4.mjs → account-inspect-DWBXpER6.mjs} +1 -1
- package/dist/.setup/{accounts-BBHvg0pY.mjs → accounts-D_N9IqNA.mjs} +23 -1
- package/dist/.setup/{action-runtime-B01d85zt.mjs → action-runtime-DfWvuiZd.mjs} +26 -41
- package/dist/.setup/action-runtime.runtime-Ck4bAWOX.mjs +2 -0
- package/dist/.setup/{actions-DKCtBgCI.mjs → actions-Df0CzcDl.mjs} +88 -175
- package/dist/.setup/{approval-handler.runtime-DMszKn_7.mjs → approval-handler.runtime-Ed6Sw5VK.mjs} +37 -47
- package/dist/.setup/{approval-message-updates-Tb_qRokK.mjs → approval-message-updates-BadvtA7R.mjs} +1 -2
- package/dist/.setup/{channel-CErYZ5zw.mjs → channel-C7bgPSTE.mjs} +181 -273
- package/dist/.setup/channel-meta-C443t-lI.mjs +27 -0
- package/dist/.setup/{channel-type-Dxk8VJUb.mjs → channel-type-ClOttrZ5.mjs} +13 -21
- package/dist/.setup/{channel.setup-BVoUtdPn.mjs → channel.setup-Dh2jzAjN.mjs} +35 -42
- package/dist/.setup/{config-schema-CyL279e7.mjs → config-schema-BZCxmHKG.mjs} +24 -21
- package/dist/.setup/{directory-config-CQTSH45W.mjs → directory-config-BOUWH3hR.mjs} +7 -10
- package/dist/.setup/{directory-live-BCcj89QV.mjs → directory-live-B2O4B_Ho.mjs} +9 -21
- package/dist/.setup/doctor-contract-CRN1Z_c7.mjs +342 -0
- package/dist/.setup/{message-tool-api-C0PTFaNV.mjs → message-tool-api-Cu4lwlGy.mjs} +34 -48
- package/dist/.setup/{provider-C-jPaGt2.mjs → monitor-BPVfkumU.mjs} +2181 -2693
- package/dist/.setup/{outbound-adapter-A7Wdn8ZT.mjs → outbound-adapter-Bv48XUjq.mjs} +10 -21
- package/dist/.setup/{pipeline.runtime-BlPOexmJ.mjs → pipeline.runtime-B1H63Frf.mjs} +311 -457
- package/dist/.setup/{plugin-routes-C3X0eVaK.mjs → plugin-routes-B8tooDLj.mjs} +1 -1
- package/dist/.setup/{policy-BApW53pI.mjs → policy-D-jfM174.mjs} +5 -5
- package/dist/.setup/{probe-DiYIMPJo.mjs → probe-B2Y9qc_z.mjs} +101 -39
- package/dist/.setup/{registry-bbjH7IHX.mjs → registry-CIbMfuf8.mjs} +6 -2
- package/dist/.setup/{relay-source-DfOnjJTE.mjs → relay-source-BpKdjsll.mjs} +10 -12
- package/dist/.setup/{replies-BBAJxUOQ.mjs → replies-BAnUtr2f.mjs} +16 -76
- package/dist/.setup/{reply-blocks-Bm8kf6mK.mjs → reply-blocks-SE1kTE3I.mjs} +27 -154
- package/dist/.setup/{resolve-channels-BXbMBbJD.mjs → resolve-channels-XXBn8UU_.mjs} +4 -5
- package/dist/.setup/{resolve-users-65WqvIqD.mjs → resolve-users-DW0ngD03.mjs} +20 -22
- package/dist/.setup/{scopes-h3YB-mMs.mjs → scopes-CasuDvaa.mjs} +6 -17
- package/dist/.setup/{secret-contract-DxmvbxBF.mjs → secret-contract-BaZcu6P_.mjs} +15 -20
- package/dist/.setup/{secret-contract-api-D9UfYujm.mjs → secret-contract-api-Dp6290Vg.mjs} +1 -1
- package/dist/.setup/{security-audit-BypHqcq5.mjs → security-audit-BqDc-6VL.mjs} +1 -1
- package/dist/.setup/{send-Cp6omkOg.mjs → send-BOVLQi3n.mjs} +84 -171
- package/dist/.setup/{session-status-Cf7AvWOt.mjs → session-status-DscajIsd.mjs} +315 -238
- package/dist/.setup/{setup-plugin-api-dLPkL06L.mjs → setup-plugin-api-DTtbTKNk.mjs} +1 -1
- package/dist/.setup/{setup-surface-D3DLcCxu.mjs → setup-surface-Dn7QgWRE.mjs} +24 -56
- package/dist/.setup/{shared-CJ3arAFL.mjs → shared-qau-uDGl.mjs} +30 -56
- package/dist/.setup/{slash-dispatch.runtime-HFy_XvyO.mjs → slash-dispatch.runtime--AEzLVBF.mjs} +1 -1
- package/dist/.setup/{streaming-compat-B-e0mqM0.mjs → streaming-compat-C5Wut626.mjs} +31 -8
- package/dist/.setup/{target-parsing-DEsPjngB.mjs → target-parsing-FFE26kOV.mjs} +1 -7
- package/dist/.setup/{targets-Cku2KCvg.mjs → targets-C6LZQL1Q.mjs} +1 -1
- package/dist/.setup/{thread-ts-CukseRVL.mjs → thread-ts-Cvt7WD6B.mjs} +0 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +18 -17
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/http-routes-api.js +1 -1
- package/dist/index.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +11 -12
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@slack/bolt/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@slack/bolt/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@slack/bolt/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@slack/web-api/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@slack/web-api/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/get-east-asian-width/index.js +8 -3
- package/node_modules/get-east-asian-width/lookup-data.js +1 -1
- package/node_modules/get-east-asian-width/lookup.js +4 -4
- package/node_modules/get-east-asian-width/package.json +1 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/node_modules/undici/README.md +81 -25
- package/node_modules/undici/docs/docs/api/Agent.md +249 -42
- package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
- package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
- package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
- package/node_modules/undici/docs/docs/api/Client.md +407 -162
- package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
- package/node_modules/undici/docs/docs/api/Connector.md +118 -35
- package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
- package/node_modules/undici/docs/docs/api/Cookies.md +122 -71
- package/node_modules/undici/docs/docs/api/Debug.md +34 -18
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
- package/node_modules/undici/docs/docs/api/Dispatcher.md +490 -1055
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +105 -93
- package/node_modules/undici/docs/docs/api/Errors.md +503 -28
- package/node_modules/undici/docs/docs/api/EventSource.md +326 -13
- package/node_modules/undici/docs/docs/api/Fetch.md +681 -30
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -96
- package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
- package/node_modules/undici/docs/docs/api/Interceptors.md +418 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +333 -314
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
- package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
- package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
- package/node_modules/undici/docs/docs/api/MockPool.md +321 -258
- package/node_modules/undici/docs/docs/api/Pool.md +236 -41
- package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -55
- package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -27
- package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -79
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +262 -517
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +177 -196
- package/node_modules/undici/docs/docs/api/Util.md +68 -11
- package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +233 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
- package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
- package/node_modules/undici/docs/docs/getting-started.md +281 -0
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/index.js +4 -2
- package/node_modules/undici/lib/api/api-connect.js +13 -11
- package/node_modules/undici/lib/api/api-pipeline.js +26 -13
- package/node_modules/undici/lib/api/api-request.js +51 -21
- package/node_modules/undici/lib/api/api-stream.js +81 -20
- package/node_modules/undici/lib/api/api-upgrade.js +21 -11
- package/node_modules/undici/lib/api/readable.js +45 -9
- package/node_modules/undici/lib/cache/memory-cache-store.js +3 -3
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +3 -1
- package/node_modules/undici/lib/core/connect.js +46 -7
- package/node_modules/undici/lib/core/constants.js +1 -24
- package/node_modules/undici/lib/core/errors.js +22 -2
- package/node_modules/undici/lib/core/request.js +100 -18
- package/node_modules/undici/lib/core/symbols.js +4 -0
- package/node_modules/undici/lib/core/util.js +105 -48
- package/node_modules/undici/lib/dispatcher/agent.js +51 -32
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +23 -27
- package/node_modules/undici/lib/dispatcher/client-h1.js +86 -24
- package/node_modules/undici/lib/dispatcher/client-h2.js +1091 -361
- package/node_modules/undici/lib/dispatcher/client.js +109 -36
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +19 -6
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -5
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +110 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
- package/node_modules/undici/lib/dispatcher/h2c-client.js +4 -4
- package/node_modules/undici/lib/dispatcher/pool-base.js +28 -10
- package/node_modules/undici/lib/dispatcher/pool.js +30 -5
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +95 -19
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +32 -10
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +153 -63
- package/node_modules/undici/lib/global.js +37 -14
- package/node_modules/undici/lib/handler/cache-handler.js +49 -7
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +10 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +8 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +66 -66
- package/node_modules/undici/lib/handler/retry-handler.js +191 -50
- package/node_modules/undici/lib/interceptor/cache.js +75 -25
- package/node_modules/undici/lib/interceptor/decompress.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +12 -1
- package/node_modules/undici/lib/interceptor/redirect.js +3 -3
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
- package/node_modules/undici/lib/mock/mock-agent.js +21 -9
- package/node_modules/undici/lib/mock/mock-call-history.js +1 -1
- package/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
- package/node_modules/undici/lib/mock/mock-utils.js +281 -47
- package/node_modules/undici/lib/mock/snapshot-agent.js +25 -7
- package/node_modules/undici/lib/mock/snapshot-recorder.js +38 -3
- package/node_modules/undici/lib/util/cache.js +92 -10
- package/node_modules/undici/lib/util/runtime-features.js +3 -34
- package/node_modules/undici/lib/web/cache/cache.js +6 -8
- package/node_modules/undici/lib/web/cookies/parse.js +150 -146
- package/node_modules/undici/lib/web/cookies/util.js +1 -1
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +20 -21
- package/node_modules/undici/lib/web/eventsource/util.js +32 -1
- package/node_modules/undici/lib/web/fetch/body.js +48 -10
- package/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/node_modules/undici/lib/web/fetch/formdata.js +21 -2
- package/node_modules/undici/lib/web/fetch/index.js +242 -223
- package/node_modules/undici/lib/web/fetch/request.js +35 -6
- package/node_modules/undici/lib/web/fetch/response.js +1 -3
- package/node_modules/undici/lib/web/fetch/util.js +10 -2
- package/node_modules/undici/lib/web/webidl/index.js +5 -7
- package/node_modules/undici/lib/web/websocket/frame.js +1 -7
- package/node_modules/undici/lib/web/websocket/receiver.js +1 -1
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +10 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +25 -3
- package/node_modules/undici/package.json +10 -10
- package/node_modules/undici/types/agent.d.ts +0 -2
- package/node_modules/undici/types/client.d.ts +69 -24
- package/node_modules/undici/types/connector.d.ts +1 -0
- package/node_modules/undici/types/cookies.d.ts +1 -1
- package/node_modules/undici/types/dispatcher.d.ts +8 -30
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici/types/errors.d.ts +10 -0
- package/node_modules/undici/types/fetch.d.ts +5 -1
- package/node_modules/undici/types/formdata.d.ts +0 -6
- package/node_modules/undici/types/h2c-client.d.ts +6 -6
- package/node_modules/undici/types/handlers.d.ts +2 -0
- package/node_modules/undici/types/header.d.ts +5 -0
- package/node_modules/undici/types/index.d.ts +3 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici/types/pool.d.ts +0 -2
- package/node_modules/undici/types/proxy-agent.d.ts +9 -2
- package/node_modules/undici/types/round-robin-pool.d.ts +0 -2
- package/node_modules/undici/types/snapshot-agent.d.ts +4 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +4 -2
- package/node_modules/undici/types/webidl.d.ts +0 -1
- package/openclaw.plugin.json +31 -3
- package/package.json +7 -7
- package/dist/.setup/accounts.runtime-DN-PPocC.mjs +0 -2
- package/dist/.setup/action-runtime.runtime-C8R8CUan.mjs +0 -2
- package/dist/.setup/doctor-contract-CtMUqjvk.mjs +0 -186
- package/dist/.setup/monitor-_Sht7Dqy.mjs +0 -13
- package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/.setup/send.runtime-B4caZU6T.mjs +0 -2
- package/dist/.setup/slash-commands.runtime-BpSH0b3q.mjs +0 -2
- package/dist/.setup/slash-skill-commands.runtime-Bi1JWZHY.mjs +0 -2
- package/node_modules/undici/lib/handler/unwrap-handler.js +0 -106
- package/node_modules/undici/lib/handler/wrap-handler.js +0 -105
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/util/promise.js +0 -28
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -1,106 +1,89 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Guard } from '../../guard/index.mjs';
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
|
-
//
|
|
4
|
+
// Throw
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
throw Error('Cannot set root');
|
|
6
|
+
function Throw(message) {
|
|
7
|
+
throw Error(message);
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
throw Error('Cannot set value');
|
|
9
|
+
function ThrowUnsafePropertyKey() {
|
|
10
|
+
Throw('Pointer contains unsafe property key');
|
|
13
11
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
throw Error('Pointer contains unsafe property key');
|
|
17
|
-
}
|
|
18
|
-
function AssertIndices(indices) {
|
|
19
|
-
for (const index of indices)
|
|
20
|
-
AssertIndex(index);
|
|
21
|
-
}
|
|
22
|
-
// ------------------------------------------------------------------
|
|
23
|
-
// Indices
|
|
24
|
-
// ------------------------------------------------------------------
|
|
25
|
-
function IsNumericIndex(index) {
|
|
26
|
-
return /^(0|[1-9]\d*)$/.test(index);
|
|
27
|
-
}
|
|
28
|
-
function TakeIndexRight(indices) {
|
|
29
|
-
return [
|
|
30
|
-
indices.slice(0, indices.length - 1),
|
|
31
|
-
indices.slice(indices.length - 1)[0]
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
function HasIndex(index, value) {
|
|
35
|
-
return Guard.IsObject(value) && Guard.HasPropertyKey(value, index);
|
|
36
|
-
}
|
|
37
|
-
function GetIndex(index, value) {
|
|
38
|
-
return Guard.IsObject(value) && !Guard.IsUnsafePropertyKey(index) ? value[index] : undefined;
|
|
39
|
-
}
|
|
40
|
-
function GetIndices(indices, value) {
|
|
41
|
-
return indices.reduce((value, index) => GetIndex(index, value), value);
|
|
12
|
+
function ThrowCannotSetRoot() {
|
|
13
|
+
Throw('Cannot set value');
|
|
42
14
|
}
|
|
43
15
|
// ------------------------------------------------------------------
|
|
44
16
|
// Indices
|
|
45
17
|
// ------------------------------------------------------------------
|
|
46
|
-
/** Returns an array of path indices for the given pointer */
|
|
47
18
|
export function Indices(pointer) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const indices = pointer.split("/").map(index => index.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
51
|
-
return (indices.length > 0 && indices[0] === '') ? indices.slice(1) : indices;
|
|
19
|
+
const indices = pointer.split('/').map(index => index.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
20
|
+
return indices[0] === '' ? indices.slice(1) : indices;
|
|
52
21
|
}
|
|
53
22
|
// ------------------------------------------------------------------
|
|
54
23
|
// Has
|
|
55
24
|
// ------------------------------------------------------------------
|
|
56
|
-
/** Returns true if a value exists at the current pointer */
|
|
57
25
|
export function Has(value, pointer) {
|
|
58
26
|
let current = value;
|
|
59
|
-
|
|
60
|
-
if (!
|
|
27
|
+
for (const index of Indices(pointer)) {
|
|
28
|
+
if (!Guard.IsObject(current) || !Guard.HasPropertyKey(current, index))
|
|
61
29
|
return false;
|
|
62
30
|
current = current[index];
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
65
33
|
}
|
|
66
34
|
// ------------------------------------------------------------------
|
|
67
35
|
// Get
|
|
68
36
|
// ------------------------------------------------------------------
|
|
69
|
-
/** Gets a value at the pointer, or undefined if not exists */
|
|
70
37
|
export function Get(value, pointer) {
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
let current = value;
|
|
39
|
+
for (const index of Indices(pointer)) {
|
|
40
|
+
if (!Guard.IsObject(current) || Guard.IsUnsafePropertyKey(index))
|
|
41
|
+
return undefined;
|
|
42
|
+
current = current[index];
|
|
43
|
+
}
|
|
44
|
+
return current;
|
|
45
|
+
}
|
|
46
|
+
// ------------------------------------------------------------------
|
|
47
|
+
// Get
|
|
48
|
+
// ------------------------------------------------------------------
|
|
49
|
+
function Parent(value, indices, last) {
|
|
50
|
+
let current = value;
|
|
51
|
+
for (const index of indices) {
|
|
52
|
+
if (Guard.IsUnsafePropertyKey(index))
|
|
53
|
+
ThrowUnsafePropertyKey();
|
|
54
|
+
current = Guard.IsObject(current) ? current[index] : undefined;
|
|
55
|
+
}
|
|
56
|
+
if (Guard.IsUnsafePropertyKey(last))
|
|
57
|
+
ThrowUnsafePropertyKey();
|
|
58
|
+
if (!Guard.IsObject(current))
|
|
59
|
+
ThrowCannotSetRoot();
|
|
60
|
+
return current;
|
|
73
61
|
}
|
|
74
62
|
// ------------------------------------------------------------------
|
|
75
63
|
// Set
|
|
76
64
|
// ------------------------------------------------------------------
|
|
77
|
-
/** Sets a value at the given pointer. May throw if the target value is not indexable */
|
|
78
65
|
export function Set(value, pointer, next) {
|
|
79
66
|
const indices = Indices(pointer);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
AssertCanSet(parent);
|
|
85
|
-
parent[index] = next;
|
|
67
|
+
const last = indices.pop();
|
|
68
|
+
if (Guard.IsUndefined(last))
|
|
69
|
+
ThrowCannotSetRoot();
|
|
70
|
+
Parent(value, indices, last)[last] = next;
|
|
86
71
|
return value;
|
|
87
72
|
}
|
|
88
73
|
// ------------------------------------------------------------------
|
|
89
74
|
// Delete
|
|
90
75
|
// ------------------------------------------------------------------
|
|
91
|
-
/** Deletes the value at the given pointer. May throw if the target value is not indexable */
|
|
92
76
|
export function Delete(value, pointer) {
|
|
93
77
|
const indices = Indices(pointer);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const parent =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
parent.splice(+index, 1);
|
|
78
|
+
const last = indices.pop();
|
|
79
|
+
if (Guard.IsUndefined(last))
|
|
80
|
+
ThrowCannotSetRoot();
|
|
81
|
+
const parent = Parent(value, indices, last);
|
|
82
|
+
if (Guard.IsArray(parent) && /^(0|[1-9]\d*)$/.test(last)) {
|
|
83
|
+
parent.splice(Number(last), 1);
|
|
101
84
|
}
|
|
102
85
|
else {
|
|
103
|
-
delete parent[
|
|
86
|
+
delete parent[last];
|
|
104
87
|
}
|
|
105
88
|
return value;
|
|
106
89
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Get } from './settings.mjs';
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// TempMaxErrors
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
let TempMaxErrors = 0;
|
|
6
|
+
// ------------------------------------------------------------------
|
|
7
|
+
// [Internal] EnableParseErrors
|
|
8
|
+
// ------------------------------------------------------------------
|
|
9
|
+
export function EnableParseErrors() {
|
|
10
|
+
const settings = Get();
|
|
11
|
+
TempMaxErrors = settings.maxErrors;
|
|
12
|
+
settings.maxErrors = settings.maxParseErrors;
|
|
13
|
+
}
|
|
14
|
+
// ------------------------------------------------------------------
|
|
15
|
+
// [Internal] DisableParseErrors
|
|
16
|
+
// ------------------------------------------------------------------
|
|
17
|
+
export function DisableParseErrors() {
|
|
18
|
+
const settings = Get();
|
|
19
|
+
settings.maxErrors = TempMaxErrors;
|
|
20
|
+
}
|
|
@@ -16,6 +16,17 @@ export interface TSettings {
|
|
|
16
16
|
* @default 8
|
|
17
17
|
*/
|
|
18
18
|
maxErrors: number;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the maximum number of errors to gather for failed Parse operations. TypeBox will
|
|
21
|
+
* automatically run an error-gathering pass on failed Parses to attach diagnostics to the
|
|
22
|
+
* thrown exception. This setting controls the number of errors gathered in that pass. Higher
|
|
23
|
+
* values will reduce throughput on failure cases, so a maximum of 4 is recommended if more
|
|
24
|
+
* errors are needed. The default setting of 1 will terminate on the first error, while a
|
|
25
|
+
* setting of 0 will skip error gathering entirely.
|
|
26
|
+
*
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
maxParseErrors: number;
|
|
19
30
|
/**
|
|
20
31
|
* Specifies the maximum number of instantiations allowed within a top-level generic instantiation
|
|
21
32
|
* context. This setting can be used to bound generic calls to a fixed count, which can be useful if
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Guard } from '../../guard/index.mjs';
|
|
2
|
+
// -------------------------------------------------------------------
|
|
3
|
+
// State
|
|
4
|
+
// -------------------------------------------------------------------
|
|
2
5
|
// Internal mutable state
|
|
3
6
|
const settings = {
|
|
4
7
|
immutableTypes: false,
|
|
5
8
|
maxErrors: 8,
|
|
9
|
+
maxParseErrors: 1,
|
|
6
10
|
maxInstantiationCount: 128,
|
|
7
11
|
useAcceleration: true,
|
|
8
12
|
exactOptionalPropertyTypes: false,
|
|
@@ -10,10 +14,14 @@ const settings = {
|
|
|
10
14
|
correctiveParse: false,
|
|
11
15
|
unionPrioritySort: true
|
|
12
16
|
};
|
|
17
|
+
// -------------------------------------------------------------------
|
|
18
|
+
// Reset
|
|
19
|
+
// -------------------------------------------------------------------
|
|
13
20
|
/** Resets system settings to defaults */
|
|
14
21
|
export function Reset() {
|
|
15
22
|
settings.immutableTypes = false;
|
|
16
23
|
settings.maxErrors = 8;
|
|
24
|
+
settings.maxParseErrors = 1;
|
|
17
25
|
settings.maxInstantiationCount = 128;
|
|
18
26
|
settings.useAcceleration = true;
|
|
19
27
|
settings.exactOptionalPropertyTypes = false;
|
|
@@ -21,6 +29,9 @@ export function Reset() {
|
|
|
21
29
|
settings.correctiveParse = false;
|
|
22
30
|
settings.unionPrioritySort = true;
|
|
23
31
|
}
|
|
32
|
+
// -------------------------------------------------------------------
|
|
33
|
+
// Set
|
|
34
|
+
// -------------------------------------------------------------------
|
|
24
35
|
/** Sets system settings */
|
|
25
36
|
export function Set(options) {
|
|
26
37
|
for (const key of Guard.Keys(options)) {
|
|
@@ -30,6 +41,9 @@ export function Set(options) {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
}
|
|
44
|
+
// -------------------------------------------------------------------
|
|
45
|
+
// Get
|
|
46
|
+
// -------------------------------------------------------------------
|
|
33
47
|
/** Gets current system settings */
|
|
34
48
|
export function Get() {
|
|
35
49
|
return settings;
|
|
@@ -22,7 +22,7 @@ export declare function TryRestInferable<Type extends TSchema>(type: Type): TTry
|
|
|
22
22
|
export type TTryInferable<Type extends TSchema, Result extends TInferable | undefined = (Type extends TInfer<infer Name extends string, infer Type extends TSchema> ? TInferable<Name, Type> : undefined)> = Result;
|
|
23
23
|
export declare function TryInferable<Type extends TSchema>(type: Type): TTryInferable<Type>;
|
|
24
24
|
type TryInferResults<Rest extends TSchema[], Right extends TSchema, Result extends TSchema[] = []> = (Rest extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtendsLeft<{}, Head, Right> extends Result.TExtendsTrueLike ? TryInferResults<Tail, Right, [...Result, Head]> : undefined : Result);
|
|
25
|
-
declare function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right
|
|
25
|
+
declare function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right): TryInferResults<Rest, Right>;
|
|
26
26
|
export type TInferTupleResult<Inferred extends TProperties, Name extends string, Left extends TSchema[], Right extends TSchema, Results extends TSchema[] | undefined = TryInferResults<Left, Right>> = (Results extends [...infer Results extends TSchema[]] ? Result.TExtendsTrue<Memory.TAssign<Inferred, {
|
|
27
27
|
[_ in Name]: TTuple<Results>;
|
|
28
28
|
}>> : Result.TExtendsFalse);
|
|
@@ -45,8 +45,21 @@ export function TryInferable(type) {
|
|
|
45
45
|
return (IsInfer(type) ? Inferrable(type.name, type.extends) :
|
|
46
46
|
undefined);
|
|
47
47
|
}
|
|
48
|
-
function TryInferResults(rest, right, result = []) {
|
|
49
|
-
|
|
48
|
+
// function TryInferResults<Rest extends TSchema[], Right extends TSchema>(rest: [...Rest], right: Right, result: TSchema[] = []): TryInferResults<Rest, Right> {
|
|
49
|
+
// return Guard.ShiftLeft(rest, (head, tail) =>
|
|
50
|
+
// Result.Match(ExtendsLeft({}, head, right),
|
|
51
|
+
// () => TryInferResults(tail, right, [...result, head]), // Stack Overflow Here (Large Rest)
|
|
52
|
+
// () => undefined),
|
|
53
|
+
// () => result) as never
|
|
54
|
+
// }
|
|
55
|
+
function TryInferResults(rest, right) {
|
|
56
|
+
const result = [];
|
|
57
|
+
for (const head of rest) {
|
|
58
|
+
if (!Result.IsExtendsTrueLike(ExtendsLeft({}, head, right)))
|
|
59
|
+
return undefined;
|
|
60
|
+
result.push(head);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
50
63
|
}
|
|
51
64
|
export function InferTupleResult(inferred, name, left, right) {
|
|
52
65
|
const results = TryInferResults(left, right);
|
|
@@ -16,7 +16,8 @@ type TElementsLeft<Inferred extends TProperties, Reversed extends boolean, LeftR
|
|
|
16
16
|
type TElementsRight<Inferred extends TProperties, Reversed extends boolean, LeftRest extends TSchema[], RightRest extends TSchema[]> = (RightRest extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TElementsLeft<Inferred, Reversed, LeftRest, Head, Tail> : LeftRest['length'] extends 0 ? Result.TExtendsTrue<Inferred> : Result.TExtendsFalse);
|
|
17
17
|
type TElements<Inferred extends TProperties, Reversed extends boolean, LeftRest extends TSchema[], RightRest extends TSchema[]> = TElementsRight<Inferred, Reversed, LeftRest, RightRest>;
|
|
18
18
|
type TExtendsTupleToTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema[], InstantiatedRight extends TSchema[] = TInstantiateElements<Inferred, TState<[], []>, Right>, Reversed extends boolean = TReversed<InstantiatedRight>> = TElements<Inferred, Reversed, TApplyReverse<Left, Reversed>, TApplyReverse<InstantiatedRight, Reversed>>;
|
|
19
|
-
type
|
|
19
|
+
type TExtendsTupleToArrayReduce<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema> = (Left extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtendsLeft<Inferred, Head, Right> extends Result.TExtendsTrueLike<infer Inferred extends TProperties> ? TExtendsTupleToArrayReduce<Inferred, Tail, Right> : Result.TExtendsFalse : Result.TExtendsTrue<Inferred>);
|
|
20
|
+
type TExtendsTupleToArray<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema, Inferrable extends TInferable | undefined = TTryInferable<Right>> = (Inferrable extends TInferable ? TInferUnionResult<Inferred, Inferrable['name'], Left, Inferrable['type']> : TExtendsTupleToArrayReduce<Inferred, Left, Right>);
|
|
20
21
|
export type TExtendsTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema, InstantiatedLeft extends TSchema[] = TInstantiateElements<Inferred, TState<[], []>, Left>> = (Right extends TTuple<infer Types extends TSchema[]> ? TExtendsTupleToTuple<Inferred, InstantiatedLeft, Types> : Right extends TArray<infer Type extends TSchema> ? TExtendsTupleToArray<Inferred, InstantiatedLeft, Type> : TExtendsRight<Inferred, TTuple<InstantiatedLeft>, Right>);
|
|
21
22
|
export declare function ExtendsTuple<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema>(inferred: Inferred, left: Left, right: Right): TExtendsTuple<Inferred, Left, Right>;
|
|
22
23
|
export {};
|
|
@@ -47,11 +47,31 @@ function ExtendsTupleToTuple(inferred, left, right) {
|
|
|
47
47
|
const reversed = Reversed(instantiatedRight);
|
|
48
48
|
return Elements(inferred, reversed, ApplyReverse(left, reversed), ApplyReverse(instantiatedRight, reversed));
|
|
49
49
|
}
|
|
50
|
+
// function ExtendsTupleToArrayReduce<Inferred extends TProperties, Left extends TSchema[], Right extends TSchema>
|
|
51
|
+
// (inferred: Inferred, left: [...Left], right: Right):
|
|
52
|
+
// TExtendsTupleToArrayReduce<Inferred, Left, Right> {
|
|
53
|
+
// return (
|
|
54
|
+
// Guard.ShiftLeft(left, (head, tail) =>
|
|
55
|
+
// Result.Match(ExtendsLeft(inferred, head, right), inferred =>
|
|
56
|
+
// ExtendsTupleToArrayReduce(inferred, tail, right), // Stack Overflow Here (Large Left)
|
|
57
|
+
// () => Result.ExtendsFalse()),
|
|
58
|
+
// () => Result.ExtendsTrue(inferred))
|
|
59
|
+
// ) as never
|
|
60
|
+
// }
|
|
61
|
+
function ExtendsTupleToArrayReduce(inferred, left, right) {
|
|
62
|
+
for (const head of left) {
|
|
63
|
+
const result = ExtendsLeft(inferred, head, right);
|
|
64
|
+
if (!Result.IsExtendsTrueLike(result))
|
|
65
|
+
return result;
|
|
66
|
+
inferred = result.inferred; // (review-assign-to-argument)
|
|
67
|
+
}
|
|
68
|
+
return Result.ExtendsTrue(inferred);
|
|
69
|
+
}
|
|
50
70
|
function ExtendsTupleToArray(inferred, left, right) {
|
|
51
71
|
const inferrable = TryInferable(right);
|
|
52
72
|
return (IsInferable(inferrable)
|
|
53
73
|
? InferUnionResult(inferred, inferrable['name'], left, inferrable['type'])
|
|
54
|
-
:
|
|
74
|
+
: ExtendsTupleToArrayReduce(inferred, left, right));
|
|
55
75
|
}
|
|
56
76
|
export function ExtendsTuple(inferred, left, right) {
|
|
57
77
|
const instantiatedLeft = InstantiateElements(inferred, State([], []), left);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import {
|
|
3
|
-
import { Arguments } from '../../system/
|
|
2
|
+
import { EnableParseErrors, DisableParseErrors } from '../../system/settings/internal.mjs';
|
|
3
|
+
import { Arguments, Settings } from '../../system/index.mjs';
|
|
4
4
|
import { AssertError } from '../assert/index.mjs';
|
|
5
5
|
import { Check } from '../check/index.mjs';
|
|
6
6
|
import { Errors } from '../errors/index.mjs';
|
|
@@ -18,8 +18,11 @@ export class ParseError extends AssertError {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
function Assert(context, type, value) {
|
|
21
|
+
EnableParseErrors();
|
|
22
|
+
const errors = Errors(context, type, value);
|
|
23
|
+
DisableParseErrors();
|
|
21
24
|
if (!Check(context, type, value))
|
|
22
|
-
throw new ParseError(value,
|
|
25
|
+
throw new ParseError(value, errors);
|
|
23
26
|
return value;
|
|
24
27
|
}
|
|
25
28
|
// ------------------------------------------------------------------
|
|
@@ -43,5 +46,8 @@ export function Parse(...args) {
|
|
|
43
46
|
return value;
|
|
44
47
|
if (Settings.Get().correctiveParse)
|
|
45
48
|
return Parser(context, type, value);
|
|
46
|
-
|
|
49
|
+
EnableParseErrors();
|
|
50
|
+
const errors = Errors(context, type, value);
|
|
51
|
+
DisableParseErrors();
|
|
52
|
+
throw new ParseError(value, errors);
|
|
47
53
|
}
|
|
@@ -166,9 +166,11 @@ import Schema from 'typebox/schema'
|
|
|
166
166
|
|
|
167
167
|
### Compile
|
|
168
168
|
|
|
169
|
-
The compiler accepts
|
|
169
|
+
The compiler accepts TypeBox types as well as plain JSON Schema objects, and returns a Validator instance which can be used to check values. The following compiles a Vector type.
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
+
import Schema from 'typebox/schema'
|
|
173
|
+
|
|
172
174
|
// Compile
|
|
173
175
|
|
|
174
176
|
const Vector = Schema.Compile(Type.Script(`{
|
|
@@ -21,28 +21,65 @@ npm i undici
|
|
|
21
21
|
|
|
22
22
|
## Benchmarks
|
|
23
23
|
|
|
24
|
-
The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using
|
|
25
|
-
50 TCP connections with a pipelining depth of 10 running on Node
|
|
24
|
+
The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using
|
|
25
|
+
50 TCP connections with a pipelining depth of 10 running on Node 24.14.1.
|
|
26
|
+
|
|
27
|
+
### HTTP/1.1
|
|
26
28
|
|
|
27
29
|
```
|
|
28
30
|
┌────────────────────────┬─────────┬────────────────────┬────────────┬─────────────────────────┐
|
|
29
31
|
│ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
|
|
30
32
|
├────────────────────────┼─────────┼────────────────────┼────────────┼─────────────────────────┤
|
|
31
|
-
│ '
|
|
32
|
-
│ '
|
|
33
|
-
│ '
|
|
34
|
-
│ '
|
|
35
|
-
│ '
|
|
36
|
-
│ 'got' │
|
|
37
|
-
│ '
|
|
38
|
-
│ '
|
|
39
|
-
│ 'undici - pipeline' │
|
|
40
|
-
│ 'undici -
|
|
41
|
-
│ 'undici -
|
|
42
|
-
│ 'undici - dispatch' │
|
|
33
|
+
│ 'node-fetch' │ 50 │ '4711.86 req/sec' │ '± 2.92 %' │ '-' │
|
|
34
|
+
│ 'undici - fetch' │ 75 │ '5438.50 req/sec' │ '± 2.97 %' │ '+ 15.42 %' │
|
|
35
|
+
│ 'axios' │ 45 │ '5448.08 req/sec' │ '± 2.98 %' │ '+ 15.62 %' │
|
|
36
|
+
│ 'request' │ 65 │ '5809.63 req/sec' │ '± 2.90 %' │ '+ 23.30 %' │
|
|
37
|
+
│ 'http - no keepalive' │ 35 │ '5910.77 req/sec' │ '± 2.87 %' │ '+ 25.44 %' │
|
|
38
|
+
│ 'got' │ 50 │ '6047.80 req/sec' │ '± 2.91 %' │ '+ 28.35 %' │
|
|
39
|
+
│ 'superagent' │ 60 │ '7534.53 req/sec' │ '± 2.97 %' │ '+ 59.91 %' │
|
|
40
|
+
│ 'http - keepalive' │ 75 │ '9343.41 req/sec' │ '± 2.90 %' │ '+ 98.30 %' │
|
|
41
|
+
│ 'undici - pipeline' │ 65 │ '13470.70 req/sec' │ '± 2.93 %' │ '+ 185.89 %' │
|
|
42
|
+
│ 'undici - request' │ 80 │ '16850.87 req/sec' │ '± 2.93 %' │ '+ 257.63 %' │
|
|
43
|
+
│ 'undici - stream' │ 101 │ '18488.56 req/sec' │ '± 3.81 %' │ '+ 292.38 %' │
|
|
44
|
+
│ 'undici - dispatch' │ 101 │ '20786.44 req/sec' │ '± 3.08 %' │ '+ 341.15 %' │
|
|
43
45
|
└────────────────────────┴─────────┴────────────────────┴────────────┴─────────────────────────┘
|
|
44
46
|
```
|
|
45
47
|
|
|
48
|
+
### HTTP/1.1 over HTTPS
|
|
49
|
+
|
|
50
|
+
Using [benchmark-https.js](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark-https.js) against an h1-over-TLS server (50 connections, pipelining depth 10, Node 24.14.1).
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
┌────────────────────────┬─────────┬───────────────────┬────────────┬─────────────────────────┐
|
|
54
|
+
│ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
|
|
55
|
+
├────────────────────────┼─────────┼───────────────────┼────────────┼─────────────────────────┤
|
|
56
|
+
│ 'https - no keepalive'│ 10 │ '1358.40 req/sec' │ '± 1.99 %' │ '-' │
|
|
57
|
+
│ 'undici - fetch' │ 30 │ '3721.76 req/sec' │ '± 2.97 %' │ '+ 173.98 %' │
|
|
58
|
+
│ 'https - keepalive' │ 35 │ '5633.91 req/sec' │ '± 2.84 %' │ '+ 314.75 %' │
|
|
59
|
+
│ 'undici - pipeline' │ 15 │ '6254.05 req/sec' │ '± 2.80 %' │ '+ 360.40 %' │
|
|
60
|
+
│ 'undici - request' │ 25 │ '6669.80 req/sec' │ '± 2.73 %' │ '+ 391.01 %' │
|
|
61
|
+
│ 'undici - stream' │ 25 │ '7019.04 req/sec' │ '± 2.77 %' │ '+ 416.71 %' │
|
|
62
|
+
│ 'undici - dispatch' │ 20 │ '7361.85 req/sec' │ '± 2.90 %' │ '+ 441.95 %' │
|
|
63
|
+
└────────────────────────┴─────────┴───────────────────┴────────────┴─────────────────────────┘
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### HTTP/2
|
|
67
|
+
|
|
68
|
+
Using [benchmark-http2.js](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark-http2.js) against an h2 server (50 connections, pipelining depth 10, Node 24.14.1).
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
┌────────────────────────┬─────────┬───────────────────┬────────────┬─────────────────────────┐
|
|
72
|
+
│ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
|
|
73
|
+
├────────────────────────┼─────────┼───────────────────┼────────────┼─────────────────────────┤
|
|
74
|
+
│ 'undici - fetch' │ 45 │ '3499.03 req/sec' │ '± 2.93 %' │ '-' │
|
|
75
|
+
│ 'native - http2' │ 25 │ '4904.58 req/sec' │ '± 2.81 %' │ '+ 40.17 %' │
|
|
76
|
+
│ 'undici - pipeline' │ 60 │ '5836.82 req/sec' │ '± 2.99 %' │ '+ 66.81 %' │
|
|
77
|
+
│ 'undici - request' │ 65 │ '6831.25 req/sec' │ '± 2.83 %' │ '+ 95.23 %' │
|
|
78
|
+
│ 'undici - stream' │ 55 │ '6874.30 req/sec' │ '± 2.91 %' │ '+ 96.46 %' │
|
|
79
|
+
│ 'undici - dispatch' │ 55 │ '7791.23 req/sec' │ '± 2.96 %' │ '+ 122.67 %' │
|
|
80
|
+
└────────────────────────┴─────────┴───────────────────┴────────────┴─────────────────────────┘
|
|
81
|
+
```
|
|
82
|
+
|
|
46
83
|
## Undici vs. Fetch
|
|
47
84
|
|
|
48
85
|
### Overview
|
|
@@ -200,7 +237,9 @@ await fetch('https://example.com', {
|
|
|
200
237
|
```
|
|
201
238
|
|
|
202
239
|
`install()` replaces the global `fetch`, `Headers`, `Response`, `Request`, and
|
|
203
|
-
`FormData` implementations with undici's versions, so they all match.
|
|
240
|
+
`FormData` implementations with undici's versions, so they all match. It also
|
|
241
|
+
installs undici's `WebSocket`, `CloseEvent`, `ErrorEvent`, `MessageEvent`, and
|
|
242
|
+
`EventSource` globals.
|
|
204
243
|
|
|
205
244
|
Avoid mixing a global `FormData` with `undici.fetch()`, or `undici.FormData`
|
|
206
245
|
with the built-in global `fetch()`.
|
|
@@ -283,12 +322,12 @@ const data2 = await getData();
|
|
|
283
322
|
|
|
284
323
|
## Global Installation
|
|
285
324
|
|
|
286
|
-
Undici provides an `install()` function to add
|
|
325
|
+
Undici provides an `install()` function to add fetch-related and other web API classes to `globalThis`, making them available globally:
|
|
287
326
|
|
|
288
327
|
```js
|
|
289
328
|
import { install } from 'undici'
|
|
290
329
|
|
|
291
|
-
// Install
|
|
330
|
+
// Install undici's global web APIs
|
|
292
331
|
install()
|
|
293
332
|
|
|
294
333
|
// Now you can use fetch classes globally without importing
|
|
@@ -316,8 +355,9 @@ The `install()` function adds the following classes to `globalThis`:
|
|
|
316
355
|
|
|
317
356
|
When you call `install()`, these globals come from the same undici
|
|
318
357
|
implementation. For example, global `fetch` and global `FormData` will both be
|
|
319
|
-
undici's versions,
|
|
320
|
-
through
|
|
358
|
+
undici's versions, and `WebSocket` and `EventSource` will also come from
|
|
359
|
+
undici, which is the recommended setup if you want to use undici through
|
|
360
|
+
globals.
|
|
321
361
|
|
|
322
362
|
This is useful for:
|
|
323
363
|
- Polyfilling environments that don't have fetch
|
|
@@ -337,6 +377,9 @@ The `body` mixins are the most common way to format the request/response body. M
|
|
|
337
377
|
> [!NOTE]
|
|
338
378
|
> The body returned from `undici.request` does not implement `.formData()`.
|
|
339
379
|
|
|
380
|
+
> [!WARNING]
|
|
381
|
+
> Calling `body.formData()` on a fetch response causes undici to buffer and parse the entire body. Since this is dictated by the spec, `body.formData()` must only be called on responses from trusted servers.
|
|
382
|
+
|
|
340
383
|
Example usage:
|
|
341
384
|
|
|
342
385
|
```js
|
|
@@ -365,6 +408,11 @@ For more information about their behavior, please reference the body mixin from
|
|
|
365
408
|
|
|
366
409
|
This section documents our most commonly used API methods. Additional APIs are documented in their own files within the [docs](./docs/) folder and are accessible via the navigation list on the left side of the docs site.
|
|
367
410
|
|
|
411
|
+
For the top-level APIs below, the `url` argument supplies the request origin and
|
|
412
|
+
path. Do not pass `origin` or `path` in the second `options` argument. The linked
|
|
413
|
+
`Dispatcher` option types include those fields because dispatcher methods are
|
|
414
|
+
lower-level APIs that do not receive a separate `url` argument.
|
|
415
|
+
|
|
368
416
|
### `undici.request([url, options]): Promise`
|
|
369
417
|
|
|
370
418
|
Arguments:
|
|
@@ -619,6 +667,12 @@ See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-
|
|
|
619
667
|
Sets the global dispatcher used by Common API Methods. Global dispatcher is shared among compatible undici modules,
|
|
620
668
|
including undici that is bundled internally with node.js.
|
|
621
669
|
|
|
670
|
+
Undici stores this dispatcher under `Symbol.for('undici.globalDispatcher.2')`.
|
|
671
|
+
|
|
672
|
+
`setGlobalDispatcher()` also mirrors the configured dispatcher to
|
|
673
|
+
`Symbol.for('undici.globalDispatcher.1')` using `Dispatcher1Wrapper`, so Node.js built-in `fetch`
|
|
674
|
+
can keep using the legacy handler contract while Undici uses the new handler API.
|
|
675
|
+
|
|
622
676
|
### `undici.getGlobalDispatcher()`
|
|
623
677
|
|
|
624
678
|
Gets the global dispatcher used by Common API Methods.
|
|
@@ -668,8 +722,9 @@ Refs: https://tools.ietf.org/html/rfc7231#section-5.1.1
|
|
|
668
722
|
#### Pipelining
|
|
669
723
|
|
|
670
724
|
Undici will only use pipelining if configured with a `pipelining` factor
|
|
671
|
-
greater than `1`.
|
|
672
|
-
|
|
725
|
+
greater than `1`. Only enable pipelining when the remote server is trusted.
|
|
726
|
+
Also it is important to pass `blocking: false` to the request options to
|
|
727
|
+
properly pipeline requests.
|
|
673
728
|
|
|
674
729
|
Undici always assumes that connections are persistent and will immediately
|
|
675
730
|
pipeline requests, without checking whether the connection is persistent.
|
|
@@ -731,10 +786,11 @@ and `undici.Agent`) which will enable the family autoselection algorithm when es
|
|
|
731
786
|
Undici aligns with the Node.js LTS schedule. The following table shows the supported versions:
|
|
732
787
|
|
|
733
788
|
| Undici Version | Bundled in Node.js | Node.js Versions Supported | End of Life |
|
|
734
|
-
|
|
735
|
-
| 5.x
|
|
736
|
-
| 6.x
|
|
737
|
-
| 7.x
|
|
789
|
+
|----------------|--------------------|----------------------------|-------------|
|
|
790
|
+
| 5.x | 18.x | ≥14.0 (tested: 14, 16, 18) | 2024-04-30 |
|
|
791
|
+
| 6.x | 20.x, 22.x | ≥18.17 (tested: 18, 20, 21, 22) | 2027-04-30 |
|
|
792
|
+
| 7.x | 24.x | ≥20.18.1 (tested: 20, 22, 24) | 2028-04-30 |
|
|
793
|
+
| 8.x | 26.x | ≥22.19.0 (tested: 22, 24, 26) | 2029-04-30 |
|
|
738
794
|
|
|
739
795
|
## License
|
|
740
796
|
|