aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/undici/lib/interceptor/dump.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
commitafa87af01c79a9baa539f2992d32154d2a4739bd (patch)
tree92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/undici/lib/interceptor/dump.js
parent3b927e84d200402281f68181cd4253bc77e5528d (diff)
downloadneko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/undici/lib/interceptor/dump.js')
-rw-r--r--vanilla/node_modules/undici/lib/interceptor/dump.js112
1 files changed, 0 insertions, 112 deletions
diff --git a/vanilla/node_modules/undici/lib/interceptor/dump.js b/vanilla/node_modules/undici/lib/interceptor/dump.js
deleted file mode 100644
index 4810a09..0000000
--- a/vanilla/node_modules/undici/lib/interceptor/dump.js
+++ /dev/null
@@ -1,112 +0,0 @@
-'use strict'
-
-const { InvalidArgumentError, RequestAbortedError } = require('../core/errors')
-const DecoratorHandler = require('../handler/decorator-handler')
-
-class DumpHandler extends DecoratorHandler {
- #maxSize = 1024 * 1024
- #dumped = false
- #size = 0
- #controller = null
- aborted = false
- reason = false
-
- constructor ({ maxSize, signal }, handler) {
- if (maxSize != null && (!Number.isFinite(maxSize) || maxSize < 1)) {
- throw new InvalidArgumentError('maxSize must be a number greater than 0')
- }
-
- super(handler)
-
- this.#maxSize = maxSize ?? this.#maxSize
- // this.#handler = handler
- }
-
- #abort (reason) {
- this.aborted = true
- this.reason = reason
- }
-
- onRequestStart (controller, context) {
- controller.abort = this.#abort.bind(this)
- this.#controller = controller
-
- return super.onRequestStart(controller, context)
- }
-
- onResponseStart (controller, statusCode, headers, statusMessage) {
- const contentLength = headers['content-length']
-
- if (contentLength != null && contentLength > this.#maxSize) {
- throw new RequestAbortedError(
- `Response size (${contentLength}) larger than maxSize (${
- this.#maxSize
- })`
- )
- }
-
- if (this.aborted === true) {
- return true
- }
-
- return super.onResponseStart(controller, statusCode, headers, statusMessage)
- }
-
- onResponseError (controller, err) {
- if (this.#dumped) {
- return
- }
-
- // On network errors before connect, controller will be null
- err = this.#controller?.reason ?? err
-
- super.onResponseError(controller, err)
- }
-
- onResponseData (controller, chunk) {
- this.#size = this.#size + chunk.length
-
- if (this.#size >= this.#maxSize) {
- this.#dumped = true
-
- if (this.aborted === true) {
- super.onResponseError(controller, this.reason)
- } else {
- super.onResponseEnd(controller, {})
- }
- }
-
- return true
- }
-
- onResponseEnd (controller, trailers) {
- if (this.#dumped) {
- return
- }
-
- if (this.#controller.aborted === true) {
- super.onResponseError(controller, this.reason)
- return
- }
-
- super.onResponseEnd(controller, trailers)
- }
-}
-
-function createDumpInterceptor (
- { maxSize: defaultMaxSize } = {
- maxSize: 1024 * 1024
- }
-) {
- return dispatch => {
- return function Intercept (opts, handler) {
- const { dumpMaxSize = defaultMaxSize } = opts
-
- const dumpHandler = new DumpHandler({ maxSize: dumpMaxSize, signal: opts.signal }, handler)
-
- return dispatch(opts, dumpHandler)
- }
- }
-}
-
-module.exports = createDumpInterceptor