@openclaw/slack 2026.9.8 → 2026.10.1-beta.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/dist/.setup/{account-inspect-DWBXpER6.mjs → account-inspect-Cs-7DXXW.mjs} +1 -1
- package/dist/.setup/{accounts-D_N9IqNA.mjs → accounts-CDgkV7Cm.mjs} +4 -16
- package/dist/.setup/{action-runtime-DfWvuiZd.mjs → action-runtime-DJ1daRAZ.mjs} +5 -7
- package/dist/.setup/action-runtime.runtime-CdWL2mLC.mjs +2 -0
- package/dist/.setup/{actions-Df0CzcDl.mjs → actions-DDoAJnrH.mjs} +16 -35
- package/dist/.setup/{approval-handler.runtime-Ed6Sw5VK.mjs → approval-handler.runtime-BcE_shWc.mjs} +5 -5
- package/dist/.setup/{approval-message-updates-BadvtA7R.mjs → approval-message-updates-EgKGmFXx.mjs} +1 -1
- package/dist/.setup/{channel-C7bgPSTE.mjs → channel-DgKSu8Iv.mjs} +46 -48
- package/dist/.setup/{channel-type-ClOttrZ5.mjs → channel-type-B9zYYzBU.mjs} +4 -4
- package/dist/.setup/{channel.setup-Dh2jzAjN.mjs → channel.setup-BYIlwbQ7.mjs} +27 -27
- package/dist/.setup/{config-schema-BZCxmHKG.mjs → config-schema-BH0K9-Um.mjs} +4 -0
- package/dist/.setup/{directory-config-BOUWH3hR.mjs → directory-config-B_by7zrc.mjs} +2 -2
- package/dist/.setup/{directory-live-B2O4B_Ho.mjs → directory-live-C48wazJt.mjs} +3 -3
- package/dist/.setup/{doctor-contract-CRN1Z_c7.mjs → doctor-contract-Cd4-VzIM.mjs} +28 -28
- package/dist/.setup/{message-tool-api-Cu4lwlGy.mjs → message-tool-api-CcjLPN3v.mjs} +2 -2
- package/dist/.setup/{monitor-BPVfkumU.mjs → monitor-BuYBDmm7.mjs} +190 -315
- package/dist/.setup/{outbound-adapter-Bv48XUjq.mjs → outbound-adapter-BZFkK-mw.mjs} +6 -17
- package/dist/.setup/{pipeline.runtime-B1H63Frf.mjs → pipeline.runtime-CIepKmZt.mjs} +241 -247
- package/dist/.setup/{policy-D-jfM174.mjs → policy-KKTqEiDv.mjs} +12 -22
- package/dist/.setup/{probe-B2Y9qc_z.mjs → probe-BVlJ3dp0.mjs} +4 -7
- package/dist/.setup/{relay-source-BpKdjsll.mjs → relay-source-CC3h6M7y.mjs} +2 -2
- package/dist/.setup/{replies-BAnUtr2f.mjs → replies-DHbuthIR.mjs} +12 -26
- package/dist/.setup/{reply-blocks-SE1kTE3I.mjs → reply-blocks-CKnO4BSG.mjs} +4 -29
- package/dist/.setup/{resolve-channels-XXBn8UU_.mjs → resolve-channels-HR0TgArR.mjs} +2 -2
- package/dist/.setup/{resolve-users-DW0ngD03.mjs → resolve-users-BNYBhF0q.mjs} +4 -4
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{scopes-CasuDvaa.mjs → scopes-DrDbyUH2.mjs} +1 -1
- package/dist/.setup/secret-contract-B-Qm6aQQ.mjs +65 -0
- package/dist/.setup/{secret-contract-api-Dp6290Vg.mjs → secret-contract-api-DmUVxIRs.mjs} +1 -1
- package/dist/.setup/{security-audit-BqDc-6VL.mjs → security-audit-C1nOGzJa.mjs} +1 -1
- package/dist/.setup/{send-BOVLQi3n.mjs → send-CgPI3Zj8.mjs} +22 -53
- package/dist/.setup/{session-status-DscajIsd.mjs → session-status-D46GHwOV.mjs} +39 -49
- package/dist/.setup/{setup-plugin-api-DTtbTKNk.mjs → setup-plugin-api-ZrHs0N4U.mjs} +1 -1
- package/dist/.setup/{setup-surface-Dn7QgWRE.mjs → setup-surface-83lxvE2y.mjs} +10 -13
- package/dist/.setup/{shared-qau-uDGl.mjs → shared-VtmYNj-v.mjs} +53 -57
- package/dist/.setup/{slash-dispatch.runtime--AEzLVBF.mjs → slash-dispatch.runtime-gBj_uaLM.mjs} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +13 -13
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/control-ui/2f4b1e827be6b68ced2ea0d8b7da8529a4eafbe72be27ee37e1064bdd530ec10/index.js +1 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +10 -10
- 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/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/openclaw.plugin.json +4 -1
- package/package.json +14 -6
- package/dist/.setup/action-runtime.runtime-Ck4bAWOX.mjs +0 -2
- package/dist/.setup/secret-contract-BaZcu6P_.mjs +0 -82
- package/dist/.setup/streaming-compat-C5Wut626.mjs +0 -62
|
@@ -83,6 +83,7 @@ function buildAbort (acRef) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
let patchMethodWarning = false
|
|
86
|
+
let setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState, removeRequestAbortListener
|
|
86
87
|
|
|
87
88
|
// https://fetch.spec.whatwg.org/#request-class
|
|
88
89
|
class Request {
|
|
@@ -600,7 +601,7 @@ class Request {
|
|
|
600
601
|
|
|
601
602
|
// Returns request’s HTTP method, which is "GET" by default.
|
|
602
603
|
get method () {
|
|
603
|
-
webidl.brandCheck(this, Request)
|
|
604
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
604
605
|
|
|
605
606
|
// The method getter steps are to return this’s request’s method.
|
|
606
607
|
return this.#state.method
|
|
@@ -608,7 +609,7 @@ class Request {
|
|
|
608
609
|
|
|
609
610
|
// Returns the URL of request as a string.
|
|
610
611
|
get url () {
|
|
611
|
-
webidl.brandCheck(this, Request)
|
|
612
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
612
613
|
|
|
613
614
|
// The url getter steps are to return this’s request’s URL, serialized.
|
|
614
615
|
return URLSerializer(this.#state.url)
|
|
@@ -618,7 +619,7 @@ class Request {
|
|
|
618
619
|
// Note that headers added in the network layer by the user agent will not
|
|
619
620
|
// be accounted for in this object, e.g., the "Host" header.
|
|
620
621
|
get headers () {
|
|
621
|
-
webidl.brandCheck(this, Request)
|
|
622
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
622
623
|
|
|
623
624
|
// The headers getter steps are to return this’s headers.
|
|
624
625
|
return this.#headers
|
|
@@ -627,7 +628,7 @@ class Request {
|
|
|
627
628
|
// Returns the kind of resource requested by request, e.g., "document"
|
|
628
629
|
// or "script".
|
|
629
630
|
get destination () {
|
|
630
|
-
webidl.brandCheck(this, Request)
|
|
631
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
631
632
|
|
|
632
633
|
// The destination getter are to return this’s request’s destination.
|
|
633
634
|
return this.#state.destination
|
|
@@ -639,7 +640,7 @@ class Request {
|
|
|
639
640
|
// during fetching to determine the value of the `Referer` header of the
|
|
640
641
|
// request being made.
|
|
641
642
|
get referrer () {
|
|
642
|
-
webidl.brandCheck(this, Request)
|
|
643
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
643
644
|
|
|
644
645
|
// 1. If this’s request’s referrer is "no-referrer", then return the
|
|
645
646
|
// empty string.
|
|
@@ -661,7 +662,7 @@ class Request {
|
|
|
661
662
|
// This is used during fetching to compute the value of the request’s
|
|
662
663
|
// referrer.
|
|
663
664
|
get referrerPolicy () {
|
|
664
|
-
webidl.brandCheck(this, Request)
|
|
665
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
665
666
|
|
|
666
667
|
// The referrerPolicy getter steps are to return this’s request’s referrer policy.
|
|
667
668
|
return this.#state.referrerPolicy
|
|
@@ -671,7 +672,7 @@ class Request {
|
|
|
671
672
|
// whether the request will use CORS, or will be restricted to same-origin
|
|
672
673
|
// URLs.
|
|
673
674
|
get mode () {
|
|
674
|
-
webidl.brandCheck(this, Request)
|
|
675
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
675
676
|
|
|
676
677
|
// The mode getter steps are to return this’s request’s mode.
|
|
677
678
|
return this.#state.mode
|
|
@@ -681,7 +682,7 @@ class Request {
|
|
|
681
682
|
// which is a string indicating whether credentials will be sent with the
|
|
682
683
|
// request always, never, or only when sent to a same-origin URL.
|
|
683
684
|
get credentials () {
|
|
684
|
-
webidl.brandCheck(this, Request)
|
|
685
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
685
686
|
|
|
686
687
|
// The credentials getter steps are to return this’s request’s credentials mode.
|
|
687
688
|
return this.#state.credentials
|
|
@@ -691,7 +692,7 @@ class Request {
|
|
|
691
692
|
// which is a string indicating how the request will
|
|
692
693
|
// interact with the browser’s cache when fetching.
|
|
693
694
|
get cache () {
|
|
694
|
-
webidl.brandCheck(this, Request)
|
|
695
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
695
696
|
|
|
696
697
|
// The cache getter steps are to return this’s request’s cache mode.
|
|
697
698
|
return this.#state.cache
|
|
@@ -702,7 +703,7 @@ class Request {
|
|
|
702
703
|
// request will be handled during fetching. A request
|
|
703
704
|
// will follow redirects by default.
|
|
704
705
|
get redirect () {
|
|
705
|
-
webidl.brandCheck(this, Request)
|
|
706
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
706
707
|
|
|
707
708
|
// The redirect getter steps are to return this’s request’s redirect mode.
|
|
708
709
|
return this.#state.redirect
|
|
@@ -712,7 +713,7 @@ class Request {
|
|
|
712
713
|
// cryptographic hash of the resource being fetched. Its value
|
|
713
714
|
// consists of multiple hashes separated by whitespace. [SRI]
|
|
714
715
|
get integrity () {
|
|
715
|
-
webidl.brandCheck(this, Request)
|
|
716
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
716
717
|
|
|
717
718
|
// The integrity getter steps are to return this’s request’s integrity
|
|
718
719
|
// metadata.
|
|
@@ -722,7 +723,7 @@ class Request {
|
|
|
722
723
|
// Returns a boolean indicating whether or not request can outlive the
|
|
723
724
|
// global in which it was created.
|
|
724
725
|
get keepalive () {
|
|
725
|
-
webidl.brandCheck(this, Request)
|
|
726
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
726
727
|
|
|
727
728
|
// The keepalive getter steps are to return this’s request’s keepalive.
|
|
728
729
|
return this.#state.keepalive
|
|
@@ -731,7 +732,7 @@ class Request {
|
|
|
731
732
|
// Returns a boolean indicating whether or not request is for a reload
|
|
732
733
|
// navigation.
|
|
733
734
|
get isReloadNavigation () {
|
|
734
|
-
webidl.brandCheck(this, Request)
|
|
735
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
735
736
|
|
|
736
737
|
// The isReloadNavigation getter steps are to return true if this’s
|
|
737
738
|
// request’s reload-navigation flag is set; otherwise false.
|
|
@@ -741,7 +742,7 @@ class Request {
|
|
|
741
742
|
// Returns a boolean indicating whether or not request is for a history
|
|
742
743
|
// navigation (a.k.a. back-forward navigation).
|
|
743
744
|
get isHistoryNavigation () {
|
|
744
|
-
webidl.brandCheck(this, Request)
|
|
745
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
745
746
|
|
|
746
747
|
// The isHistoryNavigation getter steps are to return true if this’s request’s
|
|
747
748
|
// history-navigation flag is set; otherwise false.
|
|
@@ -752,33 +753,33 @@ class Request {
|
|
|
752
753
|
// object indicating whether or not request has been aborted, and its
|
|
753
754
|
// abort event handler.
|
|
754
755
|
get signal () {
|
|
755
|
-
webidl.brandCheck(this, Request)
|
|
756
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
756
757
|
|
|
757
758
|
// The signal getter steps are to return this’s signal.
|
|
758
759
|
return this.#signal
|
|
759
760
|
}
|
|
760
761
|
|
|
761
762
|
get body () {
|
|
762
|
-
webidl.brandCheck(this, Request)
|
|
763
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
763
764
|
|
|
764
765
|
return this.#state.body ? this.#state.body.stream : null
|
|
765
766
|
}
|
|
766
767
|
|
|
767
768
|
get bodyUsed () {
|
|
768
|
-
webidl.brandCheck(this, Request)
|
|
769
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
769
770
|
|
|
770
771
|
return !!this.#state.body && util.isDisturbed(this.#state.body.stream)
|
|
771
772
|
}
|
|
772
773
|
|
|
773
774
|
get duplex () {
|
|
774
|
-
webidl.brandCheck(this, Request)
|
|
775
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
775
776
|
|
|
776
777
|
return 'half'
|
|
777
778
|
}
|
|
778
779
|
|
|
779
780
|
// Returns a clone of request.
|
|
780
781
|
clone () {
|
|
781
|
-
webidl.brandCheck(this, Request)
|
|
782
|
+
webidl.brandCheck(this, webidl.is.Request)
|
|
782
783
|
|
|
783
784
|
// 1. If this is unusable, then throw a TypeError.
|
|
784
785
|
if (bodyUnusable(this.#state)) {
|
|
@@ -840,73 +841,69 @@ class Request {
|
|
|
840
841
|
return `Request ${nodeUtil.formatWithOptions(options, properties)}`
|
|
841
842
|
}
|
|
842
843
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
844
|
+
static {
|
|
845
|
+
/**
|
|
846
|
+
* @param {Request} request
|
|
847
|
+
* @param {AbortSignal} newSignal
|
|
848
|
+
*/
|
|
849
|
+
setRequestSignal = (request, newSignal) => {
|
|
850
|
+
request.#signal = newSignal
|
|
851
|
+
}
|
|
851
852
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
853
|
+
/**
|
|
854
|
+
* @param {Request} request
|
|
855
|
+
*/
|
|
856
|
+
getRequestDispatcher = (request) => {
|
|
857
|
+
return request.#dispatcher
|
|
858
|
+
}
|
|
858
859
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
860
|
+
/**
|
|
861
|
+
* @param {Request} request
|
|
862
|
+
* @param {import('../../dispatcher/dispatcher')} newDispatcher
|
|
863
|
+
*/
|
|
864
|
+
setRequestDispatcher = (request, newDispatcher) => {
|
|
865
|
+
request.#dispatcher = newDispatcher
|
|
866
|
+
}
|
|
866
867
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
868
|
+
/**
|
|
869
|
+
* @param {Request} request
|
|
870
|
+
* @param {Headers} newHeaders
|
|
871
|
+
*/
|
|
872
|
+
setRequestHeaders = (request, newHeaders) => {
|
|
873
|
+
request.#headers = newHeaders
|
|
874
|
+
}
|
|
874
875
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
876
|
+
/**
|
|
877
|
+
* @param {Request} request
|
|
878
|
+
*/
|
|
879
|
+
getRequestState = (request) => {
|
|
880
|
+
return request.#state
|
|
881
|
+
}
|
|
881
882
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
883
|
+
/**
|
|
884
|
+
* @param {Request} request
|
|
885
|
+
* @param {any} newState
|
|
886
|
+
*/
|
|
887
|
+
setRequestState = (request, newState) => {
|
|
888
|
+
request.#state = newState
|
|
889
|
+
}
|
|
889
890
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
891
|
+
/**
|
|
892
|
+
* Removes the `abort` listener that makes this request's signal follow the
|
|
893
|
+
* signal passed to its constructor, if any. Idempotent.
|
|
894
|
+
* @param {Request} request
|
|
895
|
+
*/
|
|
896
|
+
removeRequestAbortListener = (request) => {
|
|
897
|
+
request.#abortCleanup?.()
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
webidl.is.Request = (arg) => {
|
|
901
|
+
return arg != null && typeof arg === 'object' && #state in arg
|
|
902
|
+
}
|
|
897
903
|
}
|
|
898
904
|
}
|
|
899
905
|
|
|
900
|
-
|
|
901
|
-
Reflect.deleteProperty(Request, 'setRequestSignal')
|
|
902
|
-
Reflect.deleteProperty(Request, 'getRequestDispatcher')
|
|
903
|
-
Reflect.deleteProperty(Request, 'setRequestDispatcher')
|
|
904
|
-
Reflect.deleteProperty(Request, 'setRequestHeaders')
|
|
905
|
-
Reflect.deleteProperty(Request, 'getRequestState')
|
|
906
|
-
Reflect.deleteProperty(Request, 'setRequestState')
|
|
907
|
-
Reflect.deleteProperty(Request, 'removeRequestAbortListener')
|
|
908
|
-
|
|
909
|
-
mixinBody(Request, getRequestState)
|
|
906
|
+
mixinBody(Request, getRequestState, webidl.is.Request)
|
|
910
907
|
|
|
911
908
|
// https://fetch.spec.whatwg.org/#requests
|
|
912
909
|
function makeRequest (init) {
|
|
@@ -1021,8 +1018,6 @@ Object.defineProperties(Request.prototype, {
|
|
|
1021
1018
|
}
|
|
1022
1019
|
})
|
|
1023
1020
|
|
|
1024
|
-
webidl.is.Request = webidl.util.MakeTypeAssertion(Request)
|
|
1025
|
-
|
|
1026
1021
|
/**
|
|
1027
1022
|
* @param {*} V
|
|
1028
1023
|
* @returns {import('../../../types/fetch').Request|string}
|
|
@@ -23,6 +23,7 @@ const assert = require('node:assert')
|
|
|
23
23
|
const { isomorphicEncode, serializeJavascriptValueToJSONString } = require('../infra')
|
|
24
24
|
|
|
25
25
|
const textEncoder = new TextEncoder('utf-8')
|
|
26
|
+
let getResponseHeaders, setResponseHeaders, getResponseState, setResponseState
|
|
26
27
|
|
|
27
28
|
// https://fetch.spec.whatwg.org/#response-class
|
|
28
29
|
class Response {
|
|
@@ -145,7 +146,7 @@ class Response {
|
|
|
145
146
|
|
|
146
147
|
// Returns response’s type, e.g., "cors".
|
|
147
148
|
get type () {
|
|
148
|
-
webidl.brandCheck(this, Response)
|
|
149
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
149
150
|
|
|
150
151
|
// The type getter steps are to return this’s response’s type.
|
|
151
152
|
return this.#state.type
|
|
@@ -153,7 +154,7 @@ class Response {
|
|
|
153
154
|
|
|
154
155
|
// Returns response’s URL, if it has one; otherwise the empty string.
|
|
155
156
|
get url () {
|
|
156
|
-
webidl.brandCheck(this, Response)
|
|
157
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
157
158
|
|
|
158
159
|
const urlList = this.#state.urlList
|
|
159
160
|
|
|
@@ -171,7 +172,7 @@ class Response {
|
|
|
171
172
|
|
|
172
173
|
// Returns whether response was obtained through a redirect.
|
|
173
174
|
get redirected () {
|
|
174
|
-
webidl.brandCheck(this, Response)
|
|
175
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
175
176
|
|
|
176
177
|
// The redirected getter steps are to return true if this’s response’s URL
|
|
177
178
|
// list has more than one item; otherwise false.
|
|
@@ -180,7 +181,7 @@ class Response {
|
|
|
180
181
|
|
|
181
182
|
// Returns response’s status.
|
|
182
183
|
get status () {
|
|
183
|
-
webidl.brandCheck(this, Response)
|
|
184
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
184
185
|
|
|
185
186
|
// The status getter steps are to return this’s response’s status.
|
|
186
187
|
return this.#state.status
|
|
@@ -188,7 +189,7 @@ class Response {
|
|
|
188
189
|
|
|
189
190
|
// Returns whether response’s status is an ok status.
|
|
190
191
|
get ok () {
|
|
191
|
-
webidl.brandCheck(this, Response)
|
|
192
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
192
193
|
|
|
193
194
|
// The ok getter steps are to return true if this’s response’s status is an
|
|
194
195
|
// ok status; otherwise false.
|
|
@@ -197,7 +198,7 @@ class Response {
|
|
|
197
198
|
|
|
198
199
|
// Returns response’s status message.
|
|
199
200
|
get statusText () {
|
|
200
|
-
webidl.brandCheck(this, Response)
|
|
201
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
201
202
|
|
|
202
203
|
// The statusText getter steps are to return this’s response’s status
|
|
203
204
|
// message.
|
|
@@ -206,27 +207,27 @@ class Response {
|
|
|
206
207
|
|
|
207
208
|
// Returns response’s headers as Headers.
|
|
208
209
|
get headers () {
|
|
209
|
-
webidl.brandCheck(this, Response)
|
|
210
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
210
211
|
|
|
211
212
|
// The headers getter steps are to return this’s headers.
|
|
212
213
|
return this.#headers
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
get body () {
|
|
216
|
-
webidl.brandCheck(this, Response)
|
|
217
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
217
218
|
|
|
218
219
|
return this.#state.body ? this.#state.body.stream : null
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
get bodyUsed () {
|
|
222
|
-
webidl.brandCheck(this, Response)
|
|
223
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
223
224
|
|
|
224
225
|
return !!this.#state.body && util.isDisturbed(this.#state.body.stream)
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
// Returns a clone of response.
|
|
228
229
|
clone () {
|
|
229
|
-
webidl.brandCheck(this, Response)
|
|
230
|
+
webidl.brandCheck(this, webidl.is.Response)
|
|
230
231
|
|
|
231
232
|
// 1. If this is unusable, then throw a TypeError.
|
|
232
233
|
if (bodyUnusable(this.#state)) {
|
|
@@ -272,44 +273,44 @@ class Response {
|
|
|
272
273
|
return `Response ${nodeUtil.formatWithOptions(options, properties)}`
|
|
273
274
|
}
|
|
274
275
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
static {
|
|
277
|
+
/**
|
|
278
|
+
* @param {Response} response
|
|
279
|
+
*/
|
|
280
|
+
getResponseHeaders = (response) => {
|
|
281
|
+
return response.#headers
|
|
282
|
+
}
|
|
281
283
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
/**
|
|
285
|
+
* @param {Response} response
|
|
286
|
+
* @param {Headers} newHeaders
|
|
287
|
+
*/
|
|
288
|
+
setResponseHeaders = (response, newHeaders) => {
|
|
289
|
+
response.#headers = newHeaders
|
|
290
|
+
}
|
|
289
291
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
/**
|
|
293
|
+
* @param {Response} response
|
|
294
|
+
*/
|
|
295
|
+
getResponseState = (response) => {
|
|
296
|
+
return response.#state
|
|
297
|
+
}
|
|
296
298
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
/**
|
|
300
|
+
* @param {Response} response
|
|
301
|
+
* @param {any} newState
|
|
302
|
+
*/
|
|
303
|
+
setResponseState = (response, newState) => {
|
|
304
|
+
response.#state = newState
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
webidl.is.Response = (arg) => {
|
|
308
|
+
return arg != null && typeof arg === 'object' && #state in arg
|
|
309
|
+
}
|
|
303
310
|
}
|
|
304
311
|
}
|
|
305
312
|
|
|
306
|
-
|
|
307
|
-
Reflect.deleteProperty(Response, 'getResponseHeaders')
|
|
308
|
-
Reflect.deleteProperty(Response, 'setResponseHeaders')
|
|
309
|
-
Reflect.deleteProperty(Response, 'getResponseState')
|
|
310
|
-
Reflect.deleteProperty(Response, 'setResponseState')
|
|
311
|
-
|
|
312
|
-
mixinBody(Response, getResponseState)
|
|
313
|
+
mixinBody(Response, getResponseState, webidl.is.Response)
|
|
313
314
|
|
|
314
315
|
Object.defineProperties(Response.prototype, {
|
|
315
316
|
type: kEnumerableProperty,
|
|
@@ -624,8 +625,6 @@ webidl.converters.ResponseInit = webidl.dictionaryConverter([
|
|
|
624
625
|
}
|
|
625
626
|
])
|
|
626
627
|
|
|
627
|
-
webidl.is.Response = webidl.util.MakeTypeAssertion(Response)
|
|
628
|
-
|
|
629
628
|
module.exports = {
|
|
630
629
|
isNetworkError,
|
|
631
630
|
makeNetworkError,
|
|
@@ -6,7 +6,7 @@ const { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require('./cons
|
|
|
6
6
|
const { getGlobalOrigin } = require('./global')
|
|
7
7
|
const { collectAnHTTPQuotedString, parseMIMEType } = require('./data-url')
|
|
8
8
|
const { performance } = require('node:perf_hooks')
|
|
9
|
-
const {
|
|
9
|
+
const { isValidHTTPToken, normalizedMethodRecordsBase } = require('../../core/util')
|
|
10
10
|
const assert = require('node:assert')
|
|
11
11
|
const { isUint8Array } = require('node:util/types')
|
|
12
12
|
const { webidl } = require('../webidl')
|
|
@@ -872,8 +872,9 @@ function createIterator (name, kInternalIterator, keyIndex = 0, valueIndex = 1)
|
|
|
872
872
|
* @param {(target: any) => any} kInternalIterator
|
|
873
873
|
* @param {string | number} [keyIndex]
|
|
874
874
|
* @param {string | number} [valueIndex]
|
|
875
|
+
* @param {import('../../../types/webidl').WebidlIsFunction} brandCheck
|
|
875
876
|
*/
|
|
876
|
-
function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) {
|
|
877
|
+
function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueIndex = 1, brandCheck) {
|
|
877
878
|
const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex)
|
|
878
879
|
|
|
879
880
|
const properties = {
|
|
@@ -882,7 +883,7 @@ function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueInde
|
|
|
882
883
|
enumerable: true,
|
|
883
884
|
configurable: true,
|
|
884
885
|
value: function keys () {
|
|
885
|
-
webidl.brandCheck(this,
|
|
886
|
+
webidl.brandCheck(this, brandCheck)
|
|
886
887
|
return makeIterator(this, 'key')
|
|
887
888
|
}
|
|
888
889
|
},
|
|
@@ -891,7 +892,7 @@ function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueInde
|
|
|
891
892
|
enumerable: true,
|
|
892
893
|
configurable: true,
|
|
893
894
|
value: function values () {
|
|
894
|
-
webidl.brandCheck(this,
|
|
895
|
+
webidl.brandCheck(this, brandCheck)
|
|
895
896
|
return makeIterator(this, 'value')
|
|
896
897
|
}
|
|
897
898
|
},
|
|
@@ -900,7 +901,7 @@ function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueInde
|
|
|
900
901
|
enumerable: true,
|
|
901
902
|
configurable: true,
|
|
902
903
|
value: function entries () {
|
|
903
|
-
webidl.brandCheck(this,
|
|
904
|
+
webidl.brandCheck(this, brandCheck)
|
|
904
905
|
return makeIterator(this, 'key+value')
|
|
905
906
|
}
|
|
906
907
|
},
|
|
@@ -909,7 +910,7 @@ function iteratorMixin (name, object, kInternalIterator, keyIndex = 0, valueInde
|
|
|
909
910
|
enumerable: true,
|
|
910
911
|
configurable: true,
|
|
911
912
|
value: function forEach (callbackfn, thisArg = globalThis) {
|
|
912
|
-
webidl.brandCheck(this,
|
|
913
|
+
webidl.brandCheck(this, brandCheck)
|
|
913
914
|
webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`)
|
|
914
915
|
if (typeof callbackfn !== 'function') {
|
|
915
916
|
throw new TypeError(
|
|
@@ -1483,7 +1484,6 @@ module.exports = {
|
|
|
1483
1484
|
isAborted,
|
|
1484
1485
|
isCancelled,
|
|
1485
1486
|
isValidEncodedURL,
|
|
1486
|
-
ReadableStreamFrom,
|
|
1487
1487
|
tryUpgradeRequestToAPotentiallyTrustworthyURL,
|
|
1488
1488
|
clampAndCoarsenConnectionTimingInfo,
|
|
1489
1489
|
coarsenedSharedCurrentTime,
|
|
@@ -156,6 +156,20 @@ function isomorphicEncode (input) {
|
|
|
156
156
|
return input
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
const nonASCIIRegex = /[^\x00-\x7F]/ // eslint-disable-line no-control-regex
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} str
|
|
163
|
+
* @returns {string}
|
|
164
|
+
*
|
|
165
|
+
* @see https://infra.spec.whatwg.org/#ascii-lowercase
|
|
166
|
+
*/
|
|
167
|
+
function asciiLowercase (str) {
|
|
168
|
+
return nonASCIIRegex.test(str)
|
|
169
|
+
? str.replace(/[A-Z]+/g, (upper) => upper.toLowerCase())
|
|
170
|
+
: str.toLowerCase()
|
|
171
|
+
}
|
|
172
|
+
|
|
159
173
|
/**
|
|
160
174
|
* @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
|
|
161
175
|
* @param {Uint8Array} bytes
|
|
@@ -192,7 +206,7 @@ function removeChars (str, leading, trailing, predicate) {
|
|
|
192
206
|
}
|
|
193
207
|
|
|
194
208
|
if (trailing) {
|
|
195
|
-
while (trail
|
|
209
|
+
while (trail >= lead && predicate(str.charCodeAt(trail))) trail--
|
|
196
210
|
}
|
|
197
211
|
|
|
198
212
|
return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1)
|
|
@@ -216,6 +230,7 @@ function serializeJavascriptValueToJSONString (value) {
|
|
|
216
230
|
}
|
|
217
231
|
|
|
218
232
|
module.exports = {
|
|
233
|
+
asciiLowercase,
|
|
219
234
|
collectASequenceOfCodePoints,
|
|
220
235
|
collectASequenceOfCodePointsFast,
|
|
221
236
|
forgivingBase64,
|
|
@@ -73,26 +73,14 @@ webidl.errors.invalidArgument = function (context) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// https://webidl.spec.whatwg.org/#implements
|
|
76
|
-
webidl.brandCheck = function (V,
|
|
77
|
-
if (!
|
|
76
|
+
webidl.brandCheck = function (V, is) {
|
|
77
|
+
if (!is(V)) {
|
|
78
78
|
const err = new TypeError('Illegal invocation')
|
|
79
79
|
err.code = 'ERR_INVALID_THIS' // node compat.
|
|
80
80
|
throw err
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
webidl.brandCheckMultiple = function (List) {
|
|
85
|
-
const prototypes = List.map((c) => webidl.util.MakeTypeAssertion(c))
|
|
86
|
-
|
|
87
|
-
return (V) => {
|
|
88
|
-
if (prototypes.every(typeCheck => !typeCheck(V))) {
|
|
89
|
-
const err = new TypeError('Illegal invocation')
|
|
90
|
-
err.code = 'ERR_INVALID_THIS' // node compat.
|
|
91
|
-
throw err
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
84
|
webidl.argumentLengthCheck = function ({ length }, min, ctx) {
|
|
97
85
|
if (length < min) {
|
|
98
86
|
throw webidl.errors.exception({
|