acrylblends 0.4.0 → 0.5.0
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/LICENSE +73 -0
- package/dist/index.js +56 -2
- package/dist/index.js.map +1 -1
- package/docs/framework/LICENSE +23 -0
- package/docs/framework/README.md +63 -0
- package/docs/framework/UPSTREAM.md +3 -0
- package/docs/framework/agents/index.md +24 -0
- package/docs/framework/api/acryl.md +259 -0
- package/docs/framework/api/context.md +527 -0
- package/docs/framework/api/exception.md +80 -0
- package/docs/framework/api/index.md +12 -0
- package/docs/framework/api/presets.md +65 -0
- package/docs/framework/api/request.md +396 -0
- package/docs/framework/api/routing.md +303 -0
- package/docs/framework/api/summary.md +140 -0
- package/docs/framework/concepts/benchmarks.md +26 -0
- package/docs/framework/concepts/developer-experience.md +5 -0
- package/docs/framework/concepts/middleware.md +21 -0
- package/docs/framework/concepts/motivation.md +14 -0
- package/docs/framework/concepts/routers.md +63 -0
- package/docs/framework/concepts/stacks.md +235 -0
- package/docs/framework/concepts/web-standard.md +37 -0
- package/docs/framework/cordis/acryl-in-a-cordis-app.md +146 -0
- package/docs/framework/cordis/concepts.md +105 -0
- package/docs/framework/cordis/middleware.md +8 -0
- package/docs/framework/cordis/migration-from-0-3.md +111 -0
- package/docs/framework/cordis/migration-from-0-4.md +14 -0
- package/docs/framework/cordis/migration-from-dsh-webserver.md +103 -0
- package/docs/framework/cordis/mounting.md +85 -0
- package/docs/framework/cordis/node-server.md +75 -0
- package/docs/framework/cordis/plugin-lifecycle.md +111 -0
- package/docs/framework/cordis/surfaces.md +71 -0
- package/docs/framework/cordis/transport-and-cancellation.md +57 -0
- package/docs/framework/cordis/validation.md +135 -0
- package/docs/framework/getting-started/basic.md +196 -0
- package/docs/framework/getting-started/bun.md +221 -0
- package/docs/framework/getting-started/nodejs.md +344 -0
- package/docs/framework/getting-started/other-runtimes.md +23 -0
- package/docs/framework/guides/best-practices.md +231 -0
- package/docs/framework/guides/create-acrylblends.md +79 -0
- package/docs/framework/guides/examples.md +3 -0
- package/docs/framework/guides/faq.md +19 -0
- package/docs/framework/guides/helpers.md +33 -0
- package/docs/framework/guides/jsx-dom.md +299 -0
- package/docs/framework/guides/jsx.md +440 -0
- package/docs/framework/guides/middleware.md +253 -0
- package/docs/framework/guides/rpc.md +886 -0
- package/docs/framework/guides/testing.md +133 -0
- package/docs/framework/guides/validation.md +383 -0
- package/docs/framework/helpers/accepts.md +60 -0
- package/docs/framework/helpers/adapter.md +87 -0
- package/docs/framework/helpers/conninfo.md +112 -0
- package/docs/framework/helpers/cookie.md +232 -0
- package/docs/framework/helpers/css.md +285 -0
- package/docs/framework/helpers/dev.md +67 -0
- package/docs/framework/helpers/factory.md +180 -0
- package/docs/framework/helpers/html.md +123 -0
- package/docs/framework/helpers/jwt.md +184 -0
- package/docs/framework/helpers/proxy.md +118 -0
- package/docs/framework/helpers/route.md +143 -0
- package/docs/framework/helpers/ssg.md +393 -0
- package/docs/framework/helpers/streaming.md +119 -0
- package/docs/framework/helpers/testing.md +101 -0
- package/docs/framework/helpers/websocket.md +215 -0
- package/docs/framework/middleware/builtin/basic-auth.md +165 -0
- package/docs/framework/middleware/builtin/bearer-auth.md +138 -0
- package/docs/framework/middleware/builtin/body-limit.md +71 -0
- package/docs/framework/middleware/builtin/cache.md +122 -0
- package/docs/framework/middleware/builtin/combine.md +94 -0
- package/docs/framework/middleware/builtin/compress.md +59 -0
- package/docs/framework/middleware/builtin/context-storage.md +78 -0
- package/docs/framework/middleware/builtin/cors.md +135 -0
- package/docs/framework/middleware/builtin/csrf.md +105 -0
- package/docs/framework/middleware/builtin/etag.md +54 -0
- package/docs/framework/middleware/builtin/ip-restriction.md +69 -0
- package/docs/framework/middleware/builtin/jsx-renderer.md +286 -0
- package/docs/framework/middleware/builtin/jwk.md +192 -0
- package/docs/framework/middleware/builtin/jwt.md +145 -0
- package/docs/framework/middleware/builtin/language.md +232 -0
- package/docs/framework/middleware/builtin/logger.md +74 -0
- package/docs/framework/middleware/builtin/loopback-only.md +31 -0
- package/docs/framework/middleware/builtin/method-not-allowed.md +48 -0
- package/docs/framework/middleware/builtin/method-override.md +80 -0
- package/docs/framework/middleware/builtin/mount.md +106 -0
- package/docs/framework/middleware/builtin/pretty-json.md +53 -0
- package/docs/framework/middleware/builtin/request-id.md +94 -0
- package/docs/framework/middleware/builtin/secure-headers.md +247 -0
- package/docs/framework/middleware/builtin/timeout.md +98 -0
- package/docs/framework/middleware/builtin/timing.md +101 -0
- package/docs/framework/middleware/builtin/trailing-slash.md +74 -0
- package/docs/framework/middleware/third-party.md +4 -0
- package/docs/framework/upstream.json +9 -0
- package/lib/accepts-XBuZPVRI.js +52 -0
- package/lib/accepts.d.ts +33 -0
- package/lib/accepts.js +2 -0
- package/lib/acryl-base.d.ts +2 -0
- package/lib/acryl-base.js +332 -0
- package/lib/adapter.d.ts +12 -0
- package/lib/adapter.js +37 -0
- package/lib/app-BM0rTCp7.js +26 -0
- package/lib/app-CmAYW1Al.d.ts +21 -0
- package/lib/basic-auth.d.ts +72 -0
- package/lib/basic-auth.js +95 -0
- package/lib/bearer-auth.d.ts +89 -0
- package/lib/bearer-auth.js +94 -0
- package/lib/body-limit.d.ts +42 -0
- package/lib/body-limit.js +66 -0
- package/lib/client-BHTr318g.js +266 -0
- package/lib/client.d.ts +3 -0
- package/lib/client.js +2 -0
- package/lib/combine.d.ts +85 -0
- package/lib/combine.js +137 -0
- package/lib/compose-BuW2B6PZ.js +50 -0
- package/lib/compress.d.ts +38 -0
- package/lib/compress.js +79 -0
- package/lib/connection-C7xgP1hP.js +24 -0
- package/lib/conninfo.d.ts +25 -0
- package/lib/conninfo.js +2 -0
- package/lib/constants-Dy7ZvN1H.js +4 -0
- package/lib/context-Bm7rI-oK.d.ts +1234 -0
- package/lib/context-DDO0cfuP.js +365 -0
- package/lib/context-storage.d.ts +38 -0
- package/lib/context-storage.js +52 -0
- package/lib/cookie-ClMaKDQf.d.ts +40 -0
- package/lib/cookie.d.ts +24 -0
- package/lib/cookie.js +82 -0
- package/lib/cors.d.ts +52 -0
- package/lib/cors.js +106 -0
- package/lib/csrf.d.ts +75 -0
- package/lib/csrf.js +101 -0
- package/lib/etag.d.ts +40 -0
- package/lib/etag.js +135 -0
- package/lib/factory.d.ts +35 -0
- package/lib/factory.js +30 -0
- package/lib/headers-tu2YYN8T.d.ts +11 -0
- package/lib/html.d.ts +6 -0
- package/lib/html.js +31 -0
- package/lib/http-exception.d.ts +57 -0
- package/lib/http-exception.js +54 -0
- package/lib/http-status-DaAwGAFL.d.ts +35 -0
- package/lib/index-B-3F4wt2.d.ts +12 -0
- package/lib/index-UTBmM3GX.d.ts +68 -0
- package/lib/index-oOClm_Xk.d.ts +45 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +28 -0
- package/lib/ip-restriction.d.ts +68 -0
- package/lib/ip-restriction.js +166 -0
- package/lib/jwk.d.ts +52 -0
- package/lib/jwk.js +117 -0
- package/lib/jwt-BGJBw5AF.js +403 -0
- package/lib/jwt-Dg493Tai.d.ts +51 -0
- package/lib/jwt.d.ts +72 -0
- package/lib/jwt.js +115 -0
- package/lib/language.d.ts +88 -0
- package/lib/language.js +198 -0
- package/lib/logger.d.ts +22 -0
- package/lib/logger.js +54 -0
- package/lib/loopback-only.d.ts +45 -0
- package/lib/loopback-only.js +90 -0
- package/lib/method-not-allowed.d.ts +47 -0
- package/lib/method-not-allowed.js +82 -0
- package/lib/method-override.d.ts +46 -0
- package/lib/method-override.js +103 -0
- package/lib/mime-BQOYHl-l.d.ts +72 -0
- package/lib/node-server/conninfo.d.ts +11 -0
- package/lib/node-server/conninfo.js +19 -0
- package/lib/node-server/serve-static.d.ts +19 -0
- package/lib/node-server/serve-static.js +2 -0
- package/lib/node-server.d.ts +103 -0
- package/lib/node-server.js +1325 -0
- package/lib/powered-by.d.ts +28 -0
- package/lib/powered-by.js +24 -0
- package/lib/pretty-json.d.ts +40 -0
- package/lib/pretty-json.js +39 -0
- package/lib/reg-exp-router-DC1R3qoY.js +363 -0
- package/lib/request-id.d.ts +45 -0
- package/lib/request-id.js +34 -0
- package/lib/request.d.ts +2 -0
- package/lib/request.js +323 -0
- package/lib/route.d.ts +78 -0
- package/lib/route.js +126 -0
- package/lib/router/linear-router.d.ts +11 -0
- package/lib/router/linear-router.js +96 -0
- package/lib/router/pattern-router.d.ts +11 -0
- package/lib/router/pattern-router.js +41 -0
- package/lib/router/reg-exp-router.d.ts +35 -0
- package/lib/router/reg-exp-router.js +2 -0
- package/lib/router/smart-router.d.ts +15 -0
- package/lib/router/smart-router.js +2 -0
- package/lib/router/trie-router.d.ts +11 -0
- package/lib/router/trie-router.js +2 -0
- package/lib/router-CvUxUTOq.d.ts +99 -0
- package/lib/router.d.ts +2 -0
- package/lib/router.js +35 -0
- package/lib/schema-validator.d.ts +28 -0
- package/lib/schema-validator.js +22 -0
- package/lib/secure-headers.d.ts +125 -0
- package/lib/secure-headers.js +163 -0
- package/lib/serve-static-Dw_m6KxR.js +213 -0
- package/lib/serve-static.d.ts +31 -0
- package/lib/serve-static.js +77 -0
- package/lib/smart-router-C5CZ5XSM.js +49 -0
- package/lib/stream-CPdqZ0Fp.d.ts +34 -0
- package/lib/streaming-DHST3Scg.js +96 -0
- package/lib/streaming.d.ts +23 -0
- package/lib/streaming.js +2 -0
- package/lib/testing.d.ts +10 -0
- package/lib/testing.js +17 -0
- package/lib/timeout.d.ts +30 -0
- package/lib/timeout.js +42 -0
- package/lib/timing.d.ts +130 -0
- package/lib/timing.js +183 -0
- package/lib/trailing-slash.d.ts +91 -0
- package/lib/trailing-slash.js +85 -0
- package/lib/trie-router-CfFbapzL.js +146 -0
- package/lib/types-CDO6I3B0.d.ts +40 -0
- package/lib/types-CHesD1KG.d.ts +195 -0
- package/lib/types-CwrQjlaM.d.ts +105 -0
- package/lib/types-DR95J00T.d.ts +29 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.js +4 -0
- package/lib/utils/accept.d.ts +9 -0
- package/lib/utils/accept.js +193 -0
- package/lib/utils/basic-auth.d.ts +8 -0
- package/lib/utils/basic-auth.js +20 -0
- package/lib/utils/body.d.ts +2 -0
- package/lib/utils/body.js +94 -0
- package/lib/utils/buffer.d.ts +19 -0
- package/lib/utils/buffer.js +51 -0
- package/lib/utils/color.d.ts +24 -0
- package/lib/utils/color.js +37 -0
- package/lib/utils/compress.d.ts +11 -0
- package/lib/utils/compress.js +11 -0
- package/lib/utils/concurrent.d.ts +17 -0
- package/lib/utils/concurrent.js +30 -0
- package/lib/utils/constants.d.ts +7 -0
- package/lib/utils/constants.js +7 -0
- package/lib/utils/cookie.d.ts +2 -0
- package/lib/utils/cookie.js +125 -0
- package/lib/utils/crypto.d.ts +14 -0
- package/lib/utils/crypto.js +34 -0
- package/lib/utils/encode.d.ts +11 -0
- package/lib/utils/encode.js +33 -0
- package/lib/utils/filepath.d.ts +14 -0
- package/lib/utils/filepath.js +25 -0
- package/lib/utils/handler.d.ts +9 -0
- package/lib/utils/handler.js +12 -0
- package/lib/utils/headers.d.ts +2 -0
- package/lib/utils/headers.js +1 -0
- package/lib/utils/html.d.ts +46 -0
- package/lib/utils/html.js +103 -0
- package/lib/utils/http-status.d.ts +2 -0
- package/lib/utils/http-status.js +1 -0
- package/lib/utils/ipaddr.d.ts +56 -0
- package/lib/utils/ipaddr.js +238 -0
- package/lib/utils/jwt.d.ts +24 -0
- package/lib/utils/jwt.js +2 -0
- package/lib/utils/mime.d.ts +2 -0
- package/lib/utils/mime.js +77 -0
- package/lib/utils/stream.d.ts +2 -0
- package/lib/utils/stream.js +88 -0
- package/lib/utils/types.d.ts +2 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/url.d.ts +46 -0
- package/lib/utils/url.js +197 -0
- package/lib/utils-dw8lxqjL.js +4 -0
- package/lib/validator-D84mq-dO.js +65 -0
- package/lib/validator.d.ts +42 -0
- package/lib/validator.js +2 -0
- package/lib/ws.d.ts +2 -0
- package/lib/ws.js +53 -0
- package/package.json +315 -15
- package/plugins/acryl-inspect/src/report.ts +15 -10
- package/plugins/acryl-inspect/src/service.ts +2 -2
- package/plugins/acryl-inspect/tests/report.spec.ts +9 -3
- package/plugins/acryl-inspect/tests/service.spec.ts +3 -3
- package/plugins/acryl-inspect/upstream.json +2 -2
- package/plugins/acryl-node-server/tests/adapter/app.ts +2 -2
- package/plugins/acryl-node-server/tests/adapter/assets/static/acryl.html +1 -1
- package/plugins/acryl-node-server/tests/adapter/assets/static/index.html +1 -1
- package/plugins/acryl-node-server/tests/adapter/conninfo.test.ts +2 -2
- package/plugins/acryl-node-server/tests/adapter/content-length.test.ts +4 -4
- package/plugins/acryl-node-server/tests/adapter/early-hints.test.ts +5 -5
- package/plugins/acryl-node-server/tests/adapter/request-client-disconnect.test.ts +2 -2
- package/plugins/acryl-node-server/tests/adapter/serve-static.test.ts +20 -20
- package/plugins/acryl-node-server/tests/adapter/server-socket.test.ts +2 -2
- package/plugins/acryl-node-server/tests/adapter/server.test.ts +50 -50
- package/plugins/acryl-node-server/tests/adapter/utils/response.test.ts +4 -4
- package/plugins/acryl-node-server/tests/adapter/websocket.test.ts +9 -9
- package/plugins/acryl-node-server/tests/server.spec.ts +6 -6
- package/plugins/acryl-node-server/upstream.json +2 -2
- package/plugins/acryl-router/src/client.ts +1 -1
- package/plugins/acryl-router/src/connection.ts +2 -2
- package/plugins/acryl-router/src/core/app-base.ts +29 -29
- package/plugins/acryl-router/src/core/app.test.ts +175 -175
- package/plugins/acryl-router/src/core/app.ts +8 -8
- package/plugins/acryl-router/src/core/client/client.test.ts +76 -76
- package/plugins/acryl-router/src/core/client/client.ts +2 -2
- package/plugins/acryl-router/src/core/client/fetch-result-please.ts +1 -1
- package/plugins/acryl-router/src/core/client/index.ts +1 -1
- package/plugins/acryl-router/src/core/client/types.test.ts +6 -6
- package/plugins/acryl-router/src/core/client/types.ts +16 -16
- package/plugins/acryl-router/src/core/client/utils.test.ts +2 -2
- package/plugins/acryl-router/src/core/context.test.ts +4 -4
- package/plugins/acryl-router/src/core/context.ts +6 -6
- package/plugins/acryl-router/src/core/helper/accepts/accepts.test.ts +3 -3
- package/plugins/acryl-router/src/core/helper/accepts/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/adapter/index.test.ts +6 -6
- package/plugins/acryl-router/src/core/helper/adapter/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/conninfo/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/cookie/index.test.ts +8 -8
- package/plugins/acryl-router/src/core/helper/cookie/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/factory/index.test.ts +9 -9
- package/plugins/acryl-router/src/core/helper/factory/index.ts +10 -10
- package/plugins/acryl-router/src/core/helper/html/index.test.ts +4 -4
- package/plugins/acryl-router/src/core/helper/html/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/route/index.test.ts +7 -7
- package/plugins/acryl-router/src/core/helper/route/index.ts +8 -8
- package/plugins/acryl-router/src/core/helper/streaming/index.ts +1 -1
- package/plugins/acryl-router/src/core/helper/testing/index.test.ts +6 -6
- package/plugins/acryl-router/src/core/helper/testing/index.ts +4 -4
- package/plugins/acryl-router/src/core/helper/websocket/index.ts +2 -1
- package/plugins/acryl-router/src/core/http-exception.ts +1 -1
- package/plugins/acryl-router/src/core/index.ts +9 -9
- package/plugins/acryl-router/src/core/middleware/basic-auth/index.test.ts +6 -6
- package/plugins/acryl-router/src/core/middleware/basic-auth/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/bearer-auth/index.test.ts +5 -5
- package/plugins/acryl-router/src/core/middleware/bearer-auth/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/body-limit/index.test.ts +6 -6
- package/plugins/acryl-router/src/core/middleware/body-limit/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/combine/index.test.ts +9 -9
- package/plugins/acryl-router/src/core/middleware/combine/index.ts +7 -7
- package/plugins/acryl-router/src/core/middleware/compress/index.test.ts +9 -9
- package/plugins/acryl-router/src/core/middleware/compress/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/context-storage/index.test.ts +5 -5
- package/plugins/acryl-router/src/core/middleware/context-storage/index.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/cors/index.test.ts +7 -7
- package/plugins/acryl-router/src/core/middleware/cors/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/csrf/index.test.ts +10 -10
- package/plugins/acryl-router/src/core/middleware/csrf/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/etag/index.test.ts +42 -42
- package/plugins/acryl-router/src/core/middleware/etag/index.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/ip-restriction/index.test.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/ip-restriction/index.ts +6 -6
- package/plugins/acryl-router/src/core/middleware/jwk/index.test.ts +16 -16
- package/plugins/acryl-router/src/core/middleware/jwk/jwk.ts +7 -6
- package/plugins/acryl-router/src/core/middleware/jwt/index.test.ts +16 -16
- package/plugins/acryl-router/src/core/middleware/jwt/jwt.ts +4 -3
- package/plugins/acryl-router/src/core/middleware/language/index.test.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/language/language.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/logger/index.test.ts +5 -5
- package/plugins/acryl-router/src/core/middleware/logger/index.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.test.ts +24 -24
- package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.ts +8 -8
- package/plugins/acryl-router/src/core/middleware/method-override/index.test.ts +5 -5
- package/plugins/acryl-router/src/core/middleware/method-override/index.ts +6 -6
- package/plugins/acryl-router/src/core/middleware/powered-by/index.test.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/powered-by/index.ts +6 -6
- package/plugins/acryl-router/src/core/middleware/pretty-json/index.test.ts +30 -30
- package/plugins/acryl-router/src/core/middleware/pretty-json/index.ts +4 -4
- package/plugins/acryl-router/src/core/middleware/request-id/index.test.ts +15 -15
- package/plugins/acryl-router/src/core/middleware/request-id/request-id.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/secure-headers/index.test.ts +35 -35
- package/plugins/acryl-router/src/core/middleware/secure-headers/secure-headers.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/serve-static/index.test.ts +23 -23
- package/plugins/acryl-router/src/core/middleware/serve-static/index.ts +1 -1
- package/plugins/acryl-router/src/core/middleware/timeout/index.test.ts +2 -2
- package/plugins/acryl-router/src/core/middleware/timeout/index.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/timing/index.test.ts +14 -14
- package/plugins/acryl-router/src/core/middleware/timing/timing.ts +3 -3
- package/plugins/acryl-router/src/core/middleware/trailing-slash/index.test.ts +7 -7
- package/plugins/acryl-router/src/core/middleware/trailing-slash/index.ts +7 -7
- package/plugins/acryl-router/src/core/request.test.ts +42 -42
- package/plugins/acryl-router/src/core/request.ts +6 -6
- package/plugins/acryl-router/src/core/router/linear-router/index.ts +1 -1
- package/plugins/acryl-router/src/core/router/pattern-router/index.ts +1 -1
- package/plugins/acryl-router/src/core/router/reg-exp-router/index.ts +1 -1
- package/plugins/acryl-router/src/core/router/smart-router/index.ts +1 -1
- package/plugins/acryl-router/src/core/router/trie-router/index.ts +1 -1
- package/plugins/acryl-router/src/core/types.test.ts +115 -115
- package/plugins/acryl-router/src/core/types.ts +72 -72
- package/plugins/acryl-router/src/core/utils/body.ts +8 -8
- package/plugins/acryl-router/src/core/utils/html.ts +1 -1
- package/plugins/acryl-router/src/core/utils/jwt/jws.ts +3 -3
- package/plugins/acryl-router/src/core/utils/jwt/jwt.test.ts +2 -2
- package/plugins/acryl-router/src/core/utils/jwt/jwt.ts +3 -3
- package/plugins/acryl-router/src/core/utils/jwt/types.ts +1 -1
- package/plugins/acryl-router/src/core/utils/types.ts +42 -0
- package/plugins/acryl-router/src/core/utils/url.test.ts +2 -2
- package/plugins/acryl-router/src/core/validator/index.ts +1 -1
- package/plugins/acryl-router/src/core/validator/validator.test.ts +28 -28
- package/plugins/acryl-router/src/deprecated.ts +15 -0
- package/plugins/acryl-router/src/index.ts +3 -2
- package/plugins/acryl-router/src/middleware/index.ts +1 -1
- package/plugins/acryl-router/src/middleware/loopback-only.ts +34 -1
- package/plugins/acryl-router/src/service.ts +19 -13
- package/plugins/acryl-router/tests/docs-examples.spec.ts +11 -11
- package/plugins/acryl-router/tests/live-install.spec.ts +2 -2
- package/plugins/acryl-router/tests/loader.spec.ts +3 -3
- package/plugins/acryl-router/tests/loopback-only.spec.ts +80 -0
- package/plugins/acryl-router/tests/no-dom/consumer.ts +11 -0
- package/plugins/acryl-router/tests/no-dom/tsconfig.json +13 -0
- package/plugins/acryl-router/tests/service.spec.ts +39 -22
- package/plugins/acryl-router/upstream.json +3 -3
- package/plugins/acryl-router-http/tests/adapter.spec.ts +3 -3
- package/plugins/acryl-router-http/tests/surfaces.spec.ts +2 -2
- package/plugins/acryl-router-http/upstream.json +2 -2
- package/plugins/acryl-state/src/service.ts +2 -2
- package/plugins/acryl-state/upstream.json +2 -2
- package/plugins/builder/script.ts +3 -3
- package/plugins/extensions/index.ts +4 -3
- package/plugins/extensions/resolve.ts +70 -10
- package/plugins/openai/prompt.ts +7 -7
- package/shared/AGENTS.core.md +61 -0
- package/templates/agent/AGENTS.md +6 -0
- package/templates/agent/README.md +2 -2
- package/templates/agent/blend.yaml +1 -1
- package/templates/agent/src/routes.ts +2 -2
- package/templates/agent/test/model.test.ts +2 -2
- package/templates/agent/tsconfig.json +40 -0
- package/templates/blank/AGENTS.md +5 -0
- package/templates/blank/README.md +1 -1
- package/templates/blank/src/routes.ts +2 -2
- package/templates/todo/AGENTS.md +5 -0
- package/templates/todo/src/todo.ts +6 -4
- package/templates/todo/upstream.json +2 -2
|
@@ -0,0 +1,1234 @@
|
|
|
1
|
+
import { c as Result, l as Router } from "./router-CvUxUTOq.js";
|
|
2
|
+
import { i as ResponseHeader, n as CustomHeader, r as RequestHeader } from "./headers-tu2YYN8T.js";
|
|
3
|
+
import { c as StatusCode, n as ContentfulStatusCode, o as RedirectStatusCode } from "./http-status-DaAwGAFL.js";
|
|
4
|
+
import { S as Simplify, T as UnionToIntersection, b as RemoveBlankRecord, c as IfAnyThenEmptyObject, d as IsAny, g as JSONValue, m as JSONParsed, u as InvalidJSONValue } from "./types-CwrQjlaM.js";
|
|
5
|
+
import { t as BaseMime } from "./mime-BQOYHl-l.js";
|
|
6
|
+
|
|
7
|
+
//#region ../../plugins/acryl-router/src/core/request/constants.d.ts
|
|
8
|
+
declare const GET_MATCH_RESULT: unique symbol;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ../../plugins/acryl-router/src/core/app-base.d.ts
|
|
11
|
+
type GetPath<E extends Env> = (request: Request, options?: {
|
|
12
|
+
env?: E['Bindings'];
|
|
13
|
+
}) => string;
|
|
14
|
+
type AcrylOptions<E extends Env> = {
|
|
15
|
+
/**
|
|
16
|
+
* `router` option specifies which router to use.
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const app = new Acryl({ router: new RegExpRouter() })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
router?: Router<[H, RouterRoute]>;
|
|
25
|
+
} & ({
|
|
26
|
+
/**
|
|
27
|
+
* `strict` option specifies whether to distinguish whether the last path is a directory or not.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
strict?: true;
|
|
33
|
+
/**
|
|
34
|
+
* `getPath` can handle the host header value.
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const app = new Acryl({
|
|
40
|
+
* getPath: (req) =>
|
|
41
|
+
* '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'),
|
|
42
|
+
* })
|
|
43
|
+
*
|
|
44
|
+
* app.get('/www1.example.com/hello', () => c.text('hello www1'))
|
|
45
|
+
*
|
|
46
|
+
* // A following request will match the route:
|
|
47
|
+
* // new Request('http://www1.example.com/hello', {
|
|
48
|
+
* // headers: { host: 'www1.example.com' },
|
|
49
|
+
* // })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
getPath?: GetPath<E>;
|
|
53
|
+
} | {
|
|
54
|
+
/**
|
|
55
|
+
* `strict` option specifies whether to distinguish whether the last path is a directory or not.
|
|
56
|
+
* When `strict` is `false`, `getPath` is not used.
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
strict: false;
|
|
62
|
+
getPath?: never;
|
|
63
|
+
});
|
|
64
|
+
type MountOptionHandler = (c: Context) => unknown;
|
|
65
|
+
type MountReplaceRequest = (originalRequest: Request) => Request;
|
|
66
|
+
type MountOptions = MountOptionHandler | {
|
|
67
|
+
optionHandler?: MountOptionHandler;
|
|
68
|
+
replaceRequest?: MountReplaceRequest | false;
|
|
69
|
+
};
|
|
70
|
+
declare class Acryl<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/', CurrentPath extends string = BasePath> {
|
|
71
|
+
#private;
|
|
72
|
+
get: HandlerInterface<E, 'get', S, BasePath, CurrentPath>;
|
|
73
|
+
post: HandlerInterface<E, 'post', S, BasePath, CurrentPath>;
|
|
74
|
+
put: HandlerInterface<E, 'put', S, BasePath, CurrentPath>;
|
|
75
|
+
delete: HandlerInterface<E, 'delete', S, BasePath, CurrentPath>;
|
|
76
|
+
options: HandlerInterface<E, 'options', S, BasePath, CurrentPath>;
|
|
77
|
+
patch: HandlerInterface<E, 'patch', S, BasePath, CurrentPath>;
|
|
78
|
+
query: HandlerInterface<E, 'query', S, BasePath, CurrentPath>;
|
|
79
|
+
all: HandlerInterface<E, 'all', S, BasePath, CurrentPath>;
|
|
80
|
+
on: OnHandlerInterface<E, S, BasePath>;
|
|
81
|
+
use: MiddlewareHandlerInterface<E, S, BasePath>;
|
|
82
|
+
router: Router<[H, RouterRoute]>;
|
|
83
|
+
readonly getPath: GetPath<E>;
|
|
84
|
+
private _basePath;
|
|
85
|
+
routes: RouterRoute[];
|
|
86
|
+
constructor(options?: AcrylOptions<E>);
|
|
87
|
+
private errorHandler;
|
|
88
|
+
/**
|
|
89
|
+
* `.route()` allows grouping other Acryl instance in routes.
|
|
90
|
+
*
|
|
91
|
+
*
|
|
92
|
+
* @param {string} path - base Path
|
|
93
|
+
* @param {Acryl} app - other Acryl instance
|
|
94
|
+
* @returns {Acryl} routed Acryl instance
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const app = new Acryl()
|
|
99
|
+
* const app2 = new Acryl()
|
|
100
|
+
*
|
|
101
|
+
* app2.get("/user", (c) => c.text("user"))
|
|
102
|
+
* app.route("/api", app2) // GET /api/user
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string, SubCurrentPath extends string>(path: SubPath, app: Acryl<SubEnv, SubSchema, SubBasePath, SubCurrentPath>): Acryl<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> | S, BasePath, CurrentPath>;
|
|
106
|
+
/**
|
|
107
|
+
* `.basePath()` allows base paths to be specified.
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* @param {string} path - base Path
|
|
111
|
+
* @returns {Acryl} changed Acryl instance
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const api = new Acryl().basePath('/api')
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
basePath<SubPath extends string>(path: SubPath): Acryl<E, S, MergePath<BasePath, SubPath>, MergePath<BasePath, SubPath>>;
|
|
119
|
+
/**
|
|
120
|
+
* `.onError()` handles an error and returns a customized Response.
|
|
121
|
+
*
|
|
122
|
+
*
|
|
123
|
+
* @param {ErrorHandler} handler - request Handler for error
|
|
124
|
+
* @returns {Acryl} changed Acryl instance
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* app.onError((err, c) => {
|
|
129
|
+
* console.error(`${err}`)
|
|
130
|
+
* return c.text('Custom Error Message', 500)
|
|
131
|
+
* })
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
onError: (handler: ErrorHandler<E>) => Acryl<E, S, BasePath, CurrentPath>;
|
|
135
|
+
/**
|
|
136
|
+
* `.notFound()` allows you to customize a Not Found Response.
|
|
137
|
+
*
|
|
138
|
+
*
|
|
139
|
+
* @param {NotFoundHandler} handler - request handler for not-found
|
|
140
|
+
* @returns {Acryl} changed Acryl instance
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* app.notFound((c) => {
|
|
145
|
+
* return c.text('Custom 404 Message', 404)
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
notFound: (handler: NotFoundHandler<E>) => Acryl<E, S, BasePath, CurrentPath>;
|
|
150
|
+
/**
|
|
151
|
+
* `.mount()` allows you to mount applications built with other frameworks into your Acryl application.
|
|
152
|
+
*
|
|
153
|
+
* @deprecated Use `mount()` from `acryl-router/mount` instead. `.mount()` will be removed in v5.
|
|
154
|
+
*
|
|
155
|
+
*
|
|
156
|
+
* @param {string} path - base Path
|
|
157
|
+
* @param {Function} applicationHandler - other Request Handler
|
|
158
|
+
* @param {MountOptions} [options] - options of `.mount()`
|
|
159
|
+
* @returns {Acryl} mounted Acryl instance
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* import { Router as IttyRouter } from 'itty-router'
|
|
164
|
+
* import { Acryl } from 'acrylblends'
|
|
165
|
+
* // Create itty-router application
|
|
166
|
+
* const ittyRouter = IttyRouter()
|
|
167
|
+
* // GET /itty-router/hello
|
|
168
|
+
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
169
|
+
*
|
|
170
|
+
* const app = new Acryl()
|
|
171
|
+
* app.mount('/itty-router', ittyRouter.handle)
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const app = new Acryl()
|
|
177
|
+
* // Send the request to another application without modification.
|
|
178
|
+
* app.mount('/app', anotherApp, {
|
|
179
|
+
* replaceRequest: (req) => req,
|
|
180
|
+
* })
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Acryl<E, S, BasePath, CurrentPath>;
|
|
184
|
+
/**
|
|
185
|
+
* `.fetch()` will be entry point of your app.
|
|
186
|
+
*
|
|
187
|
+
*
|
|
188
|
+
* @param {Request} request - request Object of request
|
|
189
|
+
* @param {Env} env - env Object
|
|
190
|
+
* @param {ExecutionContext} executionCtx - context of execution
|
|
191
|
+
* @returns {Response | Promise<Response>} response of request
|
|
192
|
+
*
|
|
193
|
+
*/
|
|
194
|
+
fetch: (request: Request, env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
|
|
195
|
+
/**
|
|
196
|
+
* `.request()` is a useful method for testing.
|
|
197
|
+
* You can pass a URL or pathname to send a GET request.
|
|
198
|
+
* app will return a Response object.
|
|
199
|
+
* ```ts
|
|
200
|
+
* test('GET /hello is ok', async () => {
|
|
201
|
+
* const res = await app.request('/hello')
|
|
202
|
+
* expect(res.status).toBe(200)
|
|
203
|
+
* })
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
request: (input: Request | string | URL, requestInit?: RequestInit, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
|
|
207
|
+
/**
|
|
208
|
+
* `.fire()` automatically adds a global fetch event listener.
|
|
209
|
+
* This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.
|
|
210
|
+
* @deprecated
|
|
211
|
+
* ACRYL ships no service-worker adapter: mount the app with `ctx.router.route(path, app)` and serve it through an ACRYL adapter instead.
|
|
212
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
|
|
213
|
+
* @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
|
|
214
|
+
*/
|
|
215
|
+
fire: () => void;
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region ../../plugins/acryl-router/src/core/types.d.ts
|
|
219
|
+
type Bindings = object;
|
|
220
|
+
type Variables = object;
|
|
221
|
+
type BlankEnv = {};
|
|
222
|
+
type Env = {
|
|
223
|
+
Bindings?: Bindings;
|
|
224
|
+
Variables?: Variables;
|
|
225
|
+
};
|
|
226
|
+
type Next = () => Promise<void>;
|
|
227
|
+
type ExtractInput<I extends Input | Input['in']> = I extends Input ? unknown extends I['in'] ? {} : I['in'] : I;
|
|
228
|
+
type Input = {
|
|
229
|
+
in?: {};
|
|
230
|
+
out?: {};
|
|
231
|
+
outputFormat?: ResponseFormat;
|
|
232
|
+
};
|
|
233
|
+
type BlankSchema = {};
|
|
234
|
+
type BlankInput = {};
|
|
235
|
+
interface RouterRoute {
|
|
236
|
+
basePath: string;
|
|
237
|
+
path: string;
|
|
238
|
+
method: string;
|
|
239
|
+
handler: H;
|
|
240
|
+
}
|
|
241
|
+
type HandlerResponse<O> = Response | TypedResponse<O> | Promise<Response | TypedResponse<O>> | Promise<void>;
|
|
242
|
+
type Handler<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = (c: Context<E, P, I>, next: Next) => R;
|
|
243
|
+
type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}, R extends HandlerResponse<any> = Response> = (c: Context<E, P, I>, next: Next) => Promise<R | void>;
|
|
244
|
+
type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I, R>;
|
|
245
|
+
/**
|
|
246
|
+
* You can extend this interface to define a custom `c.notFound()` Response type.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* declare module 'acrylblends' {
|
|
250
|
+
* interface NotFoundResponse extends Response, TypedResponse<string, 404, 'text'> {}
|
|
251
|
+
* }
|
|
252
|
+
*/
|
|
253
|
+
interface NotFoundResponse {}
|
|
254
|
+
type NotFoundHandler<E extends Env = any> = (c: Context<E>) => NotFoundResponse extends Response ? NotFoundResponse | Promise<NotFoundResponse> : Response | Promise<Response>;
|
|
255
|
+
interface HTTPResponseError extends Error {
|
|
256
|
+
getResponse: () => Response;
|
|
257
|
+
}
|
|
258
|
+
type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response>;
|
|
259
|
+
interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = '/', CurrentPath extends string = BasePath> {
|
|
260
|
+
<P extends string = CurrentPath, I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(handler: H<E2, P, I, R>): Acryl<IntersectNonAnyTypes<[E, E2]>, S & ToSchema<M, P, I, MergeTypedResponse<R>>, BasePath, CurrentPath>;
|
|
261
|
+
<P extends string = CurrentPath, I extends Input = BlankInput, I2 extends Input = I, R extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, M1 extends H<E2, P, I> = H<E2, P, I>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3]>, S & ToSchema<M, P, I2, MergeTypedResponse<R> | MergeMiddlewareResponse<M1>>, BasePath, CurrentPath>;
|
|
262
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(path: P, handler: H<E2, MergedPath, I, R>): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R>, S, M, P, I, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
263
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4]>, S & ToSchema<M, P, I3, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2>>, BasePath, CurrentPath>;
|
|
264
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1>, S, M, P, I2, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
265
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S & ToSchema<M, P, I4, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3>>, BasePath, CurrentPath>;
|
|
266
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2>, S, M, P, I3, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
267
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S & ToSchema<M, P, I5, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4>>, BasePath, CurrentPath>;
|
|
268
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3>, S, M, P, I4, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
269
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>, M5 extends H<E6, P, I5> = H<E6, P, I5>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5> & M5, H<E7, P, I6, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S & ToSchema<M, P, I6, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5>>, BasePath, CurrentPath>;
|
|
270
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4>, S, M, P, I5, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
271
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>, M5 extends H<E6, P, I5> = H<E6, P, I5>, M6 extends H<E7, P, I6> = H<E7, P, I6>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5> & M5, H<E7, P, I6> & M6, H<E8, P, I7, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S & ToSchema<M, P, I7, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6>>, BasePath, CurrentPath>;
|
|
272
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5>, S, M, P, I6, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
273
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>, M5 extends H<E6, P, I5> = H<E6, P, I5>, M6 extends H<E7, P, I6> = H<E7, P, I6>, M7 extends H<E8, P, I7> = H<E8, P, I7>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5> & M5, H<E7, P, I6> & M6, H<E8, P, I7> & M7, H<E9, P, I8, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S & ToSchema<M, P, I8, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7>>, BasePath, CurrentPath>;
|
|
274
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6>, S, M, P, I7, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
275
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>, M5 extends H<E6, P, I5> = H<E6, P, I5>, M6 extends H<E7, P, I6> = H<E7, P, I6>, M7 extends H<E8, P, I7> = H<E8, P, I7>, M8 extends H<E9, P, I8> = H<E9, P, I8>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5> & M5, H<E7, P, I6> & M6, H<E8, P, I7> & M7, H<E9, P, I8> & M8, H<E10, P, I9, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S & ToSchema<M, P, I9, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8>>, BasePath, CurrentPath>;
|
|
276
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7>, S, M, P, I8, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
277
|
+
<P extends string = CurrentPath, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, M1 extends H<E2, P, I> = H<E2, P, I>, M2 extends H<E3, P, I2> = H<E3, P, I2>, M3 extends H<E4, P, I3> = H<E4, P, I3>, M4 extends H<E5, P, I4> = H<E5, P, I4>, M5 extends H<E6, P, I5> = H<E6, P, I5>, M6 extends H<E7, P, I6> = H<E7, P, I6>, M7 extends H<E8, P, I7> = H<E8, P, I7>, M8 extends H<E9, P, I8> = H<E9, P, I8>, M9 extends H<E10, P, I9> = H<E10, P, I9>>(...handlers: [H<E2, P, I> & M1, H<E3, P, I2> & M2, H<E4, P, I3> & M3, H<E5, P, I4> & M4, H<E6, P, I5> & M5, H<E7, P, I6> & M6, H<E8, P, I7> & M7, H<E9, P, I8> & M8, H<E10, P, I9> & M9, H<E11, P, I10, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S & ToSchema<M, P, I10, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8> | MergeMiddlewareResponse<M9>>, BasePath, CurrentPath>;
|
|
278
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8>, S, M, P, I9, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
279
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>, M9 extends H<E10, MergedPath, I9> = H<E10, MergedPath, I9>>(path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9> & M9, H<E11, MergedPath, I10, R>]): Acryl<E, AddSchemaIfHasResponse<MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8> | MergeMiddlewareResponse<M9>, S, M, P, I10, BasePath>, BasePath, MergePath<BasePath, P>>;
|
|
280
|
+
<P extends string = CurrentPath, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(...handlers: H<E, P, I, R>[]): Acryl<E, S & ToSchema<M, P, I, MergeTypedResponse<R>>, BasePath, CurrentPath>;
|
|
281
|
+
<P extends string, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, R>, ...H<E, MergePath<BasePath, P>, I, R>[]]): Acryl<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
282
|
+
<P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(path: P): Acryl<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
283
|
+
}
|
|
284
|
+
interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = '/'> {
|
|
285
|
+
<E2 extends Env = E>(...handlers: MiddlewareHandler<E2, MergePath<BasePath, '*'>>[]): Acryl<IntersectNonAnyTypes<[E, E2]>, S, BasePath, MergePath<BasePath, '*'>>;
|
|
286
|
+
<E2 extends Env = E>(handler: MiddlewareHandler<E2, MergePath<BasePath, '*'>>): Acryl<IntersectNonAnyTypes<[E, E2]>, S, BasePath, MergePath<BasePath, '*'>>;
|
|
287
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3]>, S, BasePath, P>;
|
|
288
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E>(path: P, handler: MiddlewareHandler<E2, MergedPath, any, any>): Acryl<IntersectNonAnyTypes<[E, E2]>, S, BasePath, MergedPath>;
|
|
289
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P, any, any>, MiddlewareHandler<E3, P, any, any>, MiddlewareHandler<E4, P, any, any>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4]>, S, BasePath, P>;
|
|
290
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3]>, S, BasePath, MergedPath>;
|
|
291
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S, BasePath, P>;
|
|
292
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4]>, S, BasePath, MergedPath>;
|
|
293
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S, BasePath, P>;
|
|
294
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S, BasePath, MergedPath>;
|
|
295
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S, BasePath, P>;
|
|
296
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S, BasePath, MergedPath>;
|
|
297
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S, BasePath, P>;
|
|
298
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S, BasePath, MergedPath>;
|
|
299
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>, MiddlewareHandler<E9, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S, BasePath, P>;
|
|
300
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S, BasePath, MergedPath>;
|
|
301
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>, MiddlewareHandler<E9, P>, MiddlewareHandler<E10, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S, BasePath, P>;
|
|
302
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>, MiddlewareHandler<E9, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S, BasePath, MergedPath>;
|
|
303
|
+
<E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, P extends string = MergePath<BasePath, '*'>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>, MiddlewareHandler<E9, P>, MiddlewareHandler<E10, P>, MiddlewareHandler<E11, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S, BasePath, P>;
|
|
304
|
+
<P extends string, MergedPath extends MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>, MiddlewareHandler<E5, P>, MiddlewareHandler<E6, P>, MiddlewareHandler<E7, P>, MiddlewareHandler<E8, P>, MiddlewareHandler<E9, P>, MiddlewareHandler<E10, P>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S, BasePath, MergedPath>;
|
|
305
|
+
<P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]): Acryl<E, S, BasePath, MergePath<BasePath, P>>;
|
|
306
|
+
}
|
|
307
|
+
interface OnHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = '/'> {
|
|
308
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(method: M, path: P, handler: H<E2, MergedPath, I, R>): Acryl<IntersectNonAnyTypes<[E, E2]>, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
309
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3]>, S & ToSchema<M, MergePath<BasePath, P>, I2, MergeTypedResponse<R> | MergeMiddlewareResponse<M1>>, BasePath, MergePath<BasePath, P>>;
|
|
310
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4]>, S & ToSchema<M, MergePath<BasePath, P>, I3, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2>>, BasePath, MergePath<BasePath, P>>;
|
|
311
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S & ToSchema<M, MergePath<BasePath, P>, I4, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3>>, BasePath, MergePath<BasePath, P>>;
|
|
312
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S & ToSchema<M, MergePath<BasePath, P>, I5, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4>>, BasePath, MergePath<BasePath, P>>;
|
|
313
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S & ToSchema<M, MergePath<BasePath, P>, I6, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5>>, BasePath, MergePath<BasePath, P>>;
|
|
314
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S & ToSchema<M, MergePath<BasePath, P>, I7, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6>>, BasePath, MergePath<BasePath, P>>;
|
|
315
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S & ToSchema<M, MergePath<BasePath, P>, I8, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7>>, BasePath, MergePath<BasePath, P>>;
|
|
316
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8>>, BasePath, MergePath<BasePath, P>>;
|
|
317
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>, M9 extends H<E10, MergedPath, I9> = H<E10, MergedPath, I9>>(method: M, path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9> & M9, H<E11, MergedPath, I10, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8> | MergeMiddlewareResponse<M9>>, BasePath, MergePath<BasePath, P>>;
|
|
318
|
+
<M extends string, P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(method: M, path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, R>, ...H<E, MergePath<BasePath, P>, I, R>[]]): Acryl<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
319
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(methods: M[], path: P, handler: H<E2, MergedPath, I, R>): Acryl<IntersectNonAnyTypes<[E, E2]>, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
320
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3]>, S & ToSchema<M, MergePath<BasePath, P>, I2, MergeTypedResponse<R> | MergeMiddlewareResponse<M1>>, BasePath, MergePath<BasePath, P>>;
|
|
321
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4]>, S & ToSchema<M, MergePath<BasePath, P>, I3, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2>>, BasePath, MergePath<BasePath, P>>;
|
|
322
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S & ToSchema<M, MergePath<BasePath, P>, I4, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3>>, BasePath, MergePath<BasePath, P>>;
|
|
323
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S & ToSchema<M, MergePath<BasePath, P>, I5, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4>>, BasePath, MergePath<BasePath, P>>;
|
|
324
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S & ToSchema<M, MergePath<BasePath, P>, I6, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5>>, BasePath, MergePath<BasePath, P>>;
|
|
325
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S & ToSchema<M, MergePath<BasePath, P>, I7, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6>>, BasePath, MergePath<BasePath, P>>;
|
|
326
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S & ToSchema<M, MergePath<BasePath, P>, I8, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7>>, BasePath, MergePath<BasePath, P>>;
|
|
327
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8>>, BasePath, MergePath<BasePath, P>>;
|
|
328
|
+
<M extends string, P extends string, MergedPath extends MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, M1 extends H<E2, MergedPath, I> = H<E2, MergedPath, I>, M2 extends H<E3, MergedPath, I2> = H<E3, MergedPath, I2>, M3 extends H<E4, MergedPath, I3> = H<E4, MergedPath, I3>, M4 extends H<E5, MergedPath, I4> = H<E5, MergedPath, I4>, M5 extends H<E6, MergedPath, I5> = H<E6, MergedPath, I5>, M6 extends H<E7, MergedPath, I6> = H<E7, MergedPath, I6>, M7 extends H<E8, MergedPath, I7> = H<E8, MergedPath, I7>, M8 extends H<E9, MergedPath, I8> = H<E9, MergedPath, I8>, M9 extends H<E10, MergedPath, I9> = H<E10, MergedPath, I9>>(methods: M[], path: P, ...handlers: [H<E2, MergedPath, I> & M1, H<E3, MergedPath, I2> & M2, H<E4, MergedPath, I3> & M3, H<E5, MergedPath, I4> & M4, H<E6, MergedPath, I5> & M5, H<E7, MergedPath, I6> & M6, H<E8, MergedPath, I7> & M7, H<E9, MergedPath, I8> & M8, H<E10, MergedPath, I9> & M9, H<E11, MergedPath, I10, R>]): Acryl<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<R> | MergeMiddlewareResponse<M1> | MergeMiddlewareResponse<M2> | MergeMiddlewareResponse<M3> | MergeMiddlewareResponse<M4> | MergeMiddlewareResponse<M5> | MergeMiddlewareResponse<M6> | MergeMiddlewareResponse<M7> | MergeMiddlewareResponse<M8> | MergeMiddlewareResponse<M9>>, BasePath, MergePath<BasePath, P>>;
|
|
329
|
+
<M extends string, P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(methods: M[], path: P, ...handlers: [H<E, MergePath<BasePath, P>, I, R>, ...H<E, MergePath<BasePath, P>, I, R>[]]): Acryl<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath, MergePath<BasePath, P>>;
|
|
330
|
+
<M extends string, const Ps extends string[], I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(methods: M | M[], paths: Ps, ...handlers: H<E2, MergePath<BasePath, Ps[number]>, I, R>[]): Acryl<E, S & ToSchema<M, MergePath<BasePath, Ps[number]>, I, MergeTypedResponse<R>>, BasePath, Ps extends [...string[], infer LastPath extends string] ? MergePath<BasePath, LastPath> : never>;
|
|
331
|
+
}
|
|
332
|
+
type ToSchemaOutput<RorO, I extends Input | Input['in']> = RorO extends TypedResponse<infer T, infer U, infer F> ? {
|
|
333
|
+
output: unknown extends T ? {} : T;
|
|
334
|
+
outputFormat: I extends {
|
|
335
|
+
outputFormat: string;
|
|
336
|
+
} ? I['outputFormat'] : F;
|
|
337
|
+
status: U;
|
|
338
|
+
} : {
|
|
339
|
+
output: unknown extends RorO ? {} : RorO;
|
|
340
|
+
outputFormat: unknown extends RorO ? 'json' : I extends {
|
|
341
|
+
outputFormat: string;
|
|
342
|
+
} ? I['outputFormat'] : 'json';
|
|
343
|
+
status: StatusCode;
|
|
344
|
+
};
|
|
345
|
+
type ToSchema<M extends string, P extends string, I extends Input | Input['in'], RorO> = IsAny<RorO> extends true ? { [K in P]: { [K2 in M as AddDollar<K2>]: {
|
|
346
|
+
input: AddParam<ExtractInput<I>, P>;
|
|
347
|
+
output: {};
|
|
348
|
+
outputFormat: ResponseFormat;
|
|
349
|
+
status: StatusCode;
|
|
350
|
+
} } } : [RorO] extends [never] ? {} : [RorO] extends [Promise<void>] ? {} : { [K in P]: { [K2 in M as AddDollar<K2>]: Simplify<{
|
|
351
|
+
input: AddParam<ExtractInput<I>, P>;
|
|
352
|
+
} & ToSchemaOutput<RorO, I>> } };
|
|
353
|
+
type Schema = {
|
|
354
|
+
[Path: string]: {
|
|
355
|
+
[Method: `$${Lowercase<string>}`]: Endpoint;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
type AddSchemaIfHasResponse<Merged, S extends Schema, M extends string, P extends string, I extends Input | Input['in'], BasePath extends string> = [Merged] extends [Promise<void>] ? S : S & ToSchema<M, MergePath<BasePath, P>, I, Merged>;
|
|
359
|
+
type Endpoint = {
|
|
360
|
+
input: any;
|
|
361
|
+
output: any;
|
|
362
|
+
outputFormat: ResponseFormat;
|
|
363
|
+
status: StatusCode;
|
|
364
|
+
};
|
|
365
|
+
type ExtractParams<Path extends string> = string extends Path ? Record<string, string> : Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof ExtractParams<`/${Rest}`>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : never;
|
|
366
|
+
type FlattenIfIntersect<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
367
|
+
type MergeSchemaPath<OrigSchema extends Schema, SubPath extends string> = { [P in keyof OrigSchema as MergePath<SubPath, P & string>]: [OrigSchema[P]] extends [Record<string, Endpoint>] ? { [M in keyof OrigSchema[P]]: MergeEndpointParamsWithPath<OrigSchema[P][M], SubPath> } : never };
|
|
368
|
+
type MergeEndpointParamsWithPath<T extends Endpoint, SubPath extends string> = T extends unknown ? {
|
|
369
|
+
input: T['input'] extends {
|
|
370
|
+
param: infer _;
|
|
371
|
+
} ? ExtractParams<SubPath> extends never ? T['input'] : FlattenIfIntersect<T['input'] & {
|
|
372
|
+
param: { [K in keyof ExtractParams<SubPath> as K extends `${infer Prefix}{${infer _}}` ? Prefix : K]: string };
|
|
373
|
+
}> : RemoveBlankRecord<ExtractParams<SubPath>> extends never ? T['input'] : T['input'] & {
|
|
374
|
+
param: { [K in keyof ExtractParams<SubPath> as K extends `${infer Prefix}{${infer _}}` ? Prefix : K]: string };
|
|
375
|
+
};
|
|
376
|
+
output: T['output'];
|
|
377
|
+
outputFormat: T['outputFormat'];
|
|
378
|
+
status: T['status'];
|
|
379
|
+
} : never;
|
|
380
|
+
type AddParam<I, P extends string> = ParamKeys<P> extends never ? I : I extends {
|
|
381
|
+
param: infer _;
|
|
382
|
+
} ? I : I & {
|
|
383
|
+
param: UnionToIntersection<ParamKeyToRecord<ParamKeys<P>>>;
|
|
384
|
+
};
|
|
385
|
+
type AddDollar<T extends string> = `$${Lowercase<T>}`;
|
|
386
|
+
type MergePath<A extends string, B extends string> = B extends '' ? MergePath<A, '/'> : A extends '' ? B : A extends '/' ? B : A extends `${infer P}/` ? B extends `/${infer Q}` ? `${P}/${Q}` : `${P}/${B}` : B extends `/${infer Q}` ? Q extends '' ? A : `${A}/${Q}` : `${A}/${B}`;
|
|
387
|
+
type KnownResponseFormat = 'json' | 'text' | 'redirect';
|
|
388
|
+
type ResponseFormat = KnownResponseFormat | string;
|
|
389
|
+
type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = (T extends string ? 'text' : T extends JSONValue ? 'json' : ResponseFormat)> = {
|
|
390
|
+
_data: T;
|
|
391
|
+
_status: U;
|
|
392
|
+
_format: F;
|
|
393
|
+
};
|
|
394
|
+
type MergeTypedResponse<T> = T extends Promise<void> ? T : T extends Promise<infer T2> ? T2 extends TypedResponse ? T2 : TypedResponse : T extends TypedResponse ? T : TypedResponse;
|
|
395
|
+
type ExtractTypedResponseOnly<T> = T extends TypedResponse ? T : never;
|
|
396
|
+
type MergeMiddlewareResponse<T> = T extends ((c: any, next: any) => Promise<infer R>) ? Exclude<R, void> extends never ? never : Exclude<R, void> extends Response | TypedResponse<any, any, any> ? ExtractTypedResponseOnly<Exclude<R, void>> : never : T extends ((c: any, next: any) => infer R) ? R extends Response | TypedResponse<any, any, any> ? ExtractTypedResponseOnly<R> : never : never;
|
|
397
|
+
type FormValue = string | Blob;
|
|
398
|
+
type ParsedFormValue = string | File;
|
|
399
|
+
type ValidationTargets<T extends FormValue = ParsedFormValue, P extends string = string> = {
|
|
400
|
+
json: any;
|
|
401
|
+
form: Record<string, T | T[]>;
|
|
402
|
+
query: Record<string, string | string[]>;
|
|
403
|
+
param: Record<P, P extends `${infer _}?` ? string | undefined : string>;
|
|
404
|
+
header: Record<RequestHeader | CustomHeader, string>;
|
|
405
|
+
cookie: Record<string, string>;
|
|
406
|
+
};
|
|
407
|
+
type ParamKey<Component> = Component extends `:${infer NameWithPattern}` ? NameWithPattern extends `${infer Name}{${infer Rest}` ? Rest extends `${infer _Pattern}?` ? `${Name}?` : Name : NameWithPattern : never;
|
|
408
|
+
type ParamKeys<Path> = Path extends `${infer Component}/${infer Rest}` ? ParamKey<Component> | ParamKeys<Rest> : ParamKey<Path>;
|
|
409
|
+
type ParamKeyToRecord<T extends string> = T extends `${infer R}?` ? Record<R, string | undefined> : { [K in T]: string };
|
|
410
|
+
type InputToDataByTarget<T extends Input['out'], Target extends keyof ValidationTargets> = T extends { [K in Target]: infer R } ? R : never;
|
|
411
|
+
type RemoveQuestion<T> = T extends `${infer R}?` ? R : T;
|
|
412
|
+
type ExtractSchema<T> = UnionToIntersection<T extends Acryl<infer _, infer S, any, any> ? S : never>;
|
|
413
|
+
type ExtractSchemaForStatusCode<T, Status extends number> = { [Path in keyof ExtractSchema<T>]: { [Method in keyof ExtractSchema<T>[Path]]: Extract<ExtractSchema<T>[Path][Method], {
|
|
414
|
+
status: Status;
|
|
415
|
+
}> } };
|
|
416
|
+
type ExtractHandlerResponse<T> = T extends ((c: any, next: any) => Promise<infer R>) ? Exclude<R, void> extends never ? never : Exclude<R, void> extends Response | TypedResponse<any, any, any> ? Exclude<R, void> : never : T extends ((c: any, next: any) => infer R) ? R extends Response | TypedResponse<any, any, any> ? R : never : never;
|
|
417
|
+
type ProcessHead<T> = IfAnyThenEmptyObject<T extends Env ? (Env extends T ? {} : T) : T>;
|
|
418
|
+
type IntersectNonAnyTypes<T extends any[]> = T extends [infer Head, ...infer Rest] ? ProcessHead<Head> & IntersectNonAnyTypes<Rest> : {};
|
|
419
|
+
declare abstract class FetchEventLike {
|
|
420
|
+
abstract readonly request: Request;
|
|
421
|
+
abstract respondWith(promise: Response | Promise<Response>): void;
|
|
422
|
+
abstract passThroughOnException(): void;
|
|
423
|
+
abstract waitUntil(promise: Promise<void>): void;
|
|
424
|
+
}
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region ../../plugins/acryl-router/src/core/utils/body.d.ts
|
|
427
|
+
type BodyDataValueDot = {
|
|
428
|
+
[x: string]: string | File | BodyDataValueDot;
|
|
429
|
+
};
|
|
430
|
+
type BodyDataValueDotAll = {
|
|
431
|
+
[x: string]: string | File | (string | File)[] | BodyDataValueDotAll;
|
|
432
|
+
};
|
|
433
|
+
type SimplifyBodyData<T> = { [K in keyof T]: string | File | (string | File)[] | BodyDataValueDotAll extends T[K] ? string | File | (string | File)[] | BodyDataValueDotAll : string | File | BodyDataValueDot extends T[K] ? string | File | BodyDataValueDot : string | File | (string | File)[] extends T[K] ? string | File | (string | File)[] : string | File } & {};
|
|
434
|
+
type BodyDataValueComponent<T> = string | File | (T extends {
|
|
435
|
+
all: false;
|
|
436
|
+
} ? never : T extends {
|
|
437
|
+
all: true;
|
|
438
|
+
} | {
|
|
439
|
+
all: boolean;
|
|
440
|
+
} ? (string | File)[] : never);
|
|
441
|
+
type BodyDataValueObject<T> = {
|
|
442
|
+
[key: string]: BodyDataValueComponent<T> | BodyDataValueObject<T>;
|
|
443
|
+
};
|
|
444
|
+
type BodyDataValue<T> = BodyDataValueComponent<T> | (T extends {
|
|
445
|
+
dot: false;
|
|
446
|
+
} ? never : T extends {
|
|
447
|
+
dot: true;
|
|
448
|
+
} | {
|
|
449
|
+
dot: boolean;
|
|
450
|
+
} ? BodyDataValueObject<T> : never);
|
|
451
|
+
type BodyData<T extends Partial<ParseBodyOptions> = {}> = SimplifyBodyData<Record<string, BodyDataValue<T>>>;
|
|
452
|
+
type ParseBodyOptions = {
|
|
453
|
+
/**
|
|
454
|
+
* Determines whether all fields with multiple values should be parsed as arrays.
|
|
455
|
+
* @default false
|
|
456
|
+
* @example
|
|
457
|
+
* const data = new FormData()
|
|
458
|
+
* data.append('file', 'aaa')
|
|
459
|
+
* data.append('file', 'bbb')
|
|
460
|
+
* data.append('message', 'hello')
|
|
461
|
+
*
|
|
462
|
+
* If all is false:
|
|
463
|
+
* parseBody should return { file: 'bbb', message: 'hello' }
|
|
464
|
+
*
|
|
465
|
+
* If all is true:
|
|
466
|
+
* parseBody should return { file: ['aaa', 'bbb'], message: 'hello' }
|
|
467
|
+
*/
|
|
468
|
+
all: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* Determines whether all fields with dot notation should be parsed as nested objects.
|
|
471
|
+
* @default false
|
|
472
|
+
* @example
|
|
473
|
+
* const data = new FormData()
|
|
474
|
+
* data.append('obj.key1', 'value1')
|
|
475
|
+
* data.append('obj.key2', 'value2')
|
|
476
|
+
*
|
|
477
|
+
* If dot is false:
|
|
478
|
+
* parseBody should return { 'obj.key1': 'value1', 'obj.key2': 'value2' }
|
|
479
|
+
*
|
|
480
|
+
* If dot is true:
|
|
481
|
+
* parseBody should return { obj: { key1: 'value1', key2: 'value2' } }
|
|
482
|
+
*/
|
|
483
|
+
dot: boolean;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Parses the body of a request based on the provided options.
|
|
487
|
+
*
|
|
488
|
+
* @template T - The type of the parsed body data.
|
|
489
|
+
* @param {AcrylRequest | Request} request - The request object to parse.
|
|
490
|
+
* @param {Partial<ParseBodyOptions>} [options] - Options for parsing the body.
|
|
491
|
+
* @returns {Promise<T>} The parsed body data.
|
|
492
|
+
*/
|
|
493
|
+
interface ParseBody {
|
|
494
|
+
<Options extends Partial<ParseBodyOptions>, T extends BodyData<Options>>(request: AcrylRequest | Request, options?: Options): Promise<T>;
|
|
495
|
+
<T extends BodyData>(request: AcrylRequest | Request, options?: Partial<ParseBodyOptions>): Promise<T>;
|
|
496
|
+
}
|
|
497
|
+
declare const parseBody: ParseBody;
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region ../../plugins/acryl-router/src/core/request.d.ts
|
|
500
|
+
type Body = {
|
|
501
|
+
json: any;
|
|
502
|
+
text: string;
|
|
503
|
+
arrayBuffer: ArrayBuffer;
|
|
504
|
+
blob: Blob;
|
|
505
|
+
formData: FormData;
|
|
506
|
+
};
|
|
507
|
+
type BodyCache = Partial<Body>;
|
|
508
|
+
declare class AcrylRequest<P extends string = '/', I extends Input['out'] = {}> {
|
|
509
|
+
#private;
|
|
510
|
+
/**
|
|
511
|
+
* `.raw` can get the raw Request object.
|
|
512
|
+
*
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```ts
|
|
516
|
+
* // For Cloudflare Workers
|
|
517
|
+
* app.post('/', async (c) => {
|
|
518
|
+
* const metadata = c.req.raw.cf?.hostMetadata?
|
|
519
|
+
* ...
|
|
520
|
+
* })
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
raw: Request;
|
|
524
|
+
routeIndex: number;
|
|
525
|
+
/**
|
|
526
|
+
* `.path` can get the pathname of the request.
|
|
527
|
+
*
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```ts
|
|
531
|
+
* app.get('/about/me', (c) => {
|
|
532
|
+
* const pathname = c.req.path // `/about/me`
|
|
533
|
+
* })
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
536
|
+
path: string;
|
|
537
|
+
bodyCache: BodyCache;
|
|
538
|
+
constructor(request: Request, path?: string, matchResult?: Result<[unknown, RouterRoute]>);
|
|
539
|
+
/**
|
|
540
|
+
* `.req.param()` gets the path parameters.
|
|
541
|
+
*
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* const name = c.req.param('name')
|
|
546
|
+
* // or all parameters at once
|
|
547
|
+
* const { id, comment_id } = c.req.param()
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
param<P2 extends ParamKeys<P> = ParamKeys<P>>(key: string extends P ? never : P2 extends `${infer _}?` ? never : P2): string;
|
|
551
|
+
param<P2 extends RemoveQuestion<ParamKeys<P>> = RemoveQuestion<ParamKeys<P>>>(key: P2): string | undefined;
|
|
552
|
+
param(key: string): string | undefined;
|
|
553
|
+
param<P2 extends string = P>(): Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P2>>>>;
|
|
554
|
+
/**
|
|
555
|
+
* `.query()` can get querystring parameters.
|
|
556
|
+
*
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```ts
|
|
560
|
+
* // Query params
|
|
561
|
+
* app.get('/search', (c) => {
|
|
562
|
+
* const query = c.req.query('q')
|
|
563
|
+
* })
|
|
564
|
+
*
|
|
565
|
+
* // Get all params at once
|
|
566
|
+
* app.get('/search', (c) => {
|
|
567
|
+
* const { q, limit, offset } = c.req.query()
|
|
568
|
+
* })
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
query(key: string): string | undefined;
|
|
572
|
+
query(): Record<string, string>;
|
|
573
|
+
/**
|
|
574
|
+
* `.queries()` can get multiple querystring parameter values, e.g. /search?tags=A&tags=B
|
|
575
|
+
*
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ```ts
|
|
579
|
+
* app.get('/search', (c) => {
|
|
580
|
+
* // tags will be string[]
|
|
581
|
+
* const tags = c.req.queries('tags')
|
|
582
|
+
* })
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
queries(key: string): string[] | undefined;
|
|
586
|
+
queries(): Record<string, string[]>;
|
|
587
|
+
/**
|
|
588
|
+
* `.header()` can get the request header value.
|
|
589
|
+
*
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```ts
|
|
593
|
+
* app.get('/', (c) => {
|
|
594
|
+
* const userAgent = c.req.header('User-Agent')
|
|
595
|
+
* })
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
header(name: RequestHeader): string | undefined;
|
|
599
|
+
header(name: string): string | undefined;
|
|
600
|
+
header(): Record<RequestHeader | (string & CustomHeader), string>;
|
|
601
|
+
/**
|
|
602
|
+
* `.parseBody()` can parse Request body of type `multipart/form-data` or `application/x-www-form-urlencoded`
|
|
603
|
+
*
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* ```ts
|
|
607
|
+
* app.post('/entry', async (c) => {
|
|
608
|
+
* const body = await c.req.parseBody()
|
|
609
|
+
* })
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
parseBody<Options extends Partial<ParseBodyOptions>, T extends BodyData<Options>>(options?: Options): Promise<T>;
|
|
613
|
+
parseBody<T extends BodyData>(options?: Partial<ParseBodyOptions>): Promise<T>;
|
|
614
|
+
/**
|
|
615
|
+
* `.json()` can parse Request body of type `application/json`
|
|
616
|
+
*
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```ts
|
|
620
|
+
* app.post('/entry', async (c) => {
|
|
621
|
+
* const body = await c.req.json()
|
|
622
|
+
* })
|
|
623
|
+
* ```
|
|
624
|
+
*/
|
|
625
|
+
json<T = any>(): Promise<T>;
|
|
626
|
+
/**
|
|
627
|
+
* `.text()` can parse Request body of type `text/plain`
|
|
628
|
+
*
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```ts
|
|
632
|
+
* app.post('/entry', async (c) => {
|
|
633
|
+
* const body = await c.req.text()
|
|
634
|
+
* })
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
text(): Promise<string>;
|
|
638
|
+
/**
|
|
639
|
+
* `.arrayBuffer()` parse Request body as an `ArrayBuffer`
|
|
640
|
+
*
|
|
641
|
+
*
|
|
642
|
+
* @example
|
|
643
|
+
* ```ts
|
|
644
|
+
* app.post('/entry', async (c) => {
|
|
645
|
+
* const body = await c.req.arrayBuffer()
|
|
646
|
+
* })
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
650
|
+
/**
|
|
651
|
+
* `.bytes()` parses the request body as a `Uint8Array`.
|
|
652
|
+
*
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* app.post('/entry', async (c) => {
|
|
657
|
+
* const body = await c.req.bytes()
|
|
658
|
+
* })
|
|
659
|
+
* ```
|
|
660
|
+
*/
|
|
661
|
+
bytes(): Promise<Uint8Array>;
|
|
662
|
+
/**
|
|
663
|
+
* Parses the request body as a `Blob`.
|
|
664
|
+
* @example
|
|
665
|
+
* ```ts
|
|
666
|
+
* app.post('/entry', async (c) => {
|
|
667
|
+
* const body = await c.req.blob();
|
|
668
|
+
* });
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
blob(): Promise<Blob>;
|
|
672
|
+
/**
|
|
673
|
+
* Parses the request body as `FormData`.
|
|
674
|
+
* @example
|
|
675
|
+
* ```ts
|
|
676
|
+
* app.post('/entry', async (c) => {
|
|
677
|
+
* const body = await c.req.formData();
|
|
678
|
+
* });
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
formData(): Promise<FormData>;
|
|
682
|
+
/**
|
|
683
|
+
* Adds validated data to the request.
|
|
684
|
+
*
|
|
685
|
+
* @param target - The target of the validation.
|
|
686
|
+
* @param data - The validated data to add.
|
|
687
|
+
*/
|
|
688
|
+
addValidatedData(target: keyof ValidationTargets, data: {}): void;
|
|
689
|
+
/**
|
|
690
|
+
* Gets validated data from the request.
|
|
691
|
+
*
|
|
692
|
+
* @param target - The target of the validation.
|
|
693
|
+
* @returns The validated data.
|
|
694
|
+
*
|
|
695
|
+
*/
|
|
696
|
+
valid<T extends keyof I & keyof ValidationTargets>(target: T): InputToDataByTarget<I, T>;
|
|
697
|
+
/**
|
|
698
|
+
* `.url` can get the request url strings.
|
|
699
|
+
*
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```ts
|
|
703
|
+
* app.get('/about/me', (c) => {
|
|
704
|
+
* const url = c.req.url // `http://localhost:8787/about/me`
|
|
705
|
+
* ...
|
|
706
|
+
* })
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
get url(): string;
|
|
710
|
+
/**
|
|
711
|
+
* `.method` can get the method name of the request.
|
|
712
|
+
*
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```ts
|
|
716
|
+
* app.get('/about/me', (c) => {
|
|
717
|
+
* const method = c.req.method // `GET`
|
|
718
|
+
* })
|
|
719
|
+
* ```
|
|
720
|
+
*/
|
|
721
|
+
get method(): string;
|
|
722
|
+
get [GET_MATCH_RESULT](): Result<[unknown, RouterRoute]>;
|
|
723
|
+
/**
|
|
724
|
+
* `.matchedRoutes` can return a matched route in the handler
|
|
725
|
+
*
|
|
726
|
+
* @deprecated
|
|
727
|
+
*
|
|
728
|
+
* Use matchedRoutes helper defined in "acryl-router/route" instead.
|
|
729
|
+
*
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```ts
|
|
733
|
+
* app.use('*', async function logger(c, next) {
|
|
734
|
+
* await next()
|
|
735
|
+
* c.req.matchedRoutes.forEach(({ handler, method, path }, i) => {
|
|
736
|
+
* const name = handler.name || (handler.length < 2 ? '[handler]' : '[middleware]')
|
|
737
|
+
* console.log(
|
|
738
|
+
* method,
|
|
739
|
+
* ' ',
|
|
740
|
+
* path,
|
|
741
|
+
* ' '.repeat(Math.max(10 - path.length, 0)),
|
|
742
|
+
* name,
|
|
743
|
+
* i === c.req.routeIndex ? '<- respond from here' : ''
|
|
744
|
+
* )
|
|
745
|
+
* })
|
|
746
|
+
* })
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
get matchedRoutes(): RouterRoute[];
|
|
750
|
+
/**
|
|
751
|
+
* `.routePath` can retrieve the path registered within the handler
|
|
752
|
+
*
|
|
753
|
+
* @deprecated
|
|
754
|
+
*
|
|
755
|
+
* Use routePath helper defined in "acryl-router/route" instead.
|
|
756
|
+
*
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* ```ts
|
|
760
|
+
* app.get('/posts/:id', (c) => {
|
|
761
|
+
* return c.json({ path: c.req.routePath })
|
|
762
|
+
* })
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
get routePath(): string;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Clones a AcrylRequest's underlying raw Request object.
|
|
769
|
+
*
|
|
770
|
+
* This utility handles both consumed and unconsumed request bodies:
|
|
771
|
+
* - If the request body hasn't been consumed, it uses the native `clone()` method
|
|
772
|
+
* - If the request body has been consumed, it reconstructs a new Request using cached body data
|
|
773
|
+
*
|
|
774
|
+
* This is particularly useful when you need to:
|
|
775
|
+
* - Process the same request body multiple times
|
|
776
|
+
* - Pass requests to external services after validation
|
|
777
|
+
*
|
|
778
|
+
* @param req - The AcrylRequest object to clone
|
|
779
|
+
* @returns A Promise that resolves to a new Request object with the same properties
|
|
780
|
+
* @throws {HTTPException} If the request body was consumed directly via `req.raw`
|
|
781
|
+
* without using AcrylRequest methods (e.g., `req.json()`, `req.text()`), making it
|
|
782
|
+
* impossible to reconstruct the body from cache
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```ts
|
|
786
|
+
* // Clone after consuming the body (e.g., after validation)
|
|
787
|
+
* app.post('/forward',
|
|
788
|
+
* validator('json', (data) => data),
|
|
789
|
+
* async (c) => {
|
|
790
|
+
* const validated = c.req.valid('json')
|
|
791
|
+
* // Body has been consumed, but cloneRawRequest still works
|
|
792
|
+
* const clonedReq = await cloneRawRequest(c.req)
|
|
793
|
+
* return fetch('http://backend-service.com', clonedReq)
|
|
794
|
+
* }
|
|
795
|
+
* )
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
declare const cloneRawRequest: (req: AcrylRequest) => Promise<Request>;
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region ../../plugins/acryl-router/src/core/context.d.ts
|
|
801
|
+
type HeaderRecord = Record<'Content-Type', BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>;
|
|
802
|
+
/**
|
|
803
|
+
* Data type can be a string, ArrayBuffer, Blob, Uint8Array (buffer), or ReadableStream.
|
|
804
|
+
*/
|
|
805
|
+
type Data = string | ArrayBuffer | Blob | ReadableStream | Uint8Array<ArrayBuffer>;
|
|
806
|
+
/**
|
|
807
|
+
* Interface for the execution context in a web worker or similar environment.
|
|
808
|
+
*/
|
|
809
|
+
interface ExecutionContext {
|
|
810
|
+
/**
|
|
811
|
+
* Extends the lifetime of the event callback until the promise is settled.
|
|
812
|
+
*
|
|
813
|
+
* @param promise - A promise to wait for.
|
|
814
|
+
*/
|
|
815
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
816
|
+
/**
|
|
817
|
+
* Allows the event to be passed through to subsequent event listeners.
|
|
818
|
+
*/
|
|
819
|
+
passThroughOnException(): void;
|
|
820
|
+
/**
|
|
821
|
+
* For compatibility with Wrangler 4.x.
|
|
822
|
+
*/
|
|
823
|
+
props: any;
|
|
824
|
+
/**
|
|
825
|
+
* For compatibility with Wrangler 4.x.
|
|
826
|
+
*/
|
|
827
|
+
exports?: any;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Interface for context variable mapping.
|
|
831
|
+
*/
|
|
832
|
+
interface ContextVariableMap {}
|
|
833
|
+
/**
|
|
834
|
+
* Interface for context renderer.
|
|
835
|
+
*/
|
|
836
|
+
interface ContextRenderer {}
|
|
837
|
+
/**
|
|
838
|
+
* Interface representing a renderer for content.
|
|
839
|
+
*
|
|
840
|
+
* @interface DefaultRenderer
|
|
841
|
+
* @param {string | Promise<string>} content - The content to be rendered, which can be either a string or a Promise resolving to a string.
|
|
842
|
+
* @returns {Response | Promise<Response>} - The response after rendering the content, which can be either a Response or a Promise resolving to a Response.
|
|
843
|
+
*/
|
|
844
|
+
interface DefaultRenderer {
|
|
845
|
+
(content: string | Promise<string>): Response | Promise<Response>;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Renderer type which can either be a ContextRenderer or DefaultRenderer.
|
|
849
|
+
*/
|
|
850
|
+
type Renderer = ContextRenderer extends Function ? ContextRenderer : DefaultRenderer;
|
|
851
|
+
/**
|
|
852
|
+
* Extracts the props for the renderer.
|
|
853
|
+
*/
|
|
854
|
+
type PropsForRenderer = [...Required<Parameters<Renderer>>] extends [unknown, infer Props] ? Props : unknown;
|
|
855
|
+
type Layout<T = Record<string, any>> = (props: T) => any;
|
|
856
|
+
/**
|
|
857
|
+
* Interface for getting context variables.
|
|
858
|
+
*
|
|
859
|
+
* @template E - Environment type.
|
|
860
|
+
*/
|
|
861
|
+
interface Get<E extends Env> {
|
|
862
|
+
<Key extends keyof E['Variables']>(key: Key): E['Variables'][Key];
|
|
863
|
+
<Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key];
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Interface for setting context variables.
|
|
867
|
+
*
|
|
868
|
+
* @template E - Environment type.
|
|
869
|
+
*/
|
|
870
|
+
interface Set<E extends Env> {
|
|
871
|
+
<Key extends keyof E['Variables']>(key: Key, value: E['Variables'][Key]): void;
|
|
872
|
+
<Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Interface for creating a new response.
|
|
876
|
+
*/
|
|
877
|
+
interface NewResponse {
|
|
878
|
+
(data: Data | null, status?: StatusCode, headers?: HeaderRecord): Response;
|
|
879
|
+
(data: Data | null, init?: ResponseOrInit): Response;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Interface for responding with a body.
|
|
883
|
+
*/
|
|
884
|
+
interface BodyRespond {
|
|
885
|
+
<T extends Data, U extends ContentfulStatusCode>(data: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, 'body'>;
|
|
886
|
+
<T extends Data, U extends ContentfulStatusCode>(data: T, init?: ResponseOrInit<U>): Response & TypedResponse<T, U, 'body'>;
|
|
887
|
+
<T extends null, U extends StatusCode>(data: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<null, U, 'body'>;
|
|
888
|
+
<T extends null, U extends StatusCode>(data: T, init?: ResponseOrInit<U>): Response & TypedResponse<null, U, 'body'>;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Interface for responding with text.
|
|
892
|
+
*
|
|
893
|
+
* @interface TextRespond
|
|
894
|
+
* @template T - The type of the text content.
|
|
895
|
+
* @template U - The type of the status code.
|
|
896
|
+
*
|
|
897
|
+
* @param {T} text - The text content to be included in the response.
|
|
898
|
+
* @param {U} [status] - An optional status code for the response.
|
|
899
|
+
* @param {HeaderRecord} [headers] - An optional record of headers to include in the response.
|
|
900
|
+
*
|
|
901
|
+
* @returns {Response & TypedResponse<T, U, 'text'>} - The response after rendering the text content, typed with the provided text and status code types.
|
|
902
|
+
*/
|
|
903
|
+
interface TextRespond {
|
|
904
|
+
<T extends string, U extends ContentfulStatusCode = ContentfulStatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, 'text'>;
|
|
905
|
+
<T extends string, U extends ContentfulStatusCode = ContentfulStatusCode>(text: T, init?: ResponseOrInit<U>): Response & TypedResponse<T, U, 'text'>;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Interface for responding with JSON.
|
|
909
|
+
*
|
|
910
|
+
* @interface JSONRespond
|
|
911
|
+
* @template T - The type of the JSON value or simplified unknown type.
|
|
912
|
+
* @template U - The type of the status code.
|
|
913
|
+
*
|
|
914
|
+
* @param {T} object - The JSON object to be included in the response.
|
|
915
|
+
* @param {U} [status] - An optional status code for the response.
|
|
916
|
+
* @param {HeaderRecord} [headers] - An optional record of headers to include in the response.
|
|
917
|
+
*
|
|
918
|
+
* @returns {JSONRespondReturn<T, U>} - The response after rendering the JSON object, typed with the provided object and status code types.
|
|
919
|
+
*/
|
|
920
|
+
interface JSONRespond {
|
|
921
|
+
<T extends JSONValue | {} | InvalidJSONValue, U extends ContentfulStatusCode = ContentfulStatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>;
|
|
922
|
+
<T extends JSONValue | {} | InvalidJSONValue, U extends ContentfulStatusCode = ContentfulStatusCode>(object: T, init?: ResponseOrInit<U>): JSONRespondReturn<T, U>;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* @template T - The type of the JSON value or simplified unknown type.
|
|
926
|
+
* @template U - The type of the status code.
|
|
927
|
+
*
|
|
928
|
+
* @returns {Response & TypedResponse<JSONParsed<T>, U, 'json'>} - The response after rendering the JSON object, typed with the provided object and status code types.
|
|
929
|
+
*/
|
|
930
|
+
type JSONRespondReturn<T extends JSONValue | {} | InvalidJSONValue, U extends ContentfulStatusCode> = Response & TypedResponse<JSONParsed<T>, U, 'json'>;
|
|
931
|
+
/**
|
|
932
|
+
* Interface representing a function that responds with HTML content.
|
|
933
|
+
*
|
|
934
|
+
* @param html - The HTML content to respond with, which can be a string or a Promise that resolves to a string.
|
|
935
|
+
* @param status - (Optional) The HTTP status code for the response.
|
|
936
|
+
* @param headers - (Optional) A record of headers to include in the response.
|
|
937
|
+
* @param init - (Optional) The response initialization object.
|
|
938
|
+
*
|
|
939
|
+
* @returns A Response object or a Promise that resolves to a Response object.
|
|
940
|
+
*/
|
|
941
|
+
interface HTMLRespond {
|
|
942
|
+
<T extends string | Promise<string>>(html: T, status?: ContentfulStatusCode, headers?: HeaderRecord): T extends string ? Response : Promise<Response>;
|
|
943
|
+
<T extends string | Promise<string>>(html: T, init?: ResponseOrInit<ContentfulStatusCode>): T extends string ? Response : Promise<Response>;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Options for configuring the context.
|
|
947
|
+
*
|
|
948
|
+
* @template E - Environment type.
|
|
949
|
+
*/
|
|
950
|
+
type ContextOptions<E extends Env> = {
|
|
951
|
+
/**
|
|
952
|
+
* Bindings for the environment.
|
|
953
|
+
*/
|
|
954
|
+
env: E['Bindings'];
|
|
955
|
+
/**
|
|
956
|
+
* Execution context for the request.
|
|
957
|
+
*/
|
|
958
|
+
executionCtx?: FetchEventLike | ExecutionContext | undefined;
|
|
959
|
+
/**
|
|
960
|
+
* Handler for not found responses.
|
|
961
|
+
*/
|
|
962
|
+
notFoundHandler?: NotFoundHandler<E>;
|
|
963
|
+
matchResult?: Result<[H, RouterRoute]>;
|
|
964
|
+
path?: string;
|
|
965
|
+
};
|
|
966
|
+
interface SetHeadersOptions {
|
|
967
|
+
append?: boolean;
|
|
968
|
+
}
|
|
969
|
+
interface SetHeaders {
|
|
970
|
+
(name: 'Content-Type', value?: BaseMime, options?: SetHeadersOptions): void;
|
|
971
|
+
(name: ResponseHeader, value?: string, options?: SetHeadersOptions): void;
|
|
972
|
+
(name: string, value?: string, options?: SetHeadersOptions): void;
|
|
973
|
+
}
|
|
974
|
+
type ResponseHeadersInit = [string, string][] | Record<'Content-Type', BaseMime> | Record<ResponseHeader, string> | Record<string, string> | Headers;
|
|
975
|
+
interface ResponseInit<T extends StatusCode = StatusCode> {
|
|
976
|
+
headers?: ResponseHeadersInit;
|
|
977
|
+
status?: T;
|
|
978
|
+
statusText?: string;
|
|
979
|
+
}
|
|
980
|
+
type ResponseOrInit<T extends StatusCode = StatusCode> = ResponseInit<T> | Response;
|
|
981
|
+
declare class Context<E extends Env = any, P extends string = any, I extends Input = {}> {
|
|
982
|
+
#private;
|
|
983
|
+
/**
|
|
984
|
+
* `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.
|
|
985
|
+
*
|
|
986
|
+
*
|
|
987
|
+
* @example
|
|
988
|
+
* ```ts
|
|
989
|
+
* // Environment object for Cloudflare Workers
|
|
990
|
+
* app.get('*', async c => {
|
|
991
|
+
* const counter = c.env.COUNTER
|
|
992
|
+
* })
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
env: E['Bindings'];
|
|
996
|
+
finalized: boolean;
|
|
997
|
+
/**
|
|
998
|
+
* `.error` can get the error object from the middleware if the Handler throws an error.
|
|
999
|
+
*
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* ```ts
|
|
1003
|
+
* app.use('*', async (c, next) => {
|
|
1004
|
+
* await next()
|
|
1005
|
+
* if (c.error) {
|
|
1006
|
+
* // do something...
|
|
1007
|
+
* }
|
|
1008
|
+
* })
|
|
1009
|
+
* ```
|
|
1010
|
+
*/
|
|
1011
|
+
error: Error | undefined;
|
|
1012
|
+
/**
|
|
1013
|
+
* Creates an instance of the Context class.
|
|
1014
|
+
*
|
|
1015
|
+
* @param req - The Request object.
|
|
1016
|
+
* @param options - Optional configuration options for the context.
|
|
1017
|
+
*/
|
|
1018
|
+
constructor(req: Request, options?: ContextOptions<E>);
|
|
1019
|
+
/**
|
|
1020
|
+
* `.req` is the instance of {@link AcrylRequest}.
|
|
1021
|
+
*/
|
|
1022
|
+
get req(): AcrylRequest<P, I['out']>;
|
|
1023
|
+
/**
|
|
1024
|
+
* The FetchEvent associated with the current request.
|
|
1025
|
+
*
|
|
1026
|
+
* @throws Will throw an error if the context does not have a FetchEvent.
|
|
1027
|
+
*/
|
|
1028
|
+
get event(): FetchEventLike;
|
|
1029
|
+
/**
|
|
1030
|
+
* The ExecutionContext associated with the current request.
|
|
1031
|
+
*
|
|
1032
|
+
* @throws Will throw an error if the context does not have an ExecutionContext.
|
|
1033
|
+
*/
|
|
1034
|
+
get executionCtx(): ExecutionContext;
|
|
1035
|
+
/**
|
|
1036
|
+
* The Response object for the current request.
|
|
1037
|
+
*/
|
|
1038
|
+
get res(): Response;
|
|
1039
|
+
/**
|
|
1040
|
+
* Sets the Response object for the current request.
|
|
1041
|
+
*
|
|
1042
|
+
* @param _res - The Response object to set.
|
|
1043
|
+
*/
|
|
1044
|
+
set res(_res: Response | undefined);
|
|
1045
|
+
/**
|
|
1046
|
+
* `.render()` can create a response within a layout.
|
|
1047
|
+
*
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```ts
|
|
1051
|
+
* app.get('/', (c) => {
|
|
1052
|
+
* return c.render('Hello!')
|
|
1053
|
+
* })
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
render: Renderer;
|
|
1057
|
+
/**
|
|
1058
|
+
* Sets the layout for the response.
|
|
1059
|
+
*
|
|
1060
|
+
* @param layout - The layout to set.
|
|
1061
|
+
* @returns The layout function.
|
|
1062
|
+
*/
|
|
1063
|
+
setLayout: (layout: Layout<PropsForRenderer & {
|
|
1064
|
+
Layout: Layout;
|
|
1065
|
+
}>) => Layout<PropsForRenderer & {
|
|
1066
|
+
Layout: Layout;
|
|
1067
|
+
}>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Gets the current layout for the response.
|
|
1070
|
+
*
|
|
1071
|
+
* @returns The current layout function.
|
|
1072
|
+
*/
|
|
1073
|
+
getLayout: () => Layout<PropsForRenderer & {
|
|
1074
|
+
Layout: Layout;
|
|
1075
|
+
}> | undefined;
|
|
1076
|
+
/**
|
|
1077
|
+
* `.setRenderer()` can set the layout in the custom middleware.
|
|
1078
|
+
*
|
|
1079
|
+
*
|
|
1080
|
+
* @example
|
|
1081
|
+
* ```tsx
|
|
1082
|
+
* app.use('*', async (c, next) => {
|
|
1083
|
+
* c.setRenderer((content) => {
|
|
1084
|
+
* return c.html(
|
|
1085
|
+
* <html>
|
|
1086
|
+
* <body>
|
|
1087
|
+
* <p>{content}</p>
|
|
1088
|
+
* </body>
|
|
1089
|
+
* </html>
|
|
1090
|
+
* )
|
|
1091
|
+
* })
|
|
1092
|
+
* await next()
|
|
1093
|
+
* })
|
|
1094
|
+
* ```
|
|
1095
|
+
*/
|
|
1096
|
+
setRenderer: (renderer: Renderer) => void;
|
|
1097
|
+
/**
|
|
1098
|
+
* `.header()` can set headers.
|
|
1099
|
+
*
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* ```ts
|
|
1103
|
+
* app.get('/welcome', (c) => {
|
|
1104
|
+
* // Set headers
|
|
1105
|
+
* c.header('X-Message', 'Hello!')
|
|
1106
|
+
* c.header('Content-Type', 'text/plain')
|
|
1107
|
+
*
|
|
1108
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
1109
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
1110
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
1111
|
+
*
|
|
1112
|
+
* return c.body('Thank you for coming')
|
|
1113
|
+
* })
|
|
1114
|
+
* ```
|
|
1115
|
+
*/
|
|
1116
|
+
header: SetHeaders;
|
|
1117
|
+
status: (status: StatusCode) => void;
|
|
1118
|
+
/**
|
|
1119
|
+
* `.set()` can set the value specified by the key.
|
|
1120
|
+
*
|
|
1121
|
+
*
|
|
1122
|
+
* @example
|
|
1123
|
+
* ```ts
|
|
1124
|
+
* app.use('*', async (c, next) => {
|
|
1125
|
+
* c.set('message', 'Acryl is hot!!')
|
|
1126
|
+
* await next()
|
|
1127
|
+
* })
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1130
|
+
set: Set<IsAny<E> extends true ? {
|
|
1131
|
+
Variables: ContextVariableMap & Record<PropertyKey, any>;
|
|
1132
|
+
} : E>;
|
|
1133
|
+
/**
|
|
1134
|
+
* `.get()` can use the value specified by the key.
|
|
1135
|
+
*
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* app.get('/', (c) => {
|
|
1140
|
+
* const message = c.get('message')
|
|
1141
|
+
* return c.text(`The message is "${message}"`)
|
|
1142
|
+
* })
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
get: Get<IsAny<E> extends true ? {
|
|
1146
|
+
Variables: ContextVariableMap & Record<PropertyKey, any>;
|
|
1147
|
+
} : E>;
|
|
1148
|
+
/**
|
|
1149
|
+
* `.var` can access the value of a variable.
|
|
1150
|
+
*
|
|
1151
|
+
*
|
|
1152
|
+
* @example
|
|
1153
|
+
* ```ts
|
|
1154
|
+
* const result = c.var.client.oneMethod()
|
|
1155
|
+
* ```
|
|
1156
|
+
*/
|
|
1157
|
+
get var(): Readonly<ContextVariableMap & (IsAny<E['Variables']> extends true ? Record<string, any> : E['Variables'])>;
|
|
1158
|
+
newResponse: NewResponse;
|
|
1159
|
+
/**
|
|
1160
|
+
* `.body()` can return the HTTP response.
|
|
1161
|
+
* You can set headers with `.header()` and set HTTP status code with `.status`.
|
|
1162
|
+
* This can also be set in `.text()`, `.json()` and so on.
|
|
1163
|
+
*
|
|
1164
|
+
*
|
|
1165
|
+
* @example
|
|
1166
|
+
* ```ts
|
|
1167
|
+
* app.get('/welcome', (c) => {
|
|
1168
|
+
* // Set headers
|
|
1169
|
+
* c.header('X-Message', 'Hello!')
|
|
1170
|
+
* c.header('Content-Type', 'text/plain')
|
|
1171
|
+
* // Set HTTP status code
|
|
1172
|
+
* c.status(201)
|
|
1173
|
+
*
|
|
1174
|
+
* // Return the response body
|
|
1175
|
+
* return c.body('Thank you for coming')
|
|
1176
|
+
* })
|
|
1177
|
+
* ```
|
|
1178
|
+
*/
|
|
1179
|
+
body: BodyRespond;
|
|
1180
|
+
/**
|
|
1181
|
+
* `.text()` can render text as `Content-Type:text/plain`.
|
|
1182
|
+
*
|
|
1183
|
+
*
|
|
1184
|
+
* @example
|
|
1185
|
+
* ```ts
|
|
1186
|
+
* app.get('/say', (c) => {
|
|
1187
|
+
* return c.text('Hello!')
|
|
1188
|
+
* })
|
|
1189
|
+
* ```
|
|
1190
|
+
*/
|
|
1191
|
+
text: TextRespond;
|
|
1192
|
+
/**
|
|
1193
|
+
* `.json()` can render JSON as `Content-Type:application/json`.
|
|
1194
|
+
*
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```ts
|
|
1198
|
+
* app.get('/api', (c) => {
|
|
1199
|
+
* return c.json({ message: 'Hello!' })
|
|
1200
|
+
* })
|
|
1201
|
+
* ```
|
|
1202
|
+
*/
|
|
1203
|
+
json: JSONRespond;
|
|
1204
|
+
html: HTMLRespond;
|
|
1205
|
+
/**
|
|
1206
|
+
* `.redirect()` can Redirect, default status code is 302.
|
|
1207
|
+
*
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```ts
|
|
1211
|
+
* app.get('/redirect', (c) => {
|
|
1212
|
+
* return c.redirect('/')
|
|
1213
|
+
* })
|
|
1214
|
+
* app.get('/redirect-permanently', (c) => {
|
|
1215
|
+
* return c.redirect('/', 301)
|
|
1216
|
+
* })
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
1219
|
+
redirect: <T extends RedirectStatusCode = 302>(location: string | URL, status?: T) => Response & TypedResponse<undefined, T, "redirect">;
|
|
1220
|
+
/**
|
|
1221
|
+
* `.notFound()` can return the Not Found Response.
|
|
1222
|
+
*
|
|
1223
|
+
*
|
|
1224
|
+
* @example
|
|
1225
|
+
* ```ts
|
|
1226
|
+
* app.get('/notfound', (c) => {
|
|
1227
|
+
* return c.notFound()
|
|
1228
|
+
* })
|
|
1229
|
+
* ```
|
|
1230
|
+
*/
|
|
1231
|
+
notFound: () => ReturnType<NotFoundHandler>;
|
|
1232
|
+
}
|
|
1233
|
+
//#endregion
|
|
1234
|
+
export { Acryl as $, Input as A, NotFoundResponse as B, FetchEventLike as C, Handler as D, HTTPResponseError as E, MergeSchemaPath as F, RemoveQuestion as G, ParamKeyToRecord as H, MiddlewareHandler as I, Schema as J, ResponseFormat as K, MiddlewareHandlerInterface as L, IntersectNonAnyTypes as M, KnownResponseFormat as N, HandlerInterface as O, MergePath as P, Variables as Q, Next as R, ExtractSchemaForStatusCode as S, H as T, ParamKeys as U, OnHandlerInterface as V, ParsedFormValue as W, TypedResponse as X, ToSchema as Y, ValidationTargets as Z, Env as _, ExecutionContext as a, ExtractInput as b, BodyData as c, AddParam as d, AcrylOptions as et, Bindings as f, Endpoint as g, BlankSchema as h, Data as i, InputToDataByTarget as j, HandlerResponse as k, ParseBodyOptions as l, BlankInput as m, ContextRenderer as n, AcrylRequest as o, BlankEnv as p, RouterRoute as q, ContextVariableMap as r, cloneRawRequest as s, Context as t, parseBody as u, ErrorHandler as v, FormValue as w, ExtractSchema as x, ExtractHandlerResponse as y, NotFoundHandler as z };
|