elysia 1.4.28 → 2.0.0-beta.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/dist/_virtual/_rolldown/runtime.js +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +38 -0
- package/dist/adapter/bun/index.d.ts +7 -6
- package/dist/adapter/bun/index.js +219 -380
- package/dist/adapter/bun/index.mjs +217 -382
- package/dist/adapter/constants.d.ts +6 -0
- package/dist/adapter/constants.js +10 -0
- package/dist/adapter/constants.mjs +9 -0
- package/dist/adapter/default-headers.d.ts +4 -0
- package/dist/adapter/default-headers.js +7 -0
- package/dist/adapter/default-headers.mjs +5 -0
- package/dist/adapter/index.d.ts +8 -1
- package/dist/adapter/index.js +7 -14
- package/dist/adapter/index.mjs +5 -0
- package/dist/adapter/origin.d.ts +63 -0
- package/dist/adapter/origin.js +64 -0
- package/dist/adapter/origin.mjs +62 -0
- package/dist/adapter/response-ownership.d.ts +5 -0
- package/dist/adapter/response-ownership.js +13 -0
- package/dist/adapter/response-ownership.mjs +10 -0
- package/dist/adapter/skip-clone.d.ts +4 -0
- package/dist/adapter/skip-clone.js +7 -0
- package/dist/adapter/skip-clone.mjs +5 -0
- package/dist/adapter/types.d.ts +50 -125
- package/dist/adapter/types.js +1 -14
- package/dist/adapter/types.mjs +1 -0
- package/dist/adapter/utils.d.ts +47 -19
- package/dist/adapter/utils.js +561 -311
- package/dist/adapter/utils.mjs +551 -283
- package/dist/adapter/web-standard/handler.d.ts +11 -9
- package/dist/adapter/web-standard/handler.js +146 -415
- package/dist/adapter/web-standard/handler.mjs +144 -400
- package/dist/adapter/web-standard/index.d.ts +5 -2
- package/dist/adapter/web-standard/index.js +68 -161
- package/dist/adapter/web-standard/index.mjs +68 -146
- package/dist/adapter/web-standard/utils.d.ts +4 -0
- package/dist/adapter/web-standard/utils.js +153 -0
- package/dist/adapter/web-standard/utils.mjs +152 -0
- package/dist/base.d.ts +898 -0
- package/dist/base.js +1564 -0
- package/dist/base.mjs +1561 -0
- package/dist/compile/analysis-cache.d.ts +6 -0
- package/dist/compile/analysis-cache.js +12 -0
- package/dist/compile/analysis-cache.mjs +11 -0
- package/dist/compile/aot-capture.d.ts +24 -0
- package/dist/compile/aot-capture.js +376 -0
- package/dist/compile/aot-capture.mjs +365 -0
- package/dist/compile/aot-emit.d.ts +29 -0
- package/dist/compile/aot-emit.js +107 -0
- package/dist/compile/aot-emit.mjs +101 -0
- package/dist/compile/aot-reconstruct.d.ts +30 -0
- package/dist/compile/aot-reconstruct.js +156 -0
- package/dist/compile/aot-reconstruct.mjs +147 -0
- package/dist/compile/aot.d.ts +287 -0
- package/dist/compile/aot.js +220 -0
- package/dist/compile/aot.mjs +200 -0
- package/dist/compile/handler/descriptor.d.ts +77 -0
- package/dist/compile/handler/descriptor.js +199 -0
- package/dist/compile/handler/descriptor.mjs +194 -0
- package/dist/compile/handler/frozen-validator.d.ts +39 -0
- package/dist/compile/handler/frozen-validator.js +319 -0
- package/dist/compile/handler/frozen-validator.mjs +313 -0
- package/dist/compile/handler/index.d.ts +19 -0
- package/dist/compile/handler/index.js +379 -0
- package/dist/compile/handler/index.mjs +371 -0
- package/dist/compile/handler/jit.d.ts +43 -0
- package/dist/compile/handler/jit.js +536 -0
- package/dist/compile/handler/jit.mjs +532 -0
- package/dist/compile/handler/params.d.ts +28 -0
- package/dist/compile/handler/params.js +78 -0
- package/dist/compile/handler/params.mjs +76 -0
- package/dist/compile/handler/reconstruct.d.ts +12 -0
- package/dist/compile/handler/reconstruct.js +50 -0
- package/dist/compile/handler/reconstruct.mjs +49 -0
- package/dist/compile/handler/utils.d.ts +45 -0
- package/dist/compile/handler/utils.js +514 -0
- package/dist/compile/handler/utils.mjs +498 -0
- package/dist/compile/jit-probe.d.ts +15 -0
- package/dist/compile/jit-probe.js +28 -0
- package/dist/compile/jit-probe.mjs +26 -0
- package/dist/compile/lexer.d.ts +7 -0
- package/dist/compile/lexer.js +53 -0
- package/dist/compile/lexer.mjs +48 -0
- package/dist/compile/utils.d.ts +8 -0
- package/dist/compile/utils.js +23 -0
- package/dist/compile/utils.mjs +19 -0
- package/dist/compiled.d.ts +17 -0
- package/dist/compiled.js +20 -0
- package/dist/compiled.mjs +16 -0
- package/dist/constants.d.ts +137 -0
- package/dist/constants.js +96 -0
- package/dist/constants.mjs +88 -0
- package/dist/context.d.ts +86 -129
- package/dist/context.js +110 -13
- package/dist/context.mjs +108 -0
- package/dist/cookie/config.d.ts +31 -0
- package/dist/cookie/config.js +98 -0
- package/dist/cookie/config.mjs +95 -0
- package/dist/cookie/cookie.d.ts +26 -0
- package/dist/cookie/cookie.js +105 -0
- package/dist/cookie/cookie.mjs +104 -0
- package/dist/cookie/crypto.d.ts +20 -0
- package/dist/cookie/crypto.js +168 -0
- package/dist/cookie/crypto.mjs +151 -0
- package/dist/cookie/error.d.ts +17 -0
- package/dist/cookie/error.js +25 -0
- package/dist/cookie/error.mjs +24 -0
- package/dist/cookie/index.d.ts +7 -0
- package/dist/cookie/index.js +13 -0
- package/dist/cookie/index.mjs +7 -0
- package/dist/cookie/lib.d.ts +7 -0
- package/dist/cookie/lib.js +76 -0
- package/dist/cookie/lib.mjs +74 -0
- package/dist/cookie/serialize.d.ts +6 -0
- package/dist/cookie/serialize.js +32 -0
- package/dist/cookie/serialize.mjs +31 -0
- package/dist/cookie/types.d.ts +113 -0
- package/dist/cookie/types.js +1 -0
- package/dist/cookie/types.mjs +1 -0
- package/dist/cookie/utils.d.ts +25 -0
- package/dist/cookie/utils.js +182 -0
- package/dist/cookie/utils.mjs +171 -0
- package/dist/error.d.ts +226 -188
- package/dist/error.js +519 -357
- package/dist/error.mjs +503 -327
- package/dist/generation.d.ts +30 -0
- package/dist/generation.js +23 -0
- package/dist/generation.mjs +17 -0
- package/dist/handler/error.d.ts +7 -0
- package/dist/handler/error.js +105 -0
- package/dist/handler/error.mjs +104 -0
- package/dist/handler/fetch.d.ts +8 -0
- package/dist/handler/fetch.js +371 -0
- package/dist/handler/fetch.mjs +367 -0
- package/dist/handler/index.d.ts +2 -0
- package/dist/handler/index.js +5 -0
- package/dist/handler/index.mjs +3 -0
- package/dist/handler/utils.d.ts +15 -0
- package/dist/handler/utils.js +48 -0
- package/dist/handler/utils.mjs +42 -0
- package/dist/index.d.ts +23 -2198
- package/dist/index.js +62 -1948
- package/dist/index.mjs +20 -1986
- package/dist/memory.d.ts +4 -0
- package/dist/memory.js +17 -0
- package/dist/memory.mjs +16 -0
- package/dist/package.js +11 -0
- package/dist/package.mjs +5 -0
- package/dist/parse-query.d.ts +7 -9
- package/dist/parse-query.js +154 -164
- package/dist/parse-query.mjs +150 -133
- package/dist/plugin/aot/bun.d.ts +26 -0
- package/dist/plugin/aot/bun.js +35 -0
- package/dist/plugin/aot/bun.mjs +34 -0
- package/dist/plugin/aot/core.d.ts +291 -0
- package/dist/plugin/aot/core.js +505 -0
- package/dist/plugin/aot/core.mjs +481 -0
- package/dist/plugin/aot/esbuild.d.ts +28 -0
- package/dist/plugin/aot/esbuild.js +48 -0
- package/dist/plugin/aot/esbuild.mjs +46 -0
- package/dist/plugin/aot/hooks.d.ts +28 -0
- package/dist/plugin/aot/hooks.js +114 -0
- package/dist/plugin/aot/hooks.mjs +112 -0
- package/dist/plugin/aot/rspack-loader.d.ts +23 -0
- package/dist/plugin/aot/rspack-loader.js +44 -0
- package/dist/plugin/aot/rspack-loader.mjs +40 -0
- package/dist/plugin/aot/rspack.d.ts +23 -0
- package/dist/plugin/aot/rspack.js +85 -0
- package/dist/plugin/aot/rspack.mjs +82 -0
- package/dist/plugin/aot/source.d.ts +60 -0
- package/dist/plugin/aot/source.js +422 -0
- package/dist/plugin/aot/source.mjs +418 -0
- package/dist/plugin/aot/treeshake.d.ts +4 -0
- package/dist/plugin/aot/treeshake.js +95 -0
- package/dist/plugin/aot/treeshake.mjs +94 -0
- package/dist/plugin/aot/unplugin.d.ts +50 -0
- package/dist/plugin/aot/unplugin.js +64 -0
- package/dist/plugin/aot/unplugin.mjs +62 -0
- package/dist/plugin/aot/vite.d.ts +30 -0
- package/dist/plugin/aot/vite.js +34 -0
- package/dist/plugin/aot/vite.mjs +33 -0
- package/dist/plugin/aot/worker.d.ts +1 -0
- package/dist/plugin/aot/worker.js +28 -0
- package/dist/plugin/aot/worker.mjs +27 -0
- package/dist/plugin/auto-head.d.ts +6 -0
- package/dist/plugin/auto-head.js +38 -0
- package/dist/plugin/auto-head.mjs +36 -0
- package/dist/plugin/trace.d.ts +10 -0
- package/dist/plugin/trace.js +39 -0
- package/dist/plugin/trace.mjs +36 -0
- package/dist/plugin/websocket.d.ts +6 -0
- package/dist/plugin/websocket.js +61 -0
- package/dist/plugin/websocket.mjs +60 -0
- package/dist/route-table.d.ts +28 -0
- package/dist/route-table.js +64 -0
- package/dist/route-table.mjs +61 -0
- package/dist/schema-snapshot.d.ts +9 -0
- package/dist/schema-snapshot.js +271 -0
- package/dist/schema-snapshot.mjs +269 -0
- package/dist/sucrose.d.ts +28 -63
- package/dist/sucrose.js +814 -306
- package/dist/sucrose.mjs +805 -274
- package/dist/trace.d.ts +145 -130
- package/dist/trace.js +387 -135
- package/dist/trace.mjs +385 -113
- package/dist/type/bridge-live.d.ts +15 -0
- package/dist/type/bridge-live.js +39 -0
- package/dist/type/bridge-live.mjs +17 -0
- package/dist/type/bridge.d.ts +56 -0
- package/dist/type/bridge.js +180 -0
- package/dist/type/bridge.mjs +63 -0
- package/dist/type/coerce-plan.d.ts +38 -0
- package/dist/type/coerce-plan.js +107 -0
- package/dist/type/coerce-plan.mjs +98 -0
- package/dist/type/coerce.d.ts +43 -0
- package/dist/type/coerce.js +351 -0
- package/dist/type/coerce.mjs +339 -0
- package/dist/type/compat.d.ts +8 -0
- package/dist/type/compat.js +46 -0
- package/dist/type/compat.mjs +44 -0
- package/dist/type/constants.d.ts +25 -0
- package/dist/type/constants.js +36 -0
- package/dist/type/constants.mjs +32 -0
- package/dist/type/elysia/accelerate.d.ts +6 -0
- package/dist/type/elysia/accelerate.js +12 -0
- package/dist/type/elysia/accelerate.mjs +10 -0
- package/dist/type/elysia/array-buffer.d.ts +6 -0
- package/dist/type/elysia/array-buffer.js +27 -0
- package/dist/type/elysia/array-buffer.mjs +25 -0
- package/dist/type/elysia/array-string.d.ts +7 -0
- package/dist/type/elysia/array-string.js +28 -0
- package/dist/type/elysia/array-string.mjs +26 -0
- package/dist/type/elysia/array.d.ts +6 -0
- package/dist/type/elysia/array.js +32 -0
- package/dist/type/elysia/array.mjs +31 -0
- package/dist/type/elysia/boolean-string.d.ts +6 -0
- package/dist/type/elysia/boolean-string.js +24 -0
- package/dist/type/elysia/boolean-string.mjs +22 -0
- package/dist/type/elysia/boolean.d.ts +6 -0
- package/dist/type/elysia/boolean.js +20 -0
- package/dist/type/elysia/boolean.mjs +18 -0
- package/dist/type/elysia/cookie.d.ts +15 -0
- package/dist/type/elysia/cookie.js +51 -0
- package/dist/type/elysia/cookie.mjs +50 -0
- package/dist/type/elysia/date.d.ts +7 -0
- package/dist/type/elysia/date.js +98 -0
- package/dist/type/elysia/date.mjs +96 -0
- package/dist/type/elysia/file-type.d.ts +25 -0
- package/dist/type/elysia/file-type.js +81 -0
- package/dist/type/elysia/file-type.mjs +71 -0
- package/dist/type/elysia/file.d.ts +9 -0
- package/dist/type/elysia/file.js +64 -0
- package/dist/type/elysia/file.mjs +48 -0
- package/dist/type/elysia/files.d.ts +8 -0
- package/dist/type/elysia/files.js +45 -0
- package/dist/type/elysia/files.mjs +43 -0
- package/dist/type/elysia/form.d.ts +8 -0
- package/dist/type/elysia/form.js +17 -0
- package/dist/type/elysia/form.mjs +15 -0
- package/dist/type/elysia/integer-string.d.ts +7 -0
- package/dist/type/elysia/integer-string.js +40 -0
- package/dist/type/elysia/integer-string.mjs +38 -0
- package/dist/type/elysia/integer.d.ts +6 -0
- package/dist/type/elysia/integer.js +20 -0
- package/dist/type/elysia/integer.mjs +18 -0
- package/dist/type/elysia/intersect.d.ts +6 -0
- package/dist/type/elysia/intersect.js +20 -0
- package/dist/type/elysia/intersect.mjs +19 -0
- package/dist/type/elysia/maybe-empty.d.ts +7 -0
- package/dist/type/elysia/maybe-empty.js +21 -0
- package/dist/type/elysia/maybe-empty.mjs +19 -0
- package/dist/type/elysia/no-validate.d.ts +6 -0
- package/dist/type/elysia/no-validate.js +9 -0
- package/dist/type/elysia/no-validate.mjs +8 -0
- package/dist/type/elysia/nullable.d.ts +7 -0
- package/dist/type/elysia/nullable.js +15 -0
- package/dist/type/elysia/nullable.mjs +13 -0
- package/dist/type/elysia/number.d.ts +6 -0
- package/dist/type/elysia/number.js +20 -0
- package/dist/type/elysia/number.mjs +18 -0
- package/dist/type/elysia/numeric-enum.d.ts +11 -0
- package/dist/type/elysia/numeric-enum.js +26 -0
- package/dist/type/elysia/numeric-enum.mjs +24 -0
- package/dist/type/elysia/numeric.d.ts +7 -0
- package/dist/type/elysia/numeric.js +62 -0
- package/dist/type/elysia/numeric.mjs +60 -0
- package/dist/type/elysia/object-string.d.ts +7 -0
- package/dist/type/elysia/object-string.js +28 -0
- package/dist/type/elysia/object-string.mjs +26 -0
- package/dist/type/elysia/object.d.ts +6 -0
- package/dist/type/elysia/object.js +47 -0
- package/dist/type/elysia/object.mjs +46 -0
- package/dist/type/elysia/optional.d.ts +6 -0
- package/dist/type/elysia/optional.js +22 -0
- package/dist/type/elysia/optional.mjs +21 -0
- package/dist/type/elysia/string.d.ts +6 -0
- package/dist/type/elysia/string.js +43 -0
- package/dist/type/elysia/string.mjs +41 -0
- package/dist/type/elysia/uint8-array.d.ts +6 -0
- package/dist/type/elysia/uint8-array.js +27 -0
- package/dist/type/elysia/uint8-array.mjs +25 -0
- package/dist/type/elysia/union-enum.d.ts +8 -0
- package/dist/type/elysia/union-enum.js +31 -0
- package/dist/type/elysia/union-enum.mjs +29 -0
- package/dist/type/elysia/union.d.ts +6 -0
- package/dist/type/elysia/union.js +20 -0
- package/dist/type/elysia/union.mjs +19 -0
- package/dist/type/elysia/utils.d.ts +53 -0
- package/dist/type/elysia/utils.js +98 -0
- package/dist/type/elysia/utils.mjs +88 -0
- package/dist/type/exports.d.ts +36 -0
- package/dist/type/exports.js +68 -0
- package/dist/type/exports.mjs +36 -0
- package/dist/type/index.d.ts +13 -0
- package/dist/type/index.js +81 -0
- package/dist/type/index.mjs +68 -0
- package/dist/type/shared.d.ts +27 -0
- package/dist/type/shared.js +171 -0
- package/dist/type/shared.mjs +161 -0
- package/dist/type/types.d.ts +206 -0
- package/dist/type/types.js +1 -0
- package/dist/type/types.mjs +1 -0
- package/dist/type/utils.d.ts +7 -0
- package/dist/type/utils.js +43 -0
- package/dist/type/utils.mjs +41 -0
- package/dist/type/validator/clean-safe.d.ts +8 -0
- package/dist/type/validator/clean-safe.js +82 -0
- package/dist/type/validator/clean-safe.mjs +77 -0
- package/dist/type/validator/custom-error.d.ts +10 -0
- package/dist/type/validator/custom-error.js +191 -0
- package/dist/type/validator/custom-error.mjs +188 -0
- package/dist/type/validator/default-precompute.d.ts +26 -0
- package/dist/type/validator/default-precompute.js +432 -0
- package/dist/type/validator/default-precompute.mjs +421 -0
- package/dist/type/validator/exact-mirror.d.ts +7 -0
- package/dist/type/validator/exact-mirror.js +19 -0
- package/dist/type/validator/exact-mirror.mjs +15 -0
- package/dist/type/validator/frozen-check.d.ts +11 -0
- package/dist/type/validator/frozen-check.js +20 -0
- package/dist/type/validator/frozen-check.mjs +19 -0
- package/dist/type/validator/index.d.ts +32 -0
- package/dist/type/validator/index.js +657 -0
- package/dist/type/validator/index.mjs +651 -0
- package/dist/type/validator/string-codec-aot.d.ts +8 -0
- package/dist/type/validator/string-codec-aot.js +68 -0
- package/dist/type/validator/string-codec-aot.mjs +66 -0
- package/dist/type/validator/validator-cache.d.ts +26 -0
- package/dist/type/validator/validator-cache.js +247 -0
- package/dist/type/validator/validator-cache.mjs +242 -0
- package/dist/types.d.ts +938 -1235
- package/dist/types.js +1 -14
- package/dist/types.mjs +1 -0
- package/dist/universal/constants.d.ts +6 -0
- package/dist/universal/constants.js +19 -0
- package/dist/universal/constants.mjs +15 -0
- package/dist/universal/env.d.ts +5 -1
- package/dist/universal/env.js +12 -26
- package/dist/universal/env.mjs +10 -5
- package/dist/universal/file.d.ts +55 -86
- package/dist/universal/file.js +116 -157
- package/dist/universal/file.mjs +111 -132
- package/dist/universal/index.d.ts +5 -3
- package/dist/universal/index.js +8 -27
- package/dist/universal/index.mjs +4 -5
- package/dist/universal/is-production.d.ts +5 -0
- package/dist/universal/is-production.js +10 -0
- package/dist/universal/is-production.mjs +8 -0
- package/dist/universal/server.d.ts +318 -313
- package/dist/universal/server.js +1 -14
- package/dist/universal/server.mjs +1 -0
- package/dist/utils.d.ts +162 -191
- package/dist/utils.js +732 -693
- package/dist/utils.mjs +683 -631
- package/dist/validator/index.d.ts +63 -0
- package/dist/validator/index.js +299 -0
- package/dist/validator/index.mjs +296 -0
- package/dist/validator/route.d.ts +32 -0
- package/dist/validator/route.js +51 -0
- package/dist/validator/route.mjs +50 -0
- package/dist/ws/context.d.ts +49 -0
- package/dist/ws/context.js +152 -0
- package/dist/ws/context.mjs +150 -0
- package/dist/ws/index.d.ts +5 -77
- package/dist/ws/index.js +11 -180
- package/dist/ws/index.mjs +5 -157
- package/dist/ws/parser.d.ts +5 -0
- package/dist/ws/parser.js +69 -0
- package/dist/ws/parser.mjs +66 -0
- package/dist/ws/route.d.ts +16 -0
- package/dist/ws/route.js +560 -0
- package/dist/ws/route.mjs +554 -0
- package/dist/ws/types.d.ts +154 -57
- package/dist/ws/types.js +1 -14
- package/dist/ws/types.mjs +1 -0
- package/package.json +179 -120
- package/bunfig.toml +0 -2
- package/dist/adapter/bun/compose.d.ts +0 -3
- package/dist/adapter/bun/compose.js +0 -90
- package/dist/adapter/bun/compose.mjs +0 -74
- package/dist/adapter/bun/handler-native.d.ts +0 -3
- package/dist/adapter/bun/handler-native.js +0 -42
- package/dist/adapter/bun/handler-native.mjs +0 -22
- package/dist/adapter/bun/handler.d.ts +0 -7
- package/dist/adapter/bun/handler.js +0 -363
- package/dist/adapter/bun/handler.mjs +0 -346
- package/dist/adapter/cloudflare-worker/index.d.ts +0 -20
- package/dist/adapter/cloudflare-worker/index.js +0 -59
- package/dist/adapter/cloudflare-worker/index.mjs +0 -39
- package/dist/compose.d.ts +0 -30
- package/dist/compose.js +0 -1324
- package/dist/compose.mjs +0 -1336
- package/dist/cookies.d.ts +0 -158
- package/dist/cookies.js +0 -250
- package/dist/cookies.mjs +0 -221
- package/dist/dynamic-handle.d.ts +0 -15
- package/dist/dynamic-handle.js +0 -521
- package/dist/dynamic-handle.mjs +0 -509
- package/dist/formats.d.ts +0 -79
- package/dist/formats.js +0 -153
- package/dist/formats.mjs +0 -132
- package/dist/manifest.d.ts +0 -0
- package/dist/manifest.js +0 -1
- package/dist/manifest.mjs +0 -0
- package/dist/replace-schema.d.ts +0 -60
- package/dist/replace-schema.js +0 -140
- package/dist/replace-schema.mjs +0 -115
- package/dist/schema.d.ts +0 -107
- package/dist/schema.js +0 -833
- package/dist/schema.mjs +0 -814
- package/dist/type-system/format.d.ts +0 -55
- package/dist/type-system/format.js +0 -197
- package/dist/type-system/format.mjs +0 -175
- package/dist/type-system/index.d.ts +0 -45
- package/dist/type-system/index.js +0 -406
- package/dist/type-system/index.mjs +0 -394
- package/dist/type-system/types.d.ts +0 -155
- package/dist/type-system/types.js +0 -14
- package/dist/type-system/types.mjs +0 -0
- package/dist/type-system/utils.d.ts +0 -62
- package/dist/type-system/utils.js +0 -141
- package/dist/type-system/utils.mjs +0 -111
- package/dist/universal/request.d.ts +0 -29
- package/dist/universal/request.js +0 -126
- package/dist/universal/request.mjs +0 -105
- package/dist/universal/types.d.ts +0 -124
- package/dist/universal/types.js +0 -41
- package/dist/universal/types.mjs +0 -19
- package/dist/universal/utils.d.ts +0 -3
- package/dist/universal/utils.js +0 -41
- package/dist/universal/utils.mjs +0 -18
- package/dist/ws/bun.d.ts +0 -419
- package/dist/ws/bun.js +0 -14
- package/dist/ws/bun.mjs +0 -0
- package/knip.json +0 -22
package/dist/index.d.ts
CHANGED
|
@@ -1,2198 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export default class Elysia<const in out BasePath extends string = '', const in out Singleton extends SingletonBase = {
|
|
27
|
-
decorator: {};
|
|
28
|
-
store: {};
|
|
29
|
-
derive: {};
|
|
30
|
-
resolve: {};
|
|
31
|
-
}, const in out Definitions extends DefinitionBase = {
|
|
32
|
-
typebox: {};
|
|
33
|
-
error: {};
|
|
34
|
-
}, const in out Metadata extends MetadataBase = {
|
|
35
|
-
schema: {};
|
|
36
|
-
standaloneSchema: {};
|
|
37
|
-
macro: {};
|
|
38
|
-
macroFn: {};
|
|
39
|
-
parser: {};
|
|
40
|
-
response: {};
|
|
41
|
-
}, const in out Routes extends RouteBase = {}, const in out Ephemeral extends EphemeralType = {
|
|
42
|
-
derive: {};
|
|
43
|
-
resolve: {};
|
|
44
|
-
schema: {};
|
|
45
|
-
standaloneSchema: {};
|
|
46
|
-
response: {};
|
|
47
|
-
}, const in out Volatile extends EphemeralType = {
|
|
48
|
-
derive: {};
|
|
49
|
-
resolve: {};
|
|
50
|
-
schema: {};
|
|
51
|
-
standaloneSchema: {};
|
|
52
|
-
response: {};
|
|
53
|
-
}> {
|
|
54
|
-
config: ElysiaConfig<BasePath>;
|
|
55
|
-
server: Server | null;
|
|
56
|
-
private dependencies;
|
|
57
|
-
'~Prefix': BasePath;
|
|
58
|
-
'~Singleton': Singleton;
|
|
59
|
-
'~Definitions': Definitions;
|
|
60
|
-
'~Metadata': Metadata;
|
|
61
|
-
'~Ephemeral': Ephemeral;
|
|
62
|
-
'~Volatile': Volatile;
|
|
63
|
-
'~Routes': Routes;
|
|
64
|
-
protected singleton: SingletonBase;
|
|
65
|
-
get store(): Singleton['store'];
|
|
66
|
-
get decorator(): Singleton['decorator'];
|
|
67
|
-
protected definitions: {
|
|
68
|
-
typebox: TModule<{}, {}>;
|
|
69
|
-
type: Record<string, TSchema | StandardSchemaV1Like>;
|
|
70
|
-
error: Record<string, Error>;
|
|
71
|
-
};
|
|
72
|
-
protected extender: {
|
|
73
|
-
macro: Macro;
|
|
74
|
-
higherOrderFunctions: HookContainer<HigherOrderFunction>[];
|
|
75
|
-
};
|
|
76
|
-
protected validator: ValidatorLayer;
|
|
77
|
-
protected standaloneValidator: StandaloneValidator;
|
|
78
|
-
event: Partial<LifeCycleStore>;
|
|
79
|
-
protected telemetry: undefined | {
|
|
80
|
-
stack: string | undefined;
|
|
81
|
-
};
|
|
82
|
-
router: Router;
|
|
83
|
-
protected routeTree: Record<string, number>;
|
|
84
|
-
get routes(): InternalRoute[];
|
|
85
|
-
protected getGlobalRoutes(): InternalRoute[];
|
|
86
|
-
protected getGlobalDefinitions(): {
|
|
87
|
-
typebox: TModule<{}, {}>;
|
|
88
|
-
type: Record<string, TSchema | StandardSchemaV1Like>;
|
|
89
|
-
error: Record<string, Error>;
|
|
90
|
-
};
|
|
91
|
-
protected inference: Sucrose.Inference;
|
|
92
|
-
private getServer;
|
|
93
|
-
private getParent;
|
|
94
|
-
'~parser': {
|
|
95
|
-
[K: string]: BodyHandler<any, any>;
|
|
96
|
-
};
|
|
97
|
-
private _promisedModules;
|
|
98
|
-
private get promisedModules();
|
|
99
|
-
constructor(config?: ElysiaConfig<BasePath>);
|
|
100
|
-
'~adapter': ElysiaAdapter;
|
|
101
|
-
env(model: TObject, _env?: NodeJS.ProcessEnv): this;
|
|
102
|
-
/**
|
|
103
|
-
* @private DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
|
104
|
-
* @version 1.1.0
|
|
105
|
-
*
|
|
106
|
-
* ! Do not use unless you know exactly what you are doing
|
|
107
|
-
* ? Add Higher order function to Elysia.fetch
|
|
108
|
-
*/
|
|
109
|
-
wrap(fn: HigherOrderFunction): this;
|
|
110
|
-
get models(): {
|
|
111
|
-
[K in keyof Definitions['typebox']]: ModelValidator<Definitions['typebox'][K]>;
|
|
112
|
-
} & {
|
|
113
|
-
modules: TModule<Extract<Definitions['typebox'], TAnySchema>> | Extract<Definitions['typebox'], StandardSchemaV1Like>;
|
|
114
|
-
};
|
|
115
|
-
private add;
|
|
116
|
-
private setHeaders?;
|
|
117
|
-
headers(header: Context['set']['headers'] | undefined): this;
|
|
118
|
-
/**
|
|
119
|
-
* ### start | Life cycle event
|
|
120
|
-
* Called after server is ready for serving
|
|
121
|
-
*
|
|
122
|
-
* ---
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* new Elysia()
|
|
126
|
-
* .onStart(({ server }) => {
|
|
127
|
-
* console.log("Running at ${server?.url}:${server?.port}")
|
|
128
|
-
* })
|
|
129
|
-
* .listen(3000)
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
onStart(handler: MaybeArray<GracefulHandler<this>>): this;
|
|
133
|
-
/**
|
|
134
|
-
* ### request | Life cycle event
|
|
135
|
-
* Called on every new request is accepted
|
|
136
|
-
*
|
|
137
|
-
* ---
|
|
138
|
-
* @example
|
|
139
|
-
* ```typescript
|
|
140
|
-
* new Elysia()
|
|
141
|
-
* .onRequest(({ method, url }) => {
|
|
142
|
-
* saveToAnalytic({ method, url })
|
|
143
|
-
* })
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
onRequest<const Schema extends RouteSchema, const Handler extends PreHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], {
|
|
147
|
-
decorator: Singleton['decorator'];
|
|
148
|
-
store: Singleton['store'];
|
|
149
|
-
derive: {};
|
|
150
|
-
resolve: {};
|
|
151
|
-
}>>(handler: Handler): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
152
|
-
derive: Volatile['derive'];
|
|
153
|
-
resolve: Volatile['resolve'];
|
|
154
|
-
schema: Volatile['schema'];
|
|
155
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
156
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
157
|
-
}>;
|
|
158
|
-
/**
|
|
159
|
-
* ### request | Life cycle event
|
|
160
|
-
* Called on every new request is accepted
|
|
161
|
-
*
|
|
162
|
-
* ---
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* new Elysia()
|
|
166
|
-
* .onRequest(({ method, url }) => {
|
|
167
|
-
* saveToAnalytic({ method, url })
|
|
168
|
-
* })
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
onRequest<const Schema extends RouteSchema, const Handlers extends PreHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], {
|
|
172
|
-
decorator: Singleton['decorator'];
|
|
173
|
-
store: Singleton['store'];
|
|
174
|
-
derive: {};
|
|
175
|
-
resolve: {};
|
|
176
|
-
}>[]>(handler: Handlers): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
177
|
-
derive: Volatile['derive'];
|
|
178
|
-
resolve: Volatile['resolve'];
|
|
179
|
-
schema: Volatile['schema'];
|
|
180
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
181
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
182
|
-
}>;
|
|
183
|
-
/**
|
|
184
|
-
* ### parse | Life cycle event
|
|
185
|
-
* Callback function to handle body parsing
|
|
186
|
-
*
|
|
187
|
-
* If truthy value is returned, will be assigned to `context.body`
|
|
188
|
-
* Otherwise will skip the callback and look for the next one.
|
|
189
|
-
*
|
|
190
|
-
* Equivalent to Express's body parser
|
|
191
|
-
*
|
|
192
|
-
* ---
|
|
193
|
-
* @example
|
|
194
|
-
* ```typescript
|
|
195
|
-
* new Elysia()
|
|
196
|
-
* .onParse((request, contentType) => {
|
|
197
|
-
* if(contentType === "application/json")
|
|
198
|
-
* return request.json()
|
|
199
|
-
* })
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
onParse<const Schema extends RouteSchema>(parser: MaybeArray<BodyHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], {
|
|
203
|
-
decorator: Singleton['decorator'];
|
|
204
|
-
store: Singleton['store'];
|
|
205
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
206
|
-
resolve: {};
|
|
207
|
-
}>>): this;
|
|
208
|
-
/**
|
|
209
|
-
* ### parse | Life cycle event
|
|
210
|
-
* Callback function to handle body parsing
|
|
211
|
-
*
|
|
212
|
-
* If truthy value is returned, will be assigned to `context.body`
|
|
213
|
-
* Otherwise will skip the callback and look for the next one.
|
|
214
|
-
*
|
|
215
|
-
* Equivalent to Express's body parser
|
|
216
|
-
*
|
|
217
|
-
* ---
|
|
218
|
-
* @example
|
|
219
|
-
* ```typescript
|
|
220
|
-
* new Elysia()
|
|
221
|
-
* .onParse((request, contentType) => {
|
|
222
|
-
* if(contentType === "application/json")
|
|
223
|
-
* return request.json()
|
|
224
|
-
* })
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
onParse<const Schema extends RouteSchema, const Type extends LifeCycleType>(options: {
|
|
228
|
-
as: Type;
|
|
229
|
-
}, parser: MaybeArray<BodyHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
230
|
-
params: {
|
|
231
|
-
[name: string]: string | undefined;
|
|
232
|
-
};
|
|
233
|
-
} : 'scoped' extends Type ? {
|
|
234
|
-
params: {
|
|
235
|
-
[name: string]: string | undefined;
|
|
236
|
-
};
|
|
237
|
-
} : {}, 'global' extends Type ? {
|
|
238
|
-
decorator: Singleton['decorator'];
|
|
239
|
-
store: Singleton['store'];
|
|
240
|
-
derive: Singleton['derive'] & Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
241
|
-
resolve: {};
|
|
242
|
-
} : 'scoped' extends Type ? {
|
|
243
|
-
decorator: Singleton['decorator'];
|
|
244
|
-
store: Singleton['store'];
|
|
245
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
246
|
-
resolve: {};
|
|
247
|
-
} : {
|
|
248
|
-
decorator: Singleton['decorator'];
|
|
249
|
-
store: Singleton['store'];
|
|
250
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
251
|
-
resolve: {};
|
|
252
|
-
}>>): this;
|
|
253
|
-
onParse<const Parsers extends keyof Metadata['parser']>(parser: Parsers): this;
|
|
254
|
-
/**
|
|
255
|
-
* ### parse | Life cycle event
|
|
256
|
-
* Callback function to handle body parsing
|
|
257
|
-
*
|
|
258
|
-
* If truthy value is returned, will be assigned to `context.body`
|
|
259
|
-
* Otherwise will skip the callback and look for the next one.
|
|
260
|
-
*
|
|
261
|
-
* Equivalent to Express's body parser
|
|
262
|
-
*
|
|
263
|
-
* ---
|
|
264
|
-
* @example
|
|
265
|
-
* ```typescript
|
|
266
|
-
* new Elysia()
|
|
267
|
-
* .onParse((request, contentType) => {
|
|
268
|
-
* if(contentType === "application/json")
|
|
269
|
-
* return request.json()
|
|
270
|
-
* })
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
parser<const Parser extends string, const Schema extends RouteSchema, const Handler extends BodyHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], {
|
|
274
|
-
decorator: Singleton['decorator'];
|
|
275
|
-
store: Singleton['store'];
|
|
276
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
277
|
-
resolve: {};
|
|
278
|
-
}>>(name: Parser, parser: Handler): Elysia<BasePath, Singleton, Definitions, {
|
|
279
|
-
schema: Metadata['schema'];
|
|
280
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
281
|
-
macro: Metadata['macro'];
|
|
282
|
-
macroFn: Metadata['macroFn'];
|
|
283
|
-
parser: Metadata['parser'] & {
|
|
284
|
-
[K in Parser]: Handler;
|
|
285
|
-
};
|
|
286
|
-
response: Metadata['response'];
|
|
287
|
-
}, Routes, Ephemeral, Volatile>;
|
|
288
|
-
/**
|
|
289
|
-
* ### transform | Life cycle event
|
|
290
|
-
* Assign or transform anything related to context before validation.
|
|
291
|
-
*
|
|
292
|
-
* ---
|
|
293
|
-
* @example
|
|
294
|
-
* ```typescript
|
|
295
|
-
* new Elysia()
|
|
296
|
-
* .onTransform(({ params }) => {
|
|
297
|
-
* if(params.id)
|
|
298
|
-
* params.id = +params.id
|
|
299
|
-
* })
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
onTransform<const Schema extends RouteSchema>(handler: MaybeArray<TransformHandler<UnknownRouteSchema<ResolvePath<BasePath>>, {
|
|
303
|
-
decorator: Singleton['decorator'];
|
|
304
|
-
store: Singleton['store'];
|
|
305
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
306
|
-
resolve: {};
|
|
307
|
-
}>>): this;
|
|
308
|
-
/**
|
|
309
|
-
* ### transform | Life cycle event
|
|
310
|
-
* Assign or transform anything related to context before validation.
|
|
311
|
-
*
|
|
312
|
-
* ---
|
|
313
|
-
* @example
|
|
314
|
-
* ```typescript
|
|
315
|
-
* new Elysia()
|
|
316
|
-
* .onTransform(({ params }) => {
|
|
317
|
-
* if(params.id)
|
|
318
|
-
* params.id = +params.id
|
|
319
|
-
* })
|
|
320
|
-
* ```
|
|
321
|
-
*/
|
|
322
|
-
onTransform<const Schema extends RouteSchema, const Type extends LifeCycleType>(options: {
|
|
323
|
-
as: Type;
|
|
324
|
-
}, handler: MaybeArray<TransformHandler<UnknownRouteSchema<'global' extends Type ? {
|
|
325
|
-
[name: string]: string | undefined;
|
|
326
|
-
} : 'scoped' extends Type ? {
|
|
327
|
-
[name: string]: string | undefined;
|
|
328
|
-
} : ResolvePath<BasePath>>, 'global' extends Type ? {
|
|
329
|
-
decorator: Singleton['decorator'];
|
|
330
|
-
store: Singleton['store'];
|
|
331
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
332
|
-
resolve: {};
|
|
333
|
-
} : 'scoped' extends Type ? {
|
|
334
|
-
decorator: Singleton['decorator'];
|
|
335
|
-
store: Singleton['store'];
|
|
336
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
337
|
-
resolve: {};
|
|
338
|
-
} : {
|
|
339
|
-
decorator: Singleton['decorator'];
|
|
340
|
-
store: Singleton['store'];
|
|
341
|
-
derive: Singleton['derive'] & Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
342
|
-
resolve: {};
|
|
343
|
-
}>>): this;
|
|
344
|
-
/**
|
|
345
|
-
* Derive new property for each request with access to `Context`.
|
|
346
|
-
*
|
|
347
|
-
* If error is thrown, the scope will skip to handling error instead.
|
|
348
|
-
*
|
|
349
|
-
* ---
|
|
350
|
-
* @example
|
|
351
|
-
* new Elysia()
|
|
352
|
-
* .state('counter', 1)
|
|
353
|
-
* .derive(({ store }) => ({
|
|
354
|
-
* increase() {
|
|
355
|
-
* store.counter++
|
|
356
|
-
* }
|
|
357
|
-
* }))
|
|
358
|
-
*/
|
|
359
|
-
resolve<const Resolver extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any>, const Type extends LifeCycleType>(options: {
|
|
360
|
-
as: Type;
|
|
361
|
-
}, resolver: (context: Context<MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
362
|
-
params: {
|
|
363
|
-
[name: string]: string | undefined;
|
|
364
|
-
};
|
|
365
|
-
} : 'scoped' extends Type ? {
|
|
366
|
-
params: {
|
|
367
|
-
[name: string]: string | undefined;
|
|
368
|
-
};
|
|
369
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
370
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
371
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
372
|
-
} : 'scoped' extends Type ? {
|
|
373
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
374
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
375
|
-
} : {
|
|
376
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
377
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
378
|
-
})>) => MaybePromise<Resolver | void>): Type extends 'global' ? Elysia<BasePath, {
|
|
379
|
-
decorator: Singleton['decorator'];
|
|
380
|
-
store: Singleton['store'];
|
|
381
|
-
derive: Singleton['derive'];
|
|
382
|
-
resolve: Singleton['resolve'] & ExcludeElysiaResponse<Resolver>;
|
|
383
|
-
}, Definitions, {
|
|
384
|
-
schema: Metadata['schema'];
|
|
385
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
386
|
-
macro: Metadata['macro'];
|
|
387
|
-
macroFn: Metadata['macroFn'];
|
|
388
|
-
parser: Metadata['parser'];
|
|
389
|
-
response: UnionResponseStatus<Metadata['response'], ExtractErrorFromHandle<Resolver>>;
|
|
390
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
391
|
-
derive: Ephemeral['derive'];
|
|
392
|
-
resolve: Ephemeral['resolve'] & ExcludeElysiaResponse<Resolver>;
|
|
393
|
-
schema: Ephemeral['schema'];
|
|
394
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
395
|
-
response: UnionResponseStatus<Ephemeral['response'], ExtractErrorFromHandle<Resolver>>;
|
|
396
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
397
|
-
derive: Volatile['derive'];
|
|
398
|
-
resolve: Volatile['resolve'] & ExcludeElysiaResponse<Resolver>;
|
|
399
|
-
schema: Volatile['schema'];
|
|
400
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
401
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Resolver>>;
|
|
402
|
-
}>;
|
|
403
|
-
/**
|
|
404
|
-
* Derive new property for each request with access to `Context`.
|
|
405
|
-
*
|
|
406
|
-
* If error is thrown, the scope will skip to handling error instead.
|
|
407
|
-
*
|
|
408
|
-
* ---
|
|
409
|
-
* @example
|
|
410
|
-
* new Elysia()
|
|
411
|
-
* .state('counter', 1)
|
|
412
|
-
* .derive(({ store }) => ({
|
|
413
|
-
* increase() {
|
|
414
|
-
* store.counter++
|
|
415
|
-
* }
|
|
416
|
-
* }))
|
|
417
|
-
*/
|
|
418
|
-
resolve<const Resolver extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any> | void>(resolver: (context: Context<MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
419
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
420
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
421
|
-
}, BasePath>) => MaybePromise<Resolver | void>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
422
|
-
derive: Volatile['derive'];
|
|
423
|
-
resolve: Volatile['resolve'] & ExcludeElysiaResponse<Resolver>;
|
|
424
|
-
schema: Volatile['schema'];
|
|
425
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
426
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Resolver>>;
|
|
427
|
-
}>;
|
|
428
|
-
mapResolve<const NewResolver extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any>>(mapper: (context: Context<MergeSchema<Metadata['schema'], MergeSchema<Ephemeral['schema'], Volatile['schema']>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
429
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
430
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
431
|
-
}, BasePath>) => MaybePromise<NewResolver | void>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
432
|
-
derive: Volatile['derive'];
|
|
433
|
-
resolve: ExcludeElysiaResponse<NewResolver>;
|
|
434
|
-
schema: Volatile['schema'];
|
|
435
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
436
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<NewResolver>>;
|
|
437
|
-
}>;
|
|
438
|
-
mapResolve<const NewResolver extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any>, const Type extends LifeCycleType>(options: {
|
|
439
|
-
as: Type;
|
|
440
|
-
}, mapper: (context: Context<MergeSchema<Metadata['schema'], MergeSchema<Ephemeral['schema'], Volatile['schema']>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & ('global' extends Type ? {
|
|
441
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
442
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
443
|
-
} : 'scoped' extends Type ? {
|
|
444
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
445
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
446
|
-
} : {
|
|
447
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
448
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
449
|
-
})>) => MaybePromise<NewResolver | void>): Type extends 'global' ? Elysia<BasePath, {
|
|
450
|
-
decorator: Singleton['decorator'];
|
|
451
|
-
store: Singleton['store'];
|
|
452
|
-
derive: Singleton['derive'];
|
|
453
|
-
resolve: ExcludeElysiaResponse<NewResolver>;
|
|
454
|
-
}, Definitions, {
|
|
455
|
-
schema: Metadata['schema'];
|
|
456
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
457
|
-
macro: Metadata['macro'];
|
|
458
|
-
macroFn: Metadata['macroFn'];
|
|
459
|
-
parser: Metadata['parser'];
|
|
460
|
-
response: UnionResponseStatus<Metadata['response'], ExtractErrorFromHandle<NewResolver>>;
|
|
461
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
462
|
-
derive: Ephemeral['derive'];
|
|
463
|
-
resolve: Ephemeral['resolve'] & ExcludeElysiaResponse<NewResolver>;
|
|
464
|
-
schema: Ephemeral['schema'];
|
|
465
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
466
|
-
response: UnionResponseStatus<Ephemeral['response'], ExtractErrorFromHandle<NewResolver>>;
|
|
467
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
468
|
-
derive: Volatile['derive'];
|
|
469
|
-
resolve: Volatile['resolve'] & ExcludeElysiaResponse<NewResolver>;
|
|
470
|
-
schema: Volatile['schema'];
|
|
471
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
472
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<NewResolver>>;
|
|
473
|
-
}>;
|
|
474
|
-
/**
|
|
475
|
-
* ### Before Handle | Life cycle event
|
|
476
|
-
* Execute after validation and before the main route handler.
|
|
477
|
-
*
|
|
478
|
-
* If truthy value is returned, will be assigned as `Response` and skip the main handler
|
|
479
|
-
*
|
|
480
|
-
* ---
|
|
481
|
-
* @example
|
|
482
|
-
* ```typescript
|
|
483
|
-
* new Elysia()
|
|
484
|
-
* .onBeforeHandle(({ params: { id }, status }) => {
|
|
485
|
-
* if(id && !isExisted(id)) {
|
|
486
|
-
* status(401)
|
|
487
|
-
*
|
|
488
|
-
* return "Unauthorized"
|
|
489
|
-
* }
|
|
490
|
-
* })
|
|
491
|
-
* ```
|
|
492
|
-
*/
|
|
493
|
-
onBeforeHandle<const Schema extends RouteSchema, const Handler extends OptionalHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
494
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
495
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
496
|
-
}>>(handler: Handler): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
497
|
-
derive: Volatile['derive'];
|
|
498
|
-
resolve: Volatile['resolve'];
|
|
499
|
-
schema: Volatile['schema'];
|
|
500
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
501
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
502
|
-
}>;
|
|
503
|
-
/**
|
|
504
|
-
* ### Before Handle | Life cycle event
|
|
505
|
-
* Execute after validation and before the main route handler.
|
|
506
|
-
*
|
|
507
|
-
* If truthy value is returned, will be assigned as `Response` and skip the main handler
|
|
508
|
-
*
|
|
509
|
-
* ---
|
|
510
|
-
* @example
|
|
511
|
-
* ```typescript
|
|
512
|
-
* new Elysia()
|
|
513
|
-
* .onBeforeHandle(({ params: { id }, status }) => {
|
|
514
|
-
* if(id && !isExisted(id)) {
|
|
515
|
-
* status(401)
|
|
516
|
-
*
|
|
517
|
-
* return "Unauthorized"
|
|
518
|
-
* }
|
|
519
|
-
* })
|
|
520
|
-
* ```
|
|
521
|
-
*/
|
|
522
|
-
onBeforeHandle<const Schema extends RouteSchema, const Handlers extends OptionalHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
523
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
524
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
525
|
-
}>[]>(handlers: Handlers): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
526
|
-
derive: Volatile['derive'];
|
|
527
|
-
resolve: Volatile['resolve'];
|
|
528
|
-
schema: Volatile['schema'];
|
|
529
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
530
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
531
|
-
}>;
|
|
532
|
-
/**
|
|
533
|
-
* ### Before Handle | Life cycle event
|
|
534
|
-
* Execute after validation and before the main route handler.
|
|
535
|
-
*
|
|
536
|
-
* If truthy value is returned, will be assigned as `Response` and skip the main handler
|
|
537
|
-
*
|
|
538
|
-
* ---
|
|
539
|
-
* @example
|
|
540
|
-
* ```typescript
|
|
541
|
-
* new Elysia()
|
|
542
|
-
* .onBeforeHandle(({ params: { id }, status }) => {
|
|
543
|
-
* if(id && !isExisted(id)) {
|
|
544
|
-
* status(401)
|
|
545
|
-
*
|
|
546
|
-
* return "Unauthorized"
|
|
547
|
-
* }
|
|
548
|
-
* })
|
|
549
|
-
* ```
|
|
550
|
-
*/
|
|
551
|
-
onBeforeHandle<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handler extends OptionalHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
552
|
-
params: {
|
|
553
|
-
[name: string]: string | undefined;
|
|
554
|
-
};
|
|
555
|
-
} : 'scoped' extends Type ? {
|
|
556
|
-
params: {
|
|
557
|
-
[name: string]: string | undefined;
|
|
558
|
-
};
|
|
559
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
560
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
561
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
562
|
-
} : 'scoped' extends Type ? {
|
|
563
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
564
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
565
|
-
} : {
|
|
566
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
567
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
568
|
-
}), BasePath>>(options: {
|
|
569
|
-
as: Type;
|
|
570
|
-
}, handler: Handler): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
571
|
-
schema: Metadata['schema'];
|
|
572
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
573
|
-
macro: Metadata['macro'];
|
|
574
|
-
macroFn: Metadata['macroFn'];
|
|
575
|
-
parser: Metadata['parser'];
|
|
576
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
577
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
578
|
-
derive: Ephemeral['derive'];
|
|
579
|
-
resolve: Ephemeral['resolve'];
|
|
580
|
-
schema: Ephemeral['schema'];
|
|
581
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
582
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
583
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
584
|
-
derive: Volatile['derive'];
|
|
585
|
-
resolve: Volatile['resolve'];
|
|
586
|
-
schema: Volatile['schema'];
|
|
587
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
588
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
589
|
-
}>;
|
|
590
|
-
/**
|
|
591
|
-
* ### Before Handle | Life cycle event
|
|
592
|
-
* Execute after validation and before the main route handler.
|
|
593
|
-
*
|
|
594
|
-
* If truthy value is returned, will be assigned as `Response` and skip the main handler
|
|
595
|
-
*
|
|
596
|
-
* ---
|
|
597
|
-
* @example
|
|
598
|
-
* ```typescript
|
|
599
|
-
* new Elysia()
|
|
600
|
-
* .onBeforeHandle(({ params: { id }, status }) => {
|
|
601
|
-
* if(id && !isExisted(id)) {
|
|
602
|
-
* status(401)
|
|
603
|
-
*
|
|
604
|
-
* return "Unauthorized"
|
|
605
|
-
* }
|
|
606
|
-
* })
|
|
607
|
-
* ```
|
|
608
|
-
*/
|
|
609
|
-
onBeforeHandle<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handlers extends OptionalHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
610
|
-
params: {
|
|
611
|
-
[name: string]: string | undefined;
|
|
612
|
-
};
|
|
613
|
-
} : 'scoped' extends Type ? {
|
|
614
|
-
params: {
|
|
615
|
-
[name: string]: string | undefined;
|
|
616
|
-
};
|
|
617
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
618
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
619
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
620
|
-
} : 'scoped' extends Type ? {
|
|
621
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
622
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
623
|
-
} : {
|
|
624
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
625
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
626
|
-
}), BasePath>[]>(options: {
|
|
627
|
-
as: Type;
|
|
628
|
-
}, handlers: Handlers): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
629
|
-
schema: Metadata['schema'];
|
|
630
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
631
|
-
macro: Metadata['macro'];
|
|
632
|
-
macroFn: Metadata['macroFn'];
|
|
633
|
-
parser: Metadata['parser'];
|
|
634
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
635
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
636
|
-
derive: Ephemeral['derive'];
|
|
637
|
-
resolve: Ephemeral['resolve'];
|
|
638
|
-
schema: Ephemeral['schema'];
|
|
639
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
640
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
641
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
642
|
-
derive: Volatile['derive'];
|
|
643
|
-
resolve: Volatile['resolve'];
|
|
644
|
-
schema: Volatile['schema'];
|
|
645
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
646
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
647
|
-
}>;
|
|
648
|
-
/**
|
|
649
|
-
* ### After Handle | Life cycle event
|
|
650
|
-
* Intercept request **after** main handler is called.
|
|
651
|
-
*
|
|
652
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
653
|
-
*
|
|
654
|
-
* ---
|
|
655
|
-
* @example
|
|
656
|
-
* ```typescript
|
|
657
|
-
* new Elysia()
|
|
658
|
-
* .onAfterHandle((context, response) => {
|
|
659
|
-
* if(typeof response === "object")
|
|
660
|
-
* return JSON.stringify(response)
|
|
661
|
-
* })
|
|
662
|
-
* ```
|
|
663
|
-
*/
|
|
664
|
-
onAfterHandle<const Schema extends RouteSchema, const Handler extends AfterHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
665
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
666
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
667
|
-
}>>(handler: Handler): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
668
|
-
derive: Volatile['derive'];
|
|
669
|
-
resolve: Volatile['resolve'];
|
|
670
|
-
schema: Volatile['schema'];
|
|
671
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
672
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
673
|
-
}>;
|
|
674
|
-
/**
|
|
675
|
-
* ### After Handle | Life cycle event
|
|
676
|
-
* Intercept request **after** main handler is called.
|
|
677
|
-
*
|
|
678
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
679
|
-
*
|
|
680
|
-
* ---
|
|
681
|
-
* @example
|
|
682
|
-
* ```typescript
|
|
683
|
-
* new Elysia()
|
|
684
|
-
* .onAfterHandle((context, response) => {
|
|
685
|
-
* if(typeof response === "object")
|
|
686
|
-
* return JSON.stringify(response)
|
|
687
|
-
* })
|
|
688
|
-
* ```
|
|
689
|
-
*/
|
|
690
|
-
onAfterHandle<const Schema extends RouteSchema, const Handlers extends AfterHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
691
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
692
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
693
|
-
}>[]>(handlers: Handlers): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
694
|
-
derive: Volatile['derive'];
|
|
695
|
-
resolve: Volatile['resolve'];
|
|
696
|
-
schema: Volatile['schema'];
|
|
697
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
698
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
699
|
-
}>;
|
|
700
|
-
/**
|
|
701
|
-
* ### After Handle | Life cycle event
|
|
702
|
-
* Intercept request **after** main handler is called.
|
|
703
|
-
*
|
|
704
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
705
|
-
*
|
|
706
|
-
* ---
|
|
707
|
-
* @example
|
|
708
|
-
* ```typescript
|
|
709
|
-
* new Elysia()
|
|
710
|
-
* .onAfterHandle((context, response) => {
|
|
711
|
-
* if(typeof response === "object")
|
|
712
|
-
* return JSON.stringify(response)
|
|
713
|
-
* })
|
|
714
|
-
* ```
|
|
715
|
-
*/
|
|
716
|
-
onAfterHandle<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handler extends AfterHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
717
|
-
params: {
|
|
718
|
-
[name: string]: string | undefined;
|
|
719
|
-
};
|
|
720
|
-
} : 'scoped' extends Type ? {
|
|
721
|
-
params: {
|
|
722
|
-
[name: string]: string | undefined;
|
|
723
|
-
};
|
|
724
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
725
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
726
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
727
|
-
} : 'scoped' extends Type ? {
|
|
728
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
729
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
730
|
-
} : {
|
|
731
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
732
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
733
|
-
})>>(options: {
|
|
734
|
-
as: Type;
|
|
735
|
-
}, handler: Handler): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
736
|
-
schema: Metadata['schema'];
|
|
737
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
738
|
-
macro: Metadata['macro'];
|
|
739
|
-
macroFn: Metadata['macroFn'];
|
|
740
|
-
parser: Metadata['parser'];
|
|
741
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
742
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
743
|
-
derive: Ephemeral['derive'];
|
|
744
|
-
resolve: Ephemeral['resolve'];
|
|
745
|
-
schema: Ephemeral['schema'];
|
|
746
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
747
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
748
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
749
|
-
derive: Volatile['derive'];
|
|
750
|
-
resolve: Volatile['resolve'];
|
|
751
|
-
schema: Volatile['schema'];
|
|
752
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
753
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
754
|
-
}>;
|
|
755
|
-
/**
|
|
756
|
-
* ### After Handle | Life cycle event
|
|
757
|
-
* Intercept request **after** main handler is called.
|
|
758
|
-
*
|
|
759
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
760
|
-
*
|
|
761
|
-
* ---
|
|
762
|
-
* @example
|
|
763
|
-
* ```typescript
|
|
764
|
-
* new Elysia()
|
|
765
|
-
* .onAfterHandle((context, response) => {
|
|
766
|
-
* if(typeof response === "object")
|
|
767
|
-
* return JSON.stringify(response)
|
|
768
|
-
* })
|
|
769
|
-
* ```
|
|
770
|
-
*/
|
|
771
|
-
onAfterHandle<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handlers extends AfterHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
772
|
-
params: {
|
|
773
|
-
[name: string]: string | undefined;
|
|
774
|
-
};
|
|
775
|
-
} : 'scoped' extends Type ? {
|
|
776
|
-
params: {
|
|
777
|
-
[name: string]: string | undefined;
|
|
778
|
-
};
|
|
779
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
780
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
781
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
782
|
-
} : 'scoped' extends Type ? {
|
|
783
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
784
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
785
|
-
} : {
|
|
786
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
787
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
788
|
-
})>[]>(options: {
|
|
789
|
-
as: Type;
|
|
790
|
-
}, handler: Handlers): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
791
|
-
schema: Metadata['schema'];
|
|
792
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
793
|
-
macro: Metadata['macro'];
|
|
794
|
-
macroFn: Metadata['macroFn'];
|
|
795
|
-
parser: Metadata['parser'];
|
|
796
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
797
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
798
|
-
derive: Ephemeral['derive'];
|
|
799
|
-
resolve: Ephemeral['resolve'];
|
|
800
|
-
schema: Ephemeral['schema'];
|
|
801
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
802
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
803
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
804
|
-
derive: Volatile['derive'];
|
|
805
|
-
resolve: Volatile['resolve'];
|
|
806
|
-
schema: Volatile['schema'];
|
|
807
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
808
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
809
|
-
}>;
|
|
810
|
-
/**
|
|
811
|
-
* ### After Handle | Life cycle event
|
|
812
|
-
* Intercept request **after** main handler is called.
|
|
813
|
-
*
|
|
814
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
815
|
-
*
|
|
816
|
-
* ---
|
|
817
|
-
* @example
|
|
818
|
-
* ```typescript
|
|
819
|
-
* new Elysia()
|
|
820
|
-
* .mapResponse((context, response) => {
|
|
821
|
-
* if(typeof response === "object")
|
|
822
|
-
* return JSON.stringify(response)
|
|
823
|
-
* })
|
|
824
|
-
* ```
|
|
825
|
-
*/
|
|
826
|
-
mapResponse<const Schema extends RouteSchema>(handler: MaybeArray<MapResponse<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
827
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
828
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
829
|
-
}>>): this;
|
|
830
|
-
/**
|
|
831
|
-
* ### After Handle | Life cycle event
|
|
832
|
-
* Intercept request **after** main handler is called.
|
|
833
|
-
*
|
|
834
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
835
|
-
*
|
|
836
|
-
* ---
|
|
837
|
-
* @example
|
|
838
|
-
* ```typescript
|
|
839
|
-
* new Elysia()
|
|
840
|
-
* .mapResponse((context, response) => {
|
|
841
|
-
* if(typeof response === "object")
|
|
842
|
-
* return JSON.stringify(response)
|
|
843
|
-
* })
|
|
844
|
-
* ```
|
|
845
|
-
*/
|
|
846
|
-
mapResponse<const Schema extends RouteSchema, Type extends LifeCycleType>(options: {
|
|
847
|
-
as: Type;
|
|
848
|
-
}, handler: MaybeArray<MapResponse<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
849
|
-
params: {
|
|
850
|
-
[name: string]: string | undefined;
|
|
851
|
-
};
|
|
852
|
-
} : 'scoped' extends Type ? {
|
|
853
|
-
params: {
|
|
854
|
-
[name: string]: string | undefined;
|
|
855
|
-
};
|
|
856
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
857
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
858
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
859
|
-
} : 'scoped' extends Type ? {
|
|
860
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
861
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
862
|
-
} : {
|
|
863
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
864
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
865
|
-
})>>): this;
|
|
866
|
-
/**
|
|
867
|
-
* ### response | Life cycle event
|
|
868
|
-
* Call AFTER main handler is executed
|
|
869
|
-
* Good for analytic metrics
|
|
870
|
-
* ---
|
|
871
|
-
* @example
|
|
872
|
-
* ```typescript
|
|
873
|
-
* new Elysia()
|
|
874
|
-
* .onAfterResponse(() => {
|
|
875
|
-
* cleanup()
|
|
876
|
-
* })
|
|
877
|
-
* ```
|
|
878
|
-
*/
|
|
879
|
-
onAfterResponse<const Schema extends RouteSchema>(handler: MaybeArray<AfterResponseHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
880
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
881
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
882
|
-
}>>): this;
|
|
883
|
-
/**
|
|
884
|
-
* ### response | Life cycle event
|
|
885
|
-
* Call AFTER main handler is executed
|
|
886
|
-
* Good for analytic metrics
|
|
887
|
-
*
|
|
888
|
-
* ---
|
|
889
|
-
* @example
|
|
890
|
-
* ```typescript
|
|
891
|
-
* new Elysia()
|
|
892
|
-
* .onAfterResponse(() => {
|
|
893
|
-
* cleanup()
|
|
894
|
-
* })
|
|
895
|
-
* ```
|
|
896
|
-
*/
|
|
897
|
-
onAfterResponse<const Schema extends RouteSchema, const Type extends LifeCycleType>(options: {
|
|
898
|
-
as: Type;
|
|
899
|
-
}, handler: MaybeArray<AfterResponseHandler<MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
900
|
-
params: {
|
|
901
|
-
[name: string]: string | undefined;
|
|
902
|
-
};
|
|
903
|
-
} : 'scoped' extends Type ? {
|
|
904
|
-
params: {
|
|
905
|
-
[name: string]: string | undefined;
|
|
906
|
-
};
|
|
907
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
908
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
909
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
910
|
-
} : 'scoped' extends Type ? {
|
|
911
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
912
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
913
|
-
} : {
|
|
914
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
915
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
916
|
-
})>>): this;
|
|
917
|
-
/**
|
|
918
|
-
* ### After Handle | Life cycle event
|
|
919
|
-
* Intercept request **after** main handler is called.
|
|
920
|
-
*
|
|
921
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
922
|
-
*
|
|
923
|
-
* ---
|
|
924
|
-
* @example
|
|
925
|
-
* ```typescript
|
|
926
|
-
* new Elysia()
|
|
927
|
-
* .onAfterHandle((context, response) => {
|
|
928
|
-
* if(typeof response === "object")
|
|
929
|
-
* return JSON.stringify(response)
|
|
930
|
-
* })
|
|
931
|
-
* ```
|
|
932
|
-
*/
|
|
933
|
-
trace<const Schema extends RouteSchema>(handler: MaybeArray<TraceHandler<Schema, Singleton>>): this;
|
|
934
|
-
/**
|
|
935
|
-
* ### After Handle | Life cycle event
|
|
936
|
-
* Intercept request **after** main handler is called.
|
|
937
|
-
*
|
|
938
|
-
* If truthy value is returned, will be assigned as `Response`
|
|
939
|
-
*
|
|
940
|
-
* ---
|
|
941
|
-
* @example
|
|
942
|
-
* ```typescript
|
|
943
|
-
* new Elysia()
|
|
944
|
-
* .onAfterHandle((context, response) => {
|
|
945
|
-
* if(typeof response === "object")
|
|
946
|
-
* return JSON.stringify(response)
|
|
947
|
-
* })
|
|
948
|
-
* ```
|
|
949
|
-
*/
|
|
950
|
-
trace<const Schema extends RouteSchema>(options: {
|
|
951
|
-
as: LifeCycleType;
|
|
952
|
-
}, handler: MaybeArray<TraceHandler<Schema, Singleton>>): this;
|
|
953
|
-
/**
|
|
954
|
-
* Register errors
|
|
955
|
-
*
|
|
956
|
-
* ---
|
|
957
|
-
* @example
|
|
958
|
-
* ```typescript
|
|
959
|
-
* class CustomError extends Error {
|
|
960
|
-
* constructor() {
|
|
961
|
-
* super()
|
|
962
|
-
* }
|
|
963
|
-
* }
|
|
964
|
-
*
|
|
965
|
-
* new Elysia()
|
|
966
|
-
* .error('CUSTOM_ERROR', CustomError)
|
|
967
|
-
* ```
|
|
968
|
-
*/
|
|
969
|
-
error<const Errors extends Record<string, {
|
|
970
|
-
prototype: Error;
|
|
971
|
-
}>>(errors: Errors): Elysia<BasePath, Singleton, {
|
|
972
|
-
typebox: Definitions['typebox'];
|
|
973
|
-
error: Definitions['error'] & {
|
|
974
|
-
[K in keyof Errors]: Errors[K] extends {
|
|
975
|
-
prototype: infer LiteralError extends Error;
|
|
976
|
-
} ? LiteralError : Errors[K];
|
|
977
|
-
};
|
|
978
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
979
|
-
/**
|
|
980
|
-
* Register errors
|
|
981
|
-
*
|
|
982
|
-
* ---
|
|
983
|
-
* @example
|
|
984
|
-
* ```typescript
|
|
985
|
-
* class CustomError extends Error {
|
|
986
|
-
* constructor() {
|
|
987
|
-
* super()
|
|
988
|
-
* }
|
|
989
|
-
* }
|
|
990
|
-
*
|
|
991
|
-
* new Elysia()
|
|
992
|
-
* .error({
|
|
993
|
-
* CUSTOM_ERROR: CustomError
|
|
994
|
-
* })
|
|
995
|
-
* ```
|
|
996
|
-
*/
|
|
997
|
-
error<Name extends string, const CustomError extends {
|
|
998
|
-
prototype: Error;
|
|
999
|
-
}>(name: Name, errors: CustomError): Elysia<BasePath, Singleton, {
|
|
1000
|
-
typebox: Definitions['typebox'];
|
|
1001
|
-
error: Definitions['error'] & {
|
|
1002
|
-
[name in Name]: CustomError extends {
|
|
1003
|
-
prototype: infer LiteralError extends Error;
|
|
1004
|
-
} ? LiteralError : CustomError;
|
|
1005
|
-
};
|
|
1006
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
1007
|
-
/**
|
|
1008
|
-
* Register errors
|
|
1009
|
-
*
|
|
1010
|
-
* ---
|
|
1011
|
-
* @example
|
|
1012
|
-
* ```typescript
|
|
1013
|
-
* class CustomError extends Error {
|
|
1014
|
-
* constructor() {
|
|
1015
|
-
* super()
|
|
1016
|
-
* }
|
|
1017
|
-
* }
|
|
1018
|
-
*
|
|
1019
|
-
* new Elysia()
|
|
1020
|
-
* .error('CUSTOM_ERROR', CustomError)
|
|
1021
|
-
* ```
|
|
1022
|
-
*/
|
|
1023
|
-
error<const NewErrors extends Record<string, Error>>(mapper: (decorators: Definitions['error']) => NewErrors): Elysia<BasePath, Singleton, {
|
|
1024
|
-
typebox: Definitions['typebox'];
|
|
1025
|
-
error: {
|
|
1026
|
-
[K in keyof NewErrors]: NewErrors[K] extends {
|
|
1027
|
-
prototype: infer LiteralError extends Error;
|
|
1028
|
-
} ? LiteralError : never;
|
|
1029
|
-
};
|
|
1030
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
1031
|
-
/**
|
|
1032
|
-
* ### Error | Life cycle event
|
|
1033
|
-
* Called when error is thrown during processing request
|
|
1034
|
-
*
|
|
1035
|
-
* ---
|
|
1036
|
-
* @example
|
|
1037
|
-
* ```typescript
|
|
1038
|
-
* new Elysia()
|
|
1039
|
-
* .onError(({ code }) => {
|
|
1040
|
-
* if(code === "NOT_FOUND")
|
|
1041
|
-
* return "Path not found :("
|
|
1042
|
-
* })
|
|
1043
|
-
* ```
|
|
1044
|
-
*/
|
|
1045
|
-
onError<const Schema extends RouteSchema, const Handler extends ErrorHandler<Definitions['error'], MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton, Ephemeral, Volatile>>(handler: Handler): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1046
|
-
derive: Volatile['derive'];
|
|
1047
|
-
resolve: Volatile['resolve'];
|
|
1048
|
-
schema: Volatile['schema'];
|
|
1049
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1050
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
1051
|
-
}>;
|
|
1052
|
-
/**
|
|
1053
|
-
* ### Error | Life cycle event
|
|
1054
|
-
* Called when error is thrown during processing request
|
|
1055
|
-
*
|
|
1056
|
-
* ---
|
|
1057
|
-
* @example
|
|
1058
|
-
* ```typescript
|
|
1059
|
-
* new Elysia()
|
|
1060
|
-
* .onError(({ code }) => {
|
|
1061
|
-
* if(code === "NOT_FOUND")
|
|
1062
|
-
* return "Path not found :("
|
|
1063
|
-
* })
|
|
1064
|
-
* ```
|
|
1065
|
-
*/
|
|
1066
|
-
onError<const Schema extends RouteSchema, const Handlers extends ErrorHandler<Definitions['error'], MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton, Ephemeral, Volatile>[]>(handler: Handlers): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1067
|
-
derive: Volatile['derive'];
|
|
1068
|
-
resolve: Volatile['resolve'];
|
|
1069
|
-
schema: Volatile['schema'];
|
|
1070
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1071
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
1072
|
-
}>;
|
|
1073
|
-
/**
|
|
1074
|
-
* ### Error | Life cycle event
|
|
1075
|
-
* Called when error is thrown during processing request
|
|
1076
|
-
*
|
|
1077
|
-
* ---
|
|
1078
|
-
* @example
|
|
1079
|
-
* ```typescript
|
|
1080
|
-
* new Elysia()
|
|
1081
|
-
* .onError(({ code }) => {
|
|
1082
|
-
* if(code === "NOT_FOUND")
|
|
1083
|
-
* return "Path not found :("
|
|
1084
|
-
* })
|
|
1085
|
-
* ```
|
|
1086
|
-
*/
|
|
1087
|
-
onError<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handler extends ErrorHandler<Definitions['error'], MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Type extends 'global' ? {
|
|
1088
|
-
store: Singleton['store'];
|
|
1089
|
-
decorator: Singleton['decorator'];
|
|
1090
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
1091
|
-
resolve: Singleton['resolve'] & Ephemeral['resolve'] & Volatile['resolve'];
|
|
1092
|
-
} : Type extends 'scoped' ? {
|
|
1093
|
-
store: Singleton['store'];
|
|
1094
|
-
decorator: Singleton['decorator'];
|
|
1095
|
-
derive: Singleton['derive'] & Ephemeral['derive'];
|
|
1096
|
-
resolve: Singleton['resolve'] & Ephemeral['resolve'];
|
|
1097
|
-
} : Singleton, Type extends 'global' ? Ephemeral : {
|
|
1098
|
-
derive: Partial<Ephemeral['derive']>;
|
|
1099
|
-
resolve: Partial<Ephemeral['resolve']>;
|
|
1100
|
-
schema: Ephemeral['schema'];
|
|
1101
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1102
|
-
response: Ephemeral['response'];
|
|
1103
|
-
}, Type extends 'global' ? Ephemeral : Type extends 'scoped' ? Ephemeral : {
|
|
1104
|
-
derive: Partial<Ephemeral['derive']>;
|
|
1105
|
-
resolve: Partial<Ephemeral['resolve']>;
|
|
1106
|
-
schema: Ephemeral['schema'];
|
|
1107
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1108
|
-
response: Ephemeral['response'];
|
|
1109
|
-
}>>(options: {
|
|
1110
|
-
as: Type;
|
|
1111
|
-
}, handler: Handler): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
1112
|
-
schema: Metadata['schema'];
|
|
1113
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
1114
|
-
macro: Metadata['macro'];
|
|
1115
|
-
macroFn: Metadata['macroFn'];
|
|
1116
|
-
parser: Metadata['parser'];
|
|
1117
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
1118
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
1119
|
-
derive: Ephemeral['derive'];
|
|
1120
|
-
resolve: Ephemeral['resolve'];
|
|
1121
|
-
schema: Ephemeral['schema'];
|
|
1122
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1123
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
1124
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1125
|
-
derive: Volatile['derive'];
|
|
1126
|
-
resolve: Volatile['resolve'];
|
|
1127
|
-
schema: Volatile['schema'];
|
|
1128
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1129
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchema<Handler>>;
|
|
1130
|
-
}>;
|
|
1131
|
-
/**
|
|
1132
|
-
* ### Error | Life cycle event
|
|
1133
|
-
* Called when error is thrown during processing request
|
|
1134
|
-
*
|
|
1135
|
-
* ---
|
|
1136
|
-
* @example
|
|
1137
|
-
* ```typescript
|
|
1138
|
-
* new Elysia()
|
|
1139
|
-
* .onError(({ code }) => {
|
|
1140
|
-
* if(code === "NOT_FOUND")
|
|
1141
|
-
* return "Path not found :("
|
|
1142
|
-
* })
|
|
1143
|
-
* ```
|
|
1144
|
-
*/
|
|
1145
|
-
onError<const Schema extends RouteSchema, const Type extends LifeCycleType, const Handlers extends ErrorHandler<Definitions['error'], MergeSchema<Schema, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Type extends 'global' ? {
|
|
1146
|
-
store: Singleton['store'];
|
|
1147
|
-
decorator: Singleton['decorator'];
|
|
1148
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
1149
|
-
resolve: Singleton['resolve'] & Ephemeral['resolve'] & Volatile['resolve'];
|
|
1150
|
-
} : Type extends 'scoped' ? {
|
|
1151
|
-
store: Singleton['store'];
|
|
1152
|
-
decorator: Singleton['decorator'];
|
|
1153
|
-
derive: Singleton['derive'] & Ephemeral['derive'];
|
|
1154
|
-
resolve: Singleton['resolve'] & Ephemeral['resolve'];
|
|
1155
|
-
} : Singleton, Type extends 'global' ? Ephemeral : {
|
|
1156
|
-
derive: Partial<Ephemeral['derive']>;
|
|
1157
|
-
resolve: Partial<Ephemeral['resolve']>;
|
|
1158
|
-
schema: Ephemeral['schema'];
|
|
1159
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1160
|
-
response: Ephemeral['response'];
|
|
1161
|
-
}, Type extends 'global' ? Ephemeral : Type extends 'scoped' ? Ephemeral : {
|
|
1162
|
-
derive: Partial<Ephemeral['derive']>;
|
|
1163
|
-
resolve: Partial<Ephemeral['resolve']>;
|
|
1164
|
-
schema: Ephemeral['schema'];
|
|
1165
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1166
|
-
response: Ephemeral['response'];
|
|
1167
|
-
}>[]>(options: {
|
|
1168
|
-
as: Type;
|
|
1169
|
-
}, handler: Handlers): Type extends 'global' ? Elysia<BasePath, Singleton, Definitions, {
|
|
1170
|
-
schema: Metadata['schema'];
|
|
1171
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
1172
|
-
macro: Metadata['macro'];
|
|
1173
|
-
macroFn: Metadata['macroFn'];
|
|
1174
|
-
parser: Metadata['parser'];
|
|
1175
|
-
response: UnionResponseStatus<Metadata['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
1176
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
1177
|
-
derive: Ephemeral['derive'];
|
|
1178
|
-
resolve: Ephemeral['resolve'];
|
|
1179
|
-
schema: Ephemeral['schema'];
|
|
1180
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
1181
|
-
response: UnionResponseStatus<Ephemeral['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
1182
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1183
|
-
derive: Volatile['derive'];
|
|
1184
|
-
resolve: Volatile['resolve'];
|
|
1185
|
-
schema: Volatile['schema'];
|
|
1186
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1187
|
-
response: UnionResponseStatus<Volatile['response'], ElysiaHandlerToResponseSchemas<Handlers>>;
|
|
1188
|
-
}>;
|
|
1189
|
-
/**
|
|
1190
|
-
* ### stop | Life cycle event
|
|
1191
|
-
* Called after server stop serving request
|
|
1192
|
-
*
|
|
1193
|
-
* ---
|
|
1194
|
-
* @example
|
|
1195
|
-
* ```typescript
|
|
1196
|
-
* new Elysia()
|
|
1197
|
-
* .onStop((app) => {
|
|
1198
|
-
* cleanup()
|
|
1199
|
-
* })
|
|
1200
|
-
* ```
|
|
1201
|
-
*/
|
|
1202
|
-
onStop(handler: MaybeArray<GracefulHandler<this>>): this;
|
|
1203
|
-
/**
|
|
1204
|
-
* ### on
|
|
1205
|
-
* Syntax sugar for attaching life cycle event by name
|
|
1206
|
-
*
|
|
1207
|
-
* Does the exact same thing as `.on[Event]()`
|
|
1208
|
-
*
|
|
1209
|
-
* ---
|
|
1210
|
-
* @example
|
|
1211
|
-
* ```typescript
|
|
1212
|
-
* new Elysia()
|
|
1213
|
-
* .on('error', ({ code }) => {
|
|
1214
|
-
* if(code === "NOT_FOUND")
|
|
1215
|
-
* return "Path not found :("
|
|
1216
|
-
* })
|
|
1217
|
-
* ```
|
|
1218
|
-
*/
|
|
1219
|
-
on<Event extends keyof LifeCycleStore>(type: Event, handlers: MaybeArray<Extract<LifeCycleStore[Event], HookContainer[]>[0]['fn']>): this;
|
|
1220
|
-
/**
|
|
1221
|
-
* ### on
|
|
1222
|
-
* Syntax sugar for attaching life cycle event by name
|
|
1223
|
-
*
|
|
1224
|
-
* Does the exact same thing as `.on[Event]()`
|
|
1225
|
-
*
|
|
1226
|
-
* ---
|
|
1227
|
-
* @example
|
|
1228
|
-
* ```typescript
|
|
1229
|
-
* new Elysia()
|
|
1230
|
-
* .on('error', ({ code }) => {
|
|
1231
|
-
* if(code === "NOT_FOUND")
|
|
1232
|
-
* return "Path not found :("
|
|
1233
|
-
* })
|
|
1234
|
-
* ```
|
|
1235
|
-
*/
|
|
1236
|
-
on<const Event extends keyof LifeCycleStore>(options: {
|
|
1237
|
-
as: LifeCycleType;
|
|
1238
|
-
}, type: Event, handlers: MaybeArray<Extract<LifeCycleStore[Event], Function[]>[0]>): this;
|
|
1239
|
-
as(type: 'global'): Elysia<BasePath, {
|
|
1240
|
-
decorator: Singleton['decorator'];
|
|
1241
|
-
store: Singleton['store'];
|
|
1242
|
-
derive: Singleton['derive'] & Ephemeral['derive'] & Volatile['derive'];
|
|
1243
|
-
resolve: Singleton['resolve'] & Ephemeral['resolve'] & Volatile['resolve'];
|
|
1244
|
-
}, Definitions, {
|
|
1245
|
-
schema: MergeSchema<MergeSchema<Volatile['schema'], Ephemeral['schema']>, Metadata['schema']>;
|
|
1246
|
-
standaloneSchema: Metadata['standaloneSchema'] & Volatile['standaloneSchema'] & Ephemeral['standaloneSchema'];
|
|
1247
|
-
macro: Metadata['macro'];
|
|
1248
|
-
macroFn: Metadata['macroFn'];
|
|
1249
|
-
parser: Metadata['parser'];
|
|
1250
|
-
response: Metadata['response'] & Ephemeral['response'] & Volatile['response'];
|
|
1251
|
-
}, Routes, {
|
|
1252
|
-
derive: {};
|
|
1253
|
-
resolve: {};
|
|
1254
|
-
schema: {};
|
|
1255
|
-
standaloneSchema: {};
|
|
1256
|
-
response: {};
|
|
1257
|
-
}, {
|
|
1258
|
-
derive: {};
|
|
1259
|
-
resolve: {};
|
|
1260
|
-
schema: {};
|
|
1261
|
-
standaloneSchema: {};
|
|
1262
|
-
response: {};
|
|
1263
|
-
}>;
|
|
1264
|
-
as(type: 'scoped'): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
1265
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1266
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1267
|
-
schema: MergeSchema<Volatile['schema'], Ephemeral['schema']>;
|
|
1268
|
-
standaloneSchema: Volatile['standaloneSchema'] & Ephemeral['standaloneSchema'];
|
|
1269
|
-
response: Volatile['response'] & Ephemeral['response'];
|
|
1270
|
-
}, {
|
|
1271
|
-
derive: {};
|
|
1272
|
-
resolve: {};
|
|
1273
|
-
schema: {};
|
|
1274
|
-
standaloneSchema: {};
|
|
1275
|
-
response: {};
|
|
1276
|
-
}>;
|
|
1277
|
-
group<const Prefix extends string, const NewElysia extends AnyElysia>(prefix: Prefix, run: (group: Elysia<Prefix extends '' ? BasePath : JoinPath<BasePath, Prefix>, Singleton, Definitions, {
|
|
1278
|
-
schema: MergeSchema<UnwrapRoute<{}, Definitions['typebox']>, Metadata['schema']>;
|
|
1279
|
-
standaloneSchema: UnwrapRoute<{}, Definitions['typebox']> & Metadata['standaloneSchema'];
|
|
1280
|
-
macro: Metadata['macro'];
|
|
1281
|
-
macroFn: Metadata['macroFn'];
|
|
1282
|
-
parser: Metadata['parser'];
|
|
1283
|
-
response: Metadata['response'];
|
|
1284
|
-
}, {}, Ephemeral, Volatile>) => NewElysia): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & NewElysia['~Routes'], Ephemeral, Volatile>;
|
|
1285
|
-
group<const Prefix extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Prefix>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const BeforeHandle extends MaybeArray<OptionalHandler<Schema, Singleton>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, Singleton>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, Singleton>>, const NewElysia extends AnyElysia>(prefix: Prefix, schema: GuardLocalHook<Input, Schema & MacroContext, Singleton & {
|
|
1286
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1287
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'] & MacroContext['response'];
|
|
1288
|
-
}, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle>, run: (group: Elysia<JoinPath<BasePath, Prefix>, {
|
|
1289
|
-
decorator: Singleton['decorator'];
|
|
1290
|
-
store: Singleton['store'];
|
|
1291
|
-
derive: Singleton['derive'];
|
|
1292
|
-
resolve: Singleton['resolve'] & MacroContext['resolve'];
|
|
1293
|
-
}, Definitions, {
|
|
1294
|
-
schema: Schema;
|
|
1295
|
-
standaloneSchema: Metadata['standaloneSchema'] & Schema & MacroContext;
|
|
1296
|
-
macro: Metadata['macro'];
|
|
1297
|
-
macroFn: Metadata['macroFn'];
|
|
1298
|
-
parser: Metadata['parser'];
|
|
1299
|
-
response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
|
|
1300
|
-
}, {}, Ephemeral, Volatile>) => NewElysia): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & NewElysia['~Routes'], Ephemeral, Volatile>;
|
|
1301
|
-
/**
|
|
1302
|
-
* ### guard
|
|
1303
|
-
* Encapsulate and pass hook into all child handler
|
|
1304
|
-
*
|
|
1305
|
-
* ---
|
|
1306
|
-
* @example
|
|
1307
|
-
* ```typescript
|
|
1308
|
-
* import { t } from 'elysia'
|
|
1309
|
-
*
|
|
1310
|
-
* new Elysia()
|
|
1311
|
-
* .guard({
|
|
1312
|
-
* body: t.Object({
|
|
1313
|
-
* username: t.String(),
|
|
1314
|
-
* password: t.String()
|
|
1315
|
-
* })
|
|
1316
|
-
* })
|
|
1317
|
-
* ```
|
|
1318
|
-
*/
|
|
1319
|
-
guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, Metadata['schema']>, const MacroContext extends MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey | 'as'>, Definitions['typebox']>, const GuardType extends GuardSchemaType, const AsType extends LifeCycleType, const BeforeHandle extends MaybeArray<OptionalHandler<Schema, Singleton>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, Singleton>>, const ErrorHandle extends MaybeArray<ErrorHandler<Definitions['error'], Schema, Singleton>>>(hook: GuardLocalHook<Input, Schema & MacroContext, Singleton & {
|
|
1320
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1321
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'] & MacroContext['response'];
|
|
1322
|
-
}, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle, GuardType, AsType>): Or<GuardSchemaType extends GuardType ? true : false, GuardType extends 'override' ? true : false> extends true ? Or<LifeCycleType extends AsType ? true : false, AsType extends 'local' ? true : false> extends true ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1323
|
-
derive: Volatile['derive'];
|
|
1324
|
-
resolve: Volatile['resolve'] & MacroContext['resolve'];
|
|
1325
|
-
schema: {} extends PickIfExists<Input, keyof InputSchema> ? Volatile['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Metadata['schema']>;
|
|
1326
|
-
standaloneSchema: Volatile['standaloneSchema'] & SimplifyToSchema<MacroContext>;
|
|
1327
|
-
response: Volatile['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1328
|
-
}> : AsType extends 'global' ? Elysia<BasePath, {
|
|
1329
|
-
decorator: Singleton['decorator'];
|
|
1330
|
-
store: Singleton['store'];
|
|
1331
|
-
derive: Singleton['derive'];
|
|
1332
|
-
resolve: Singleton['resolve'] & MacroContext['resolve'];
|
|
1333
|
-
}, Definitions, {
|
|
1334
|
-
schema: {} extends PickIfExists<Input, keyof InputSchema> ? Metadata['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, Metadata['schema']>;
|
|
1335
|
-
standaloneSchema: Metadata['standaloneSchema'] & SimplifyToSchema<MacroContext>;
|
|
1336
|
-
macro: Metadata['macro'];
|
|
1337
|
-
macroFn: Metadata['macroFn'];
|
|
1338
|
-
parser: Metadata['parser'];
|
|
1339
|
-
response: Metadata['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1340
|
-
}, Routes, Ephemeral, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
1341
|
-
derive: Ephemeral['derive'];
|
|
1342
|
-
resolve: Ephemeral['resolve'] & MacroContext['resolve'];
|
|
1343
|
-
schema: {} extends PickIfExists<Input, keyof InputSchema> ? EphemeralType['schema'] : MergeSchema<UnwrapRoute<Input, Definitions['typebox']>, Metadata['schema'] & Ephemeral['schema']>;
|
|
1344
|
-
standaloneSchema: Ephemeral['standaloneSchema'] & SimplifyToSchema<MacroContext>;
|
|
1345
|
-
response: Ephemeral['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1346
|
-
}, Volatile> : Or<LifeCycleType extends AsType ? true : false, AsType extends 'local' ? true : false> extends true ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1347
|
-
derive: Volatile['derive'];
|
|
1348
|
-
resolve: Volatile['resolve'] & MacroContext['resolve'];
|
|
1349
|
-
schema: Volatile['schema'];
|
|
1350
|
-
standaloneSchema: SimplifyToSchema<MacroContext> & ({} extends PickIfExists<Input, keyof InputSchema> ? Volatile['standaloneSchema'] : Volatile['standaloneSchema'] & UnwrapRoute<Input, Definitions['typebox']>);
|
|
1351
|
-
response: Volatile['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1352
|
-
}> : AsType extends 'global' ? Elysia<BasePath, {
|
|
1353
|
-
decorator: Singleton['decorator'];
|
|
1354
|
-
store: Singleton['store'];
|
|
1355
|
-
derive: Singleton['derive'];
|
|
1356
|
-
resolve: Singleton['resolve'] & MacroContext['resolve'];
|
|
1357
|
-
}, Definitions, {
|
|
1358
|
-
schema: Metadata['schema'];
|
|
1359
|
-
standaloneSchema: SimplifyToSchema<MacroContext> & ({} extends PickIfExists<Input, keyof InputSchema> ? Metadata['standaloneSchema'] : UnwrapRoute<Input, Definitions['typebox'], BasePath> & Metadata['standaloneSchema']);
|
|
1360
|
-
macro: Metadata['macro'];
|
|
1361
|
-
macroFn: Metadata['macroFn'];
|
|
1362
|
-
parser: Metadata['parser'];
|
|
1363
|
-
response: Metadata['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1364
|
-
}, Routes, Ephemeral, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
1365
|
-
derive: Ephemeral['derive'];
|
|
1366
|
-
resolve: Ephemeral['resolve'] & MacroContext['resolve'];
|
|
1367
|
-
schema: Ephemeral['schema'];
|
|
1368
|
-
standaloneSchema: SimplifyToSchema<MacroContext> & ({} extends PickIfExists<Input, keyof InputSchema> ? Ephemeral['standaloneSchema'] : Ephemeral['standaloneSchema'] & UnwrapRoute<Input, Definitions['typebox']>);
|
|
1369
|
-
response: Ephemeral['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle> & MacroContext['return'];
|
|
1370
|
-
}, Volatile>;
|
|
1371
|
-
guard<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey | 'as'>, Definitions['typebox']>, const BeforeHandle extends MaybeArray<OptionalHandler<Schema, Singleton>>, const AfterHandle extends MaybeArray<AfterHandler<Schema, Singleton>>, const ErrorHandle extends MaybeArray<ErrorHandler<any, Schema, Singleton>>, const NewElysia extends AnyElysia>(schema: GuardLocalHook<Input, Schema & MacroContext, Singleton & {
|
|
1372
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1373
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1374
|
-
}, keyof Metadata['parser'], BeforeHandle, AfterHandle, ErrorHandle>, run: (group: Elysia<BasePath, {
|
|
1375
|
-
decorator: Singleton['decorator'];
|
|
1376
|
-
store: Singleton['store'];
|
|
1377
|
-
derive: Singleton['derive'];
|
|
1378
|
-
resolve: Singleton['resolve'] & MacroContext['resolve'];
|
|
1379
|
-
}, Definitions, {
|
|
1380
|
-
schema: Schema;
|
|
1381
|
-
standaloneSchema: Metadata['standaloneSchema'] & Schema & MacroContext;
|
|
1382
|
-
macro: Metadata['macro'];
|
|
1383
|
-
macroFn: Metadata['macroFn'];
|
|
1384
|
-
parser: Metadata['parser'];
|
|
1385
|
-
response: Metadata['response'] & MacroContext['response'] & ElysiaHandlerToResponseSchemaAmbiguous<BeforeHandle> & ElysiaHandlerToResponseSchemaAmbiguous<AfterHandle> & ElysiaHandlerToResponseSchemaAmbiguous<ErrorHandle>;
|
|
1386
|
-
}, {}, Ephemeral, Volatile>) => NewElysia): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & NewElysia['~Routes'], Ephemeral, {
|
|
1387
|
-
derive: Volatile['derive'];
|
|
1388
|
-
resolve: Volatile['resolve'] & MacroContext['resolve'];
|
|
1389
|
-
schema: Volatile['schema'];
|
|
1390
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1391
|
-
response: Volatile['response'] & MacroContext['response'];
|
|
1392
|
-
}>;
|
|
1393
|
-
/**
|
|
1394
|
-
* Entire Instance
|
|
1395
|
-
**/
|
|
1396
|
-
use<const NewElysia extends AnyElysia>(instance: MaybePromise<NewElysia>): Elysia<BasePath, {
|
|
1397
|
-
decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
|
|
1398
|
-
store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
|
|
1399
|
-
derive: Singleton['derive'] & NewElysia['~Singleton']['derive'];
|
|
1400
|
-
resolve: Singleton['resolve'] & NewElysia['~Singleton']['resolve'];
|
|
1401
|
-
}, Definitions & NewElysia['~Definitions'], Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, Ephemeral, Volatile & NewElysia['~Ephemeral']>;
|
|
1402
|
-
/**
|
|
1403
|
-
* Entire multiple Instance
|
|
1404
|
-
**/
|
|
1405
|
-
use<const Instances extends AnyElysia[]>(instance: MaybePromise<Instances>): MergeElysiaInstances<Instances, BasePath>;
|
|
1406
|
-
/**
|
|
1407
|
-
* Import fn
|
|
1408
|
-
*/
|
|
1409
|
-
use<const NewElysia extends AnyElysia>(plugin: Promise<{
|
|
1410
|
-
default: (elysia: AnyElysia) => MaybePromise<NewElysia>;
|
|
1411
|
-
}>): Elysia<BasePath, {
|
|
1412
|
-
decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
|
|
1413
|
-
store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
|
|
1414
|
-
derive: Singleton['derive'] & NewElysia['~Singleton']['derive'];
|
|
1415
|
-
resolve: Singleton['resolve'] & NewElysia['~Singleton']['resolve'];
|
|
1416
|
-
}, Definitions & NewElysia['~Definitions'], Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, Ephemeral & NewElysia['~Ephemeral'], Volatile & NewElysia['~Volatile']>;
|
|
1417
|
-
/**
|
|
1418
|
-
* Import entire instance
|
|
1419
|
-
*/
|
|
1420
|
-
use<const LazyLoadElysia extends AnyElysia>(plugin: Promise<{
|
|
1421
|
-
default: LazyLoadElysia;
|
|
1422
|
-
}>): Elysia<BasePath, {
|
|
1423
|
-
decorator: Singleton['decorator'] & Partial<LazyLoadElysia['~Singleton']['decorator']>;
|
|
1424
|
-
store: Prettify<Singleton['store'] & Partial<LazyLoadElysia['~Singleton']['store']>>;
|
|
1425
|
-
derive: Singleton['derive'] & Partial<LazyLoadElysia['~Singleton']['derive']>;
|
|
1426
|
-
resolve: Singleton['resolve'] & Partial<LazyLoadElysia['~Singleton']['resolve']>;
|
|
1427
|
-
}, Definitions & LazyLoadElysia['~Definitions'], Metadata & LazyLoadElysia['~Metadata'], BasePath extends `` ? Routes & LazyLoadElysia['~Routes'] : Routes & CreateEden<BasePath, LazyLoadElysia['~Routes']>, Ephemeral, {
|
|
1428
|
-
schema: Volatile['schema'] & Partial<LazyLoadElysia['~Ephemeral']['schema']>;
|
|
1429
|
-
standaloneSchema: Volatile['standaloneSchema'] & Partial<LazyLoadElysia['~Ephemeral']['standaloneSchema']>;
|
|
1430
|
-
resolve: Volatile['resolve'] & Partial<LazyLoadElysia['~Ephemeral']['resolve']>;
|
|
1431
|
-
derive: Volatile['derive'] & Partial<LazyLoadElysia['~Ephemeral']['derive']>;
|
|
1432
|
-
response: Volatile['response'] & LazyLoadElysia['~Ephemeral']['response'];
|
|
1433
|
-
}>;
|
|
1434
|
-
/**
|
|
1435
|
-
* Inline fn
|
|
1436
|
-
*/
|
|
1437
|
-
use<const NewElysia extends AnyElysia, const Param extends AnyElysia = this>(plugin: (app: Param) => NewElysia): Elysia<BasePath, {
|
|
1438
|
-
decorator: Singleton['decorator'] & NewElysia['~Singleton']['decorator'];
|
|
1439
|
-
store: Prettify<Singleton['store'] & NewElysia['~Singleton']['store']>;
|
|
1440
|
-
derive: Singleton['derive'] & NewElysia['~Singleton']['derive'];
|
|
1441
|
-
resolve: Singleton['resolve'] & NewElysia['~Singleton']['resolve'];
|
|
1442
|
-
}, Definitions & NewElysia['~Definitions'], Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, Ephemeral & NewElysia['~Ephemeral'], Volatile & NewElysia['~Volatile']>;
|
|
1443
|
-
/**
|
|
1444
|
-
* Inline async fn
|
|
1445
|
-
*/
|
|
1446
|
-
use<const NewElysia extends AnyElysia, const Param extends AnyElysia = this>(plugin: ((app: Param) => Promise<NewElysia>) | Promise<(app: Param) => NewElysia>): Elysia<BasePath, {
|
|
1447
|
-
decorator: Singleton['decorator'] & Partial<NewElysia['~Singleton']['decorator']>;
|
|
1448
|
-
store: Prettify<Singleton['store'] & Partial<NewElysia['~Singleton']['store']>>;
|
|
1449
|
-
derive: Singleton['derive'] & Partial<NewElysia['~Singleton']['derive']>;
|
|
1450
|
-
resolve: Singleton['resolve'] & Partial<NewElysia['~Singleton']['resolve']>;
|
|
1451
|
-
}, Definitions & NewElysia['~Definitions'], Metadata & NewElysia['~Metadata'], BasePath extends `` ? Routes & NewElysia['~Routes'] : Routes & CreateEden<BasePath, NewElysia['~Routes']>, {
|
|
1452
|
-
schema: Ephemeral['schema'] & Partial<NewElysia['~Ephemeral']['schema']>;
|
|
1453
|
-
standaloneSchema: Ephemeral['standaloneSchema'] & Partial<NewElysia['~Ephemeral']['standaloneSchema']>;
|
|
1454
|
-
resolve: Ephemeral['resolve'] & Partial<NewElysia['~Ephemeral']['resolve']>;
|
|
1455
|
-
derive: Ephemeral['derive'] & Partial<NewElysia['~Ephemeral']['derive']>;
|
|
1456
|
-
response: Ephemeral['response'] & NewElysia['~Ephemeral']['response'];
|
|
1457
|
-
}, {
|
|
1458
|
-
schema: Volatile['schema'] & Partial<NewElysia['~Volatile']['schema']>;
|
|
1459
|
-
standaloneSchema: Volatile['standaloneSchema'] & Partial<NewElysia['~Volatile']['standaloneSchema']>;
|
|
1460
|
-
resolve: Volatile['resolve'] & Partial<NewElysia['~Volatile']['resolve']>;
|
|
1461
|
-
derive: Volatile['derive'] & Partial<NewElysia['~Volatile']['derive']>;
|
|
1462
|
-
response: Volatile['response'] & NewElysia['~Volatile']['response'];
|
|
1463
|
-
}>;
|
|
1464
|
-
/**
|
|
1465
|
-
* conditional undefined ignore type
|
|
1466
|
-
*/
|
|
1467
|
-
use(instance: MaybeArray<MaybePromise<AnyElysia>> | MaybePromise<AnyElysia | ((app: AnyElysia) => MaybePromise<AnyElysia>)> | Promise<{
|
|
1468
|
-
default: AnyElysia | ((app: AnyElysia) => MaybePromise<AnyElysia>);
|
|
1469
|
-
}> | undefined | false): this;
|
|
1470
|
-
private propagatePromiseModules;
|
|
1471
|
-
private _use;
|
|
1472
|
-
macro<const Name extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Property extends MaybeValueOrVoidFunction<MacroProperty<Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & {
|
|
1473
|
-
[name in Name]?: boolean;
|
|
1474
|
-
}, Schema & MacroContext, Singleton & {
|
|
1475
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
1476
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']> & MacroContext['resolve'];
|
|
1477
|
-
}, Definitions['error']>>>(name: Name, macro: (Input extends any ? Input : Prettify<Input>) & Property): Elysia<BasePath, Singleton, Definitions, {
|
|
1478
|
-
schema: Metadata['schema'];
|
|
1479
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
1480
|
-
macro: Metadata['macro'] & {
|
|
1481
|
-
[name in Name]?: Property extends (a: infer Params) => any ? Params : boolean;
|
|
1482
|
-
};
|
|
1483
|
-
macroFn: Metadata['macroFn'] & {
|
|
1484
|
-
[name in Name]: Property;
|
|
1485
|
-
};
|
|
1486
|
-
parser: Metadata['parser'];
|
|
1487
|
-
response: Metadata['response'];
|
|
1488
|
-
}, Routes, Ephemeral, Volatile>;
|
|
1489
|
-
macro<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const NewMacro extends Macro<Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, Input, IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, Singleton & {
|
|
1490
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
1491
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
1492
|
-
}, Definitions['error']>>(macro: NewMacro): Elysia<BasePath, Singleton, Definitions, {
|
|
1493
|
-
schema: Metadata['schema'];
|
|
1494
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
1495
|
-
macro: Metadata['macro'] & Partial<MacroToProperty<NewMacro>>;
|
|
1496
|
-
macroFn: Metadata['macroFn'] & NewMacro;
|
|
1497
|
-
parser: Metadata['parser'];
|
|
1498
|
-
response: Metadata['response'];
|
|
1499
|
-
}, Routes, Ephemeral, Volatile>;
|
|
1500
|
-
macro<const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const NewMacro extends MaybeFunction<Macro<Input, IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], BasePath>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, Singleton & {
|
|
1501
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
1502
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
1503
|
-
}, Definitions['error']>>>(macro: NewMacro): Elysia<BasePath, Singleton, Definitions, {
|
|
1504
|
-
schema: Metadata['schema'];
|
|
1505
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
1506
|
-
macro: Metadata['macro'] & Partial<MacroToProperty<NewMacro>>;
|
|
1507
|
-
macroFn: Metadata['macroFn'] & NewMacro;
|
|
1508
|
-
parser: Metadata['parser'];
|
|
1509
|
-
response: Metadata['response'];
|
|
1510
|
-
}, Routes, Ephemeral, Volatile>;
|
|
1511
|
-
private applyMacro;
|
|
1512
|
-
mount(handle: ((request: Request) => MaybePromise<Response>) | AnyElysia, detail?: {
|
|
1513
|
-
detail?: DocumentDecoration;
|
|
1514
|
-
}): this;
|
|
1515
|
-
mount(path: string, handle: ((request: Request) => MaybePromise<Response>) | AnyElysia, detail?: {
|
|
1516
|
-
detail?: DocumentDecoration;
|
|
1517
|
-
}): this;
|
|
1518
|
-
/**
|
|
1519
|
-
* ### get
|
|
1520
|
-
* Register handler for path with method [GET]
|
|
1521
|
-
*
|
|
1522
|
-
* ---
|
|
1523
|
-
* @example
|
|
1524
|
-
* ```typescript
|
|
1525
|
-
* import { Elysia, t } from 'elysia'
|
|
1526
|
-
*
|
|
1527
|
-
* new Elysia()
|
|
1528
|
-
* .get('/', () => 'hi')
|
|
1529
|
-
* .get('/with-hook', () => 'hi', {
|
|
1530
|
-
* response: t.String()
|
|
1531
|
-
* })
|
|
1532
|
-
* ```
|
|
1533
|
-
*/
|
|
1534
|
-
get<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1535
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1536
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1537
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends {} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1538
|
-
get: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1539
|
-
}>, Ephemeral, Volatile>;
|
|
1540
|
-
/**
|
|
1541
|
-
* ### post
|
|
1542
|
-
* Register handler for path with method [POST]
|
|
1543
|
-
*
|
|
1544
|
-
* ---
|
|
1545
|
-
* @example
|
|
1546
|
-
* ```typescript
|
|
1547
|
-
* import { Elysia, t } from 'elysia'
|
|
1548
|
-
*
|
|
1549
|
-
* new Elysia()
|
|
1550
|
-
* .post('/', () => 'hi')
|
|
1551
|
-
* .post('/with-hook', () => 'hi', {
|
|
1552
|
-
* response: t.String()
|
|
1553
|
-
* })
|
|
1554
|
-
* ```
|
|
1555
|
-
*/
|
|
1556
|
-
post<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1557
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1558
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1559
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends {} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1560
|
-
post: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1561
|
-
}>, Ephemeral, Volatile>;
|
|
1562
|
-
/**
|
|
1563
|
-
* ### put
|
|
1564
|
-
* Register handler for path with method [PUT]
|
|
1565
|
-
*
|
|
1566
|
-
* ---
|
|
1567
|
-
* @example
|
|
1568
|
-
* ```typescript
|
|
1569
|
-
* import { Elysia, t } from 'elysia'
|
|
1570
|
-
*
|
|
1571
|
-
* new Elysia()
|
|
1572
|
-
* .put('/', () => 'hi')
|
|
1573
|
-
* .put('/with-hook', () => 'hi', {
|
|
1574
|
-
* response: t.String()
|
|
1575
|
-
* })
|
|
1576
|
-
* ```
|
|
1577
|
-
*/
|
|
1578
|
-
put<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1579
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1580
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1581
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends {} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1582
|
-
put: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1583
|
-
}>, Ephemeral, Volatile>;
|
|
1584
|
-
/**
|
|
1585
|
-
* ### patch
|
|
1586
|
-
* Register handler for path with method [PATCH]
|
|
1587
|
-
*
|
|
1588
|
-
* ---
|
|
1589
|
-
* @example
|
|
1590
|
-
* ```typescript
|
|
1591
|
-
* import { Elysia, t } from 'elysia'
|
|
1592
|
-
*
|
|
1593
|
-
* new Elysia()
|
|
1594
|
-
* .patch('/', () => 'hi')
|
|
1595
|
-
* .patch('/with-hook', () => 'hi', {
|
|
1596
|
-
* response: t.String()
|
|
1597
|
-
* })
|
|
1598
|
-
* ```
|
|
1599
|
-
*/
|
|
1600
|
-
patch<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1601
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1602
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1603
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1604
|
-
patch: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1605
|
-
}>, Ephemeral, Volatile>;
|
|
1606
|
-
/**
|
|
1607
|
-
* ### delete
|
|
1608
|
-
* Register handler for path with method [DELETE]
|
|
1609
|
-
*
|
|
1610
|
-
* ---
|
|
1611
|
-
* @example
|
|
1612
|
-
* ```typescript
|
|
1613
|
-
* import { Elysia, t } from 'elysia'
|
|
1614
|
-
*
|
|
1615
|
-
* new Elysia()
|
|
1616
|
-
* .delete('/', () => 'hi')
|
|
1617
|
-
* .delete('/with-hook', () => 'hi', {
|
|
1618
|
-
* response: t.String()
|
|
1619
|
-
* })
|
|
1620
|
-
* ```
|
|
1621
|
-
*/
|
|
1622
|
-
delete<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1623
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1624
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1625
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1626
|
-
delete: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1627
|
-
}>, Ephemeral, Volatile>;
|
|
1628
|
-
/**
|
|
1629
|
-
* ### options
|
|
1630
|
-
* Register handler for path with method [POST]
|
|
1631
|
-
*
|
|
1632
|
-
* ---
|
|
1633
|
-
* @example
|
|
1634
|
-
* ```typescript
|
|
1635
|
-
* import { Elysia, t } from 'elysia'
|
|
1636
|
-
*
|
|
1637
|
-
* new Elysia()
|
|
1638
|
-
* .options('/', () => 'hi')
|
|
1639
|
-
* .options('/with-hook', () => 'hi', {
|
|
1640
|
-
* response: t.String()
|
|
1641
|
-
* })
|
|
1642
|
-
* ```
|
|
1643
|
-
*/
|
|
1644
|
-
options<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1645
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1646
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1647
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1648
|
-
options: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1649
|
-
}>, Ephemeral, Volatile>;
|
|
1650
|
-
/**
|
|
1651
|
-
* ### all
|
|
1652
|
-
* Register handler for path with method [ALL]
|
|
1653
|
-
*
|
|
1654
|
-
* ---
|
|
1655
|
-
* @example
|
|
1656
|
-
* ```typescript
|
|
1657
|
-
* import { Elysia, t } from 'elysia'
|
|
1658
|
-
*
|
|
1659
|
-
* new Elysia()
|
|
1660
|
-
* .all('/', () => 'hi')
|
|
1661
|
-
* .all('/with-hook', () => 'hi', {
|
|
1662
|
-
* response: t.String()
|
|
1663
|
-
* })
|
|
1664
|
-
* ```
|
|
1665
|
-
*/
|
|
1666
|
-
all<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1667
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1668
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1669
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1670
|
-
[method in string]: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1671
|
-
}>, Ephemeral, Volatile>;
|
|
1672
|
-
/**
|
|
1673
|
-
* ### head
|
|
1674
|
-
* Register handler for path with method [HEAD]
|
|
1675
|
-
*
|
|
1676
|
-
* ---
|
|
1677
|
-
* @example
|
|
1678
|
-
* ```typescript
|
|
1679
|
-
* import { Elysia, t } from 'elysia'
|
|
1680
|
-
*
|
|
1681
|
-
* new Elysia()
|
|
1682
|
-
* .head('/', () => 'hi')
|
|
1683
|
-
* .head('/with-hook', () => 'hi', {
|
|
1684
|
-
* response: t.String()
|
|
1685
|
-
* })
|
|
1686
|
-
* ```
|
|
1687
|
-
*/
|
|
1688
|
-
head<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1689
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1690
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1691
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1692
|
-
head: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1693
|
-
}>, Ephemeral, Volatile>;
|
|
1694
|
-
/**
|
|
1695
|
-
* ### connect
|
|
1696
|
-
* Register handler for path with method [CONNECT]
|
|
1697
|
-
*
|
|
1698
|
-
* ---
|
|
1699
|
-
* @example
|
|
1700
|
-
* ```typescript
|
|
1701
|
-
* import { Elysia, t } from 'elysia'
|
|
1702
|
-
*
|
|
1703
|
-
* new Elysia()
|
|
1704
|
-
* .connect('/', () => 'hi')
|
|
1705
|
-
* .connect('/with-hook', () => 'hi', {
|
|
1706
|
-
* response: t.String()
|
|
1707
|
-
* })
|
|
1708
|
-
* ```
|
|
1709
|
-
*/
|
|
1710
|
-
connect<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1711
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1712
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1713
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1714
|
-
connect: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1715
|
-
}>, Ephemeral, Volatile>;
|
|
1716
|
-
/**
|
|
1717
|
-
* ### route
|
|
1718
|
-
* Register handler for path with method [ROUTE]
|
|
1719
|
-
*
|
|
1720
|
-
* ---
|
|
1721
|
-
* @example
|
|
1722
|
-
* ```typescript
|
|
1723
|
-
* import { Elysia, t } from 'elysia'
|
|
1724
|
-
*
|
|
1725
|
-
* new Elysia()
|
|
1726
|
-
* .route('/', () => 'hi')
|
|
1727
|
-
* .route('/with-hook', () => 'hi', {
|
|
1728
|
-
* response: t.String()
|
|
1729
|
-
* })
|
|
1730
|
-
* ```
|
|
1731
|
-
*/
|
|
1732
|
-
route<const Method extends HTTPMethod, const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const Decorator extends Singleton & {
|
|
1733
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1734
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1735
|
-
}, const MacroContext extends {} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>, const Handle extends InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>>(method: Method, path: Path, handler: Handle, hook?: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & {
|
|
1736
|
-
config?: {
|
|
1737
|
-
allowMeta?: boolean;
|
|
1738
|
-
mount?: Function;
|
|
1739
|
-
};
|
|
1740
|
-
}): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1741
|
-
[method in Method]: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Handle, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1742
|
-
}>, Ephemeral, Volatile>;
|
|
1743
|
-
/**
|
|
1744
|
-
* ### ws
|
|
1745
|
-
* Register handler for path with method [ws]
|
|
1746
|
-
*
|
|
1747
|
-
* ---
|
|
1748
|
-
* @example
|
|
1749
|
-
* ```typescript
|
|
1750
|
-
* import { Elysia, t } from 'elysia'
|
|
1751
|
-
*
|
|
1752
|
-
* new Elysia()
|
|
1753
|
-
* .ws('/', {
|
|
1754
|
-
* message(ws, message) {
|
|
1755
|
-
* ws.send(message)
|
|
1756
|
-
* }
|
|
1757
|
-
* })
|
|
1758
|
-
* ```
|
|
1759
|
-
*/
|
|
1760
|
-
ws<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>>, Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema']>, const MacroContext extends MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>>>(path: Path, options: WSLocalHook<Input, Schema, Singleton & {
|
|
1761
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1762
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'] & MacroContext['resolve'];
|
|
1763
|
-
}>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes & CreateEden<JoinPath<BasePath, Path>, {
|
|
1764
|
-
subscribe: CreateEdenResponse<Path, Schema, MacroContext, ComposeElysiaResponse<Schema & MacroContext & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], {} extends Schema['response'] ? unknown : Schema['response'] extends {
|
|
1765
|
-
[200]: any;
|
|
1766
|
-
} ? Schema['response'][200] : unknown, UnionResponseStatus<Metadata['response'], UnionResponseStatus<Ephemeral['response'], UnionResponseStatus<Volatile['response'], MacroContext['return'] & {}>>>>>;
|
|
1767
|
-
}>, Ephemeral, Volatile>;
|
|
1768
|
-
/**
|
|
1769
|
-
* ### state
|
|
1770
|
-
* Assign global mutatable state accessible for all handler
|
|
1771
|
-
*
|
|
1772
|
-
* ---
|
|
1773
|
-
* @example
|
|
1774
|
-
* ```typescript
|
|
1775
|
-
* new Elysia()
|
|
1776
|
-
* .state('counter', 0)
|
|
1777
|
-
* .get('/', (({ counter }) => ++counter)
|
|
1778
|
-
* ```
|
|
1779
|
-
*/
|
|
1780
|
-
state<const Name extends string | number | symbol, Value>(name: Name, value: Value): Elysia<BasePath, {
|
|
1781
|
-
decorator: Singleton['decorator'];
|
|
1782
|
-
store: Prettify<Singleton['store'] & {
|
|
1783
|
-
[name in Name]: Value;
|
|
1784
|
-
}>;
|
|
1785
|
-
derive: Singleton['derive'];
|
|
1786
|
-
resolve: Singleton['resolve'];
|
|
1787
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1788
|
-
/**
|
|
1789
|
-
* ### state
|
|
1790
|
-
* Assign global mutatable state accessible for all handler
|
|
1791
|
-
*
|
|
1792
|
-
* ---
|
|
1793
|
-
* @example
|
|
1794
|
-
* ```typescript
|
|
1795
|
-
* new Elysia()
|
|
1796
|
-
* .state({ counter: 0 })
|
|
1797
|
-
* .get('/', (({ counter }) => ++counter)
|
|
1798
|
-
* ```
|
|
1799
|
-
*/
|
|
1800
|
-
state<Store extends Record<string, unknown>>(store: Store): Elysia<BasePath, {
|
|
1801
|
-
decorator: Singleton['decorator'];
|
|
1802
|
-
store: Prettify<Singleton['store'] & Store>;
|
|
1803
|
-
derive: Singleton['derive'];
|
|
1804
|
-
resolve: Singleton['resolve'];
|
|
1805
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1806
|
-
/**
|
|
1807
|
-
* ### state
|
|
1808
|
-
* Assign global mutatable state accessible for all handler
|
|
1809
|
-
*
|
|
1810
|
-
* ---
|
|
1811
|
-
* @example
|
|
1812
|
-
* ```typescript
|
|
1813
|
-
* new Elysia()
|
|
1814
|
-
* .state('counter', 0)
|
|
1815
|
-
* .get('/', (({ counter }) => ++counter)
|
|
1816
|
-
* ```
|
|
1817
|
-
*/
|
|
1818
|
-
state<const Type extends ContextAppendType, const Name extends string | number | symbol, Value>(options: {
|
|
1819
|
-
as: Type;
|
|
1820
|
-
}, name: Name, value: Value): Elysia<BasePath, {
|
|
1821
|
-
decorator: Singleton['decorator'];
|
|
1822
|
-
store: Type extends 'override' ? Reconcile<Singleton['store'], {
|
|
1823
|
-
[name in Name]: Value;
|
|
1824
|
-
}, true> : Prettify<Singleton['store'] & {
|
|
1825
|
-
[name in Name]: Value;
|
|
1826
|
-
}>;
|
|
1827
|
-
derive: Singleton['derive'];
|
|
1828
|
-
resolve: Singleton['resolve'];
|
|
1829
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1830
|
-
/**
|
|
1831
|
-
* ### state
|
|
1832
|
-
* Assign global mutatable state accessible for all handler
|
|
1833
|
-
*
|
|
1834
|
-
* ---
|
|
1835
|
-
* @example
|
|
1836
|
-
* ```typescript
|
|
1837
|
-
* new Elysia()
|
|
1838
|
-
* .state({ counter: 0 })
|
|
1839
|
-
* .get('/', (({ counter }) => ++counter)
|
|
1840
|
-
* ```
|
|
1841
|
-
*/
|
|
1842
|
-
state<const Type extends ContextAppendType, Store extends Record<string, unknown>>(options: {
|
|
1843
|
-
as: Type;
|
|
1844
|
-
}, store: Store): Elysia<BasePath, {
|
|
1845
|
-
decorator: Singleton['decorator'];
|
|
1846
|
-
store: Type extends 'override' ? Reconcile<Singleton['store'], Store> : Prettify<Singleton['store'] & Store>;
|
|
1847
|
-
derive: Singleton['derive'];
|
|
1848
|
-
resolve: Singleton['resolve'];
|
|
1849
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1850
|
-
state<NewStore extends Record<string, unknown>>(mapper: (decorators: Singleton['store']) => NewStore): Elysia<BasePath, {
|
|
1851
|
-
decorator: Singleton['decorator'];
|
|
1852
|
-
store: NewStore;
|
|
1853
|
-
derive: Singleton['derive'];
|
|
1854
|
-
resolve: Singleton['resolve'];
|
|
1855
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1856
|
-
/**
|
|
1857
|
-
* ### decorate
|
|
1858
|
-
* Define custom method to `Context` accessible for all handler
|
|
1859
|
-
*
|
|
1860
|
-
* ---
|
|
1861
|
-
* @example
|
|
1862
|
-
* ```typescript
|
|
1863
|
-
* new Elysia()
|
|
1864
|
-
* .decorate('getDate', () => Date.now())
|
|
1865
|
-
* .get('/', (({ getDate }) => getDate())
|
|
1866
|
-
* ```
|
|
1867
|
-
*/
|
|
1868
|
-
decorate<const Name extends string, Value>(name: Name, value: Value): Elysia<BasePath, {
|
|
1869
|
-
decorator: Singleton['decorator'] & {
|
|
1870
|
-
[name in Name]: Value;
|
|
1871
|
-
};
|
|
1872
|
-
store: Singleton['store'];
|
|
1873
|
-
derive: Singleton['derive'];
|
|
1874
|
-
resolve: Singleton['resolve'];
|
|
1875
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1876
|
-
/**
|
|
1877
|
-
* ### decorate
|
|
1878
|
-
* Define custom method to `Context` accessible for all handler
|
|
1879
|
-
*
|
|
1880
|
-
* ---
|
|
1881
|
-
* @example
|
|
1882
|
-
* ```typescript
|
|
1883
|
-
* new Elysia()
|
|
1884
|
-
* .decorate('getDate', () => Date.now())
|
|
1885
|
-
* .get('/', (({ getDate }) => getDate())
|
|
1886
|
-
* ```
|
|
1887
|
-
*/
|
|
1888
|
-
decorate<NewDecorators extends Record<string, unknown>>(decorators: NewDecorators): Elysia<BasePath, {
|
|
1889
|
-
decorator: Singleton['decorator'] & NewDecorators;
|
|
1890
|
-
store: Singleton['store'];
|
|
1891
|
-
derive: Singleton['derive'];
|
|
1892
|
-
resolve: Singleton['resolve'];
|
|
1893
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1894
|
-
decorate<NewDecorators extends Record<string, unknown>>(mapper: (decorators: Singleton['decorator']) => NewDecorators): Elysia<BasePath, {
|
|
1895
|
-
decorator: NewDecorators;
|
|
1896
|
-
store: Singleton['store'];
|
|
1897
|
-
derive: Singleton['derive'];
|
|
1898
|
-
resolve: Singleton['resolve'];
|
|
1899
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1900
|
-
/**
|
|
1901
|
-
* ### decorate
|
|
1902
|
-
* Define custom method to `Context` accessible for all handler
|
|
1903
|
-
*
|
|
1904
|
-
* ---
|
|
1905
|
-
* @example
|
|
1906
|
-
* ```typescript
|
|
1907
|
-
* new Elysia()
|
|
1908
|
-
* .decorate({ as: 'override' }, 'getDate', () => Date.now())
|
|
1909
|
-
* .get('/', (({ getDate }) => getDate())
|
|
1910
|
-
* ```
|
|
1911
|
-
*/
|
|
1912
|
-
decorate<const Type extends ContextAppendType, const Name extends string, Value>(options: {
|
|
1913
|
-
as: Type;
|
|
1914
|
-
}, name: Name, value: Value): Elysia<BasePath, {
|
|
1915
|
-
decorator: Type extends 'override' ? Reconcile<Singleton['decorator'], {
|
|
1916
|
-
[name in Name]: Value;
|
|
1917
|
-
}, true> : Singleton['decorator'] & {
|
|
1918
|
-
[name in Name]: Value;
|
|
1919
|
-
};
|
|
1920
|
-
store: Singleton['store'];
|
|
1921
|
-
derive: Singleton['derive'];
|
|
1922
|
-
resolve: Singleton['resolve'];
|
|
1923
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1924
|
-
/**
|
|
1925
|
-
* ### decorate
|
|
1926
|
-
* Define custom method to `Context` accessible for all handler
|
|
1927
|
-
*
|
|
1928
|
-
* ---
|
|
1929
|
-
* @example
|
|
1930
|
-
* ```typescript
|
|
1931
|
-
* new Elysia()
|
|
1932
|
-
* .decorate('getDate', () => Date.now())
|
|
1933
|
-
* .get('/', (({ getDate }) => getDate())
|
|
1934
|
-
* ```
|
|
1935
|
-
*/
|
|
1936
|
-
decorate<const Type extends ContextAppendType, NewDecorators extends Record<string, unknown>>(options: {
|
|
1937
|
-
as: Type;
|
|
1938
|
-
}, decorators: NewDecorators): Elysia<BasePath, {
|
|
1939
|
-
decorator: Type extends 'override' ? Reconcile<Singleton['decorator'], NewDecorators, true> : Singleton['decorator'] & NewDecorators;
|
|
1940
|
-
store: Singleton['store'];
|
|
1941
|
-
derive: Singleton['derive'];
|
|
1942
|
-
resolve: Singleton['resolve'];
|
|
1943
|
-
}, Definitions, Metadata, Routes, Ephemeral, Volatile>;
|
|
1944
|
-
/**
|
|
1945
|
-
* Derive new property for each request with access to `Context`.
|
|
1946
|
-
*
|
|
1947
|
-
* If error is thrown, the scope will skip to handling error instead.
|
|
1948
|
-
*
|
|
1949
|
-
* ---
|
|
1950
|
-
* @example
|
|
1951
|
-
* new Elysia()
|
|
1952
|
-
* .state('counter', 1)
|
|
1953
|
-
* .derive(({ store }) => ({
|
|
1954
|
-
* increase() {
|
|
1955
|
-
* store.counter++
|
|
1956
|
-
* }
|
|
1957
|
-
* }))
|
|
1958
|
-
*/
|
|
1959
|
-
derive<const Derivative extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any> | void>(transform: (context: Context<MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'], Singleton & {
|
|
1960
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1961
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
1962
|
-
}>) => MaybePromise<Derivative>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
1963
|
-
derive: Volatile['derive'] & ExcludeElysiaResponse<Derivative>;
|
|
1964
|
-
resolve: Volatile['resolve'];
|
|
1965
|
-
schema: Volatile['schema'];
|
|
1966
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
1967
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Derivative>>;
|
|
1968
|
-
}>;
|
|
1969
|
-
/**
|
|
1970
|
-
* Derive new property for each request with access to `Context`.
|
|
1971
|
-
*
|
|
1972
|
-
* If error is thrown, the scope will skip to handling error instead.
|
|
1973
|
-
*
|
|
1974
|
-
* ---
|
|
1975
|
-
* @example
|
|
1976
|
-
* new Elysia()
|
|
1977
|
-
* .state('counter', 1)
|
|
1978
|
-
* .derive(({ store }) => ({
|
|
1979
|
-
* increase() {
|
|
1980
|
-
* store.counter++
|
|
1981
|
-
* }
|
|
1982
|
-
* }))
|
|
1983
|
-
*/
|
|
1984
|
-
derive<const Derivative extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any> | void, const Type extends LifeCycleType>(options: {
|
|
1985
|
-
as: Type;
|
|
1986
|
-
}, transform: (context: Context<MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>, BasePath> & Metadata['standaloneSchema'] & Ephemeral['standaloneSchema'] & Volatile['standaloneSchema'] & 'global' extends Type ? {
|
|
1987
|
-
params: {
|
|
1988
|
-
[name: string]: string | undefined;
|
|
1989
|
-
};
|
|
1990
|
-
} : 'scoped' extends Type ? {
|
|
1991
|
-
params: {
|
|
1992
|
-
[name: string]: string | undefined;
|
|
1993
|
-
};
|
|
1994
|
-
} : {}, Singleton & ('global' extends Type ? {
|
|
1995
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
1996
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
1997
|
-
} : 'scoped' extends Type ? {
|
|
1998
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
1999
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
2000
|
-
} : {
|
|
2001
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
2002
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
2003
|
-
}), BasePath>) => MaybePromise<Derivative>): Type extends 'global' ? Elysia<BasePath, {
|
|
2004
|
-
decorator: Singleton['decorator'];
|
|
2005
|
-
store: Singleton['store'];
|
|
2006
|
-
derive: Singleton['derive'] & ExcludeElysiaResponse<Derivative>;
|
|
2007
|
-
resolve: Singleton['resolve'];
|
|
2008
|
-
}, Definitions, {
|
|
2009
|
-
schema: Metadata['schema'];
|
|
2010
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
2011
|
-
macro: Metadata['macro'];
|
|
2012
|
-
macroFn: Metadata['macroFn'];
|
|
2013
|
-
parser: Metadata['parser'];
|
|
2014
|
-
response: UnionResponseStatus<Metadata['response'], ExtractErrorFromHandle<Derivative>>;
|
|
2015
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
2016
|
-
derive: Ephemeral['derive'] & ExcludeElysiaResponse<Derivative>;
|
|
2017
|
-
resolve: Ephemeral['resolve'];
|
|
2018
|
-
schema: Ephemeral['schema'];
|
|
2019
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
2020
|
-
response: UnionResponseStatus<Ephemeral['response'], ExtractErrorFromHandle<Derivative>>;
|
|
2021
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
2022
|
-
derive: Volatile['derive'] & ExcludeElysiaResponse<Derivative>;
|
|
2023
|
-
resolve: Ephemeral['resolve'];
|
|
2024
|
-
schema: Volatile['schema'];
|
|
2025
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
2026
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<Derivative>>;
|
|
2027
|
-
}>;
|
|
2028
|
-
model<const Name extends string, const Model extends TSchema | StandardSchemaV1Like>(name: Name, model: Model): Elysia<BasePath, Singleton, {
|
|
2029
|
-
typebox: Definitions['typebox'] & {
|
|
2030
|
-
[name in Name]: Model;
|
|
2031
|
-
};
|
|
2032
|
-
error: Definitions['error'];
|
|
2033
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2034
|
-
model<const Recorder extends Record<string, TSchema | StandardSchemaV1Like>>(record: Recorder): Elysia<BasePath, Singleton, {
|
|
2035
|
-
typebox: Definitions['typebox'] & Recorder;
|
|
2036
|
-
error: Definitions['error'];
|
|
2037
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2038
|
-
model<const NewType extends Record<string, TSchema | StandardSchemaV1Like>>(mapper: (decorators: Definitions['typebox'] extends infer Models ? {
|
|
2039
|
-
[Name in keyof Models]: Models[Name] extends TSchema ? TRef<Name & string> : Models[Name];
|
|
2040
|
-
} : {}) => NewType): Elysia<BasePath, Singleton, {
|
|
2041
|
-
typebox: {
|
|
2042
|
-
[Name in keyof NewType]: NewType[Name] extends TRef<Name & string> ? Definitions['typebox'][Name] : NewType[Name];
|
|
2043
|
-
};
|
|
2044
|
-
error: Definitions['error'];
|
|
2045
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2046
|
-
Ref<K extends keyof Extract<Definitions['typebox'], TAnySchema> & string>(key: K): TRef<K>;
|
|
2047
|
-
mapDerive<const NewDerivative extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any>>(mapper: (context: Context<{}, Singleton & {
|
|
2048
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
2049
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
2050
|
-
}, BasePath>) => MaybePromise<NewDerivative>): Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
2051
|
-
derive: ExcludeElysiaResponse<NewDerivative>;
|
|
2052
|
-
resolve: Volatile['resolve'];
|
|
2053
|
-
schema: Volatile['schema'];
|
|
2054
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
2055
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<NewDerivative>>;
|
|
2056
|
-
}>;
|
|
2057
|
-
mapDerive<const NewDerivative extends Record<string, unknown> | ElysiaCustomStatusResponse<any, any, any>, const Type extends LifeCycleType>(options: {
|
|
2058
|
-
as: Type;
|
|
2059
|
-
}, mapper: (context: Context<{}, Singleton & ('global' extends Type ? {
|
|
2060
|
-
derive: Partial<Ephemeral['derive'] & Volatile['derive']>;
|
|
2061
|
-
resolve: Partial<Ephemeral['resolve'] & Volatile['resolve']>;
|
|
2062
|
-
} : 'scoped' extends Type ? {
|
|
2063
|
-
derive: Ephemeral['derive'] & Partial<Volatile['derive']>;
|
|
2064
|
-
resolve: Ephemeral['resolve'] & Partial<Volatile['resolve']>;
|
|
2065
|
-
} : {
|
|
2066
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
2067
|
-
resolve: Ephemeral['resolve'] & Volatile['resolve'];
|
|
2068
|
-
}), BasePath>) => MaybePromise<NewDerivative>): Type extends 'global' ? Elysia<BasePath, {
|
|
2069
|
-
decorator: Singleton['decorator'];
|
|
2070
|
-
store: Singleton['store'];
|
|
2071
|
-
derive: Singleton['derive'] & ExcludeElysiaResponse<NewDerivative>;
|
|
2072
|
-
resolve: Singleton['resolve'];
|
|
2073
|
-
}, Definitions, {
|
|
2074
|
-
schema: Metadata['schema'];
|
|
2075
|
-
standaloneSchema: Metadata['standaloneSchema'];
|
|
2076
|
-
macro: Metadata['macro'];
|
|
2077
|
-
macroFn: Metadata['macroFn'];
|
|
2078
|
-
parser: Metadata['parser'];
|
|
2079
|
-
response: UnionResponseStatus<Metadata['response'], ExtractErrorFromHandle<NewDerivative>>;
|
|
2080
|
-
}, Routes, Ephemeral, Volatile> : Type extends 'scoped' ? Elysia<BasePath, Singleton, Definitions, Metadata, Routes, {
|
|
2081
|
-
derive: Ephemeral['derive'] & ExcludeElysiaResponse<NewDerivative>;
|
|
2082
|
-
resolve: Ephemeral['resolve'];
|
|
2083
|
-
schema: Ephemeral['schema'];
|
|
2084
|
-
standaloneSchema: Ephemeral['standaloneSchema'];
|
|
2085
|
-
response: UnionResponseStatus<Ephemeral['response'], ExtractErrorFromHandle<NewDerivative>>;
|
|
2086
|
-
}, Volatile> : Elysia<BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, {
|
|
2087
|
-
derive: Volatile['derive'];
|
|
2088
|
-
resolve: Volatile['resolve'] & ExcludeElysiaResponse<NewDerivative>;
|
|
2089
|
-
schema: Volatile['schema'];
|
|
2090
|
-
standaloneSchema: Volatile['standaloneSchema'];
|
|
2091
|
-
response: UnionResponseStatus<Volatile['response'], ExtractErrorFromHandle<NewDerivative>>;
|
|
2092
|
-
}>;
|
|
2093
|
-
affix<const Base extends 'prefix' | 'suffix', const Type extends 'all' | 'decorator' | 'state' | 'model' | 'error', const Word extends string>(base: Base, type: Type, word: Word): Elysia<BasePath, {
|
|
2094
|
-
decorator: Type extends 'decorator' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Singleton['decorator']> : AddPrefixCapitalize<Word, Singleton['decorator']> : AddSuffixCapitalize<Word, Singleton['decorator']> : Singleton['decorator'];
|
|
2095
|
-
store: Type extends 'state' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Singleton['store']> : AddPrefixCapitalize<Word, Singleton['store']> : AddSuffix<Word, Singleton['store']> : Singleton['store'];
|
|
2096
|
-
derive: Type extends 'decorator' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Singleton['derive']> : AddPrefixCapitalize<Word, Singleton['derive']> : AddSuffixCapitalize<Word, Singleton['derive']> : Singleton['derive'];
|
|
2097
|
-
resolve: Type extends 'decorator' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Singleton['resolve']> : AddPrefixCapitalize<Word, Singleton['resolve']> : AddSuffixCapitalize<Word, Singleton['resolve']> : Singleton['resolve'];
|
|
2098
|
-
}, {
|
|
2099
|
-
typebox: Type extends 'model' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Definitions['typebox']> : AddPrefixCapitalize<Word, Definitions['typebox']> : AddSuffixCapitalize<Word, Definitions['typebox']> : Definitions['typebox'];
|
|
2100
|
-
error: Type extends 'error' | 'all' ? 'prefix' extends Base ? Word extends `${string}${'_' | '-' | ' '}` ? AddPrefix<Word, Definitions['error']> : AddPrefixCapitalize<Word, Definitions['error']> : AddSuffixCapitalize<Word, Definitions['error']> : Definitions['error'];
|
|
2101
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2102
|
-
prefix<const Type extends 'all' | 'decorator' | 'state' | 'model' | 'error', const Word extends string>(type: Type, word: Word): Elysia<BasePath, {
|
|
2103
|
-
decorator: Type extends "decorator" | "all" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Singleton["decorator"]> : AddPrefixCapitalize<Word, Singleton["decorator"]> : Singleton["decorator"];
|
|
2104
|
-
store: Type extends "all" | "state" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Singleton["store"]> : AddPrefixCapitalize<Word, Singleton["store"]> : Singleton["store"];
|
|
2105
|
-
derive: Type extends "decorator" | "all" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Singleton["derive"]> : AddPrefixCapitalize<Word, Singleton["derive"]> : Singleton["derive"];
|
|
2106
|
-
resolve: Type extends "decorator" | "all" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Singleton["resolve"]> : AddPrefixCapitalize<Word, Singleton["resolve"]> : Singleton["resolve"];
|
|
2107
|
-
}, {
|
|
2108
|
-
typebox: Type extends "all" | "model" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Definitions["typebox"]> : AddPrefixCapitalize<Word, Definitions["typebox"]> : Definitions["typebox"];
|
|
2109
|
-
error: Type extends "error" | "all" ? Word extends `${string} ` | `${string}-` | `${string}_` ? AddPrefix<Word, Definitions["error"]> : AddPrefixCapitalize<Word, Definitions["error"]> : Definitions["error"];
|
|
2110
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2111
|
-
suffix<const Type extends 'all' | 'decorator' | 'state' | 'model' | 'error', const Word extends string>(type: Type, word: Word): Elysia<BasePath, {
|
|
2112
|
-
decorator: Type extends "decorator" | "all" ? AddSuffixCapitalize<Word, Singleton["decorator"]> : Singleton["decorator"];
|
|
2113
|
-
store: Type extends "all" | "state" ? AddSuffix<Word, Singleton["store"]> : Singleton["store"];
|
|
2114
|
-
derive: Type extends "decorator" | "all" ? AddSuffixCapitalize<Word, Singleton["derive"]> : Singleton["derive"];
|
|
2115
|
-
resolve: Type extends "decorator" | "all" ? AddSuffixCapitalize<Word, Singleton["resolve"]> : Singleton["resolve"];
|
|
2116
|
-
}, {
|
|
2117
|
-
typebox: Type extends "all" | "model" ? AddSuffixCapitalize<Word, Definitions["typebox"]> : Definitions["typebox"];
|
|
2118
|
-
error: Type extends "error" | "all" ? AddSuffixCapitalize<Word, Definitions["error"]> : Definitions["error"];
|
|
2119
|
-
}, Metadata, Routes, Ephemeral, Volatile>;
|
|
2120
|
-
compile(): this;
|
|
2121
|
-
handle: (request: Request) => Promise<Response>;
|
|
2122
|
-
/**
|
|
2123
|
-
* Use handle can be either sync or async to save performance.
|
|
2124
|
-
*
|
|
2125
|
-
* Beside benchmark purpose, please use 'handle' instead.
|
|
2126
|
-
*/
|
|
2127
|
-
get fetch(): (request: Request) => MaybePromise<Response>;
|
|
2128
|
-
/**
|
|
2129
|
-
* Custom handle written by adapter
|
|
2130
|
-
*/
|
|
2131
|
-
protected _handle?(...a: unknown[]): unknown;
|
|
2132
|
-
protected handleError: (context: Partial<Context<MergeSchema<Metadata["schema"], MergeSchema<Ephemeral["schema"], Volatile["schema"]>> & Metadata["standaloneSchema"] & Ephemeral["standaloneSchema"] & Volatile["standaloneSchema"], Singleton & {
|
|
2133
|
-
derive: Ephemeral["derive"] & Volatile["derive"];
|
|
2134
|
-
resolve: Ephemeral["resolve"] & Volatile["resolve"];
|
|
2135
|
-
}, BasePath>> & {
|
|
2136
|
-
request: Request;
|
|
2137
|
-
}, error: Error | ValidationError | ParseError | NotFoundError | InternalServerError) => Promise<any>;
|
|
2138
|
-
/**
|
|
2139
|
-
* ### listen
|
|
2140
|
-
* Assign current instance to port and start serving
|
|
2141
|
-
*
|
|
2142
|
-
* ---
|
|
2143
|
-
* @example
|
|
2144
|
-
* ```typescript
|
|
2145
|
-
* new Elysia()
|
|
2146
|
-
* .get("/", () => 'hi')
|
|
2147
|
-
* .listen(3000)
|
|
2148
|
-
* ```
|
|
2149
|
-
*/
|
|
2150
|
-
listen: (options: string | number | Partial<Serve>, callback?: ListenCallback) => this;
|
|
2151
|
-
/**
|
|
2152
|
-
* ### stop
|
|
2153
|
-
* Stop server from serving
|
|
2154
|
-
*
|
|
2155
|
-
* ---
|
|
2156
|
-
* @example
|
|
2157
|
-
* ```typescript
|
|
2158
|
-
* const app = new Elysia()
|
|
2159
|
-
* .get("/", () => 'hi')
|
|
2160
|
-
* .listen(3000)
|
|
2161
|
-
*
|
|
2162
|
-
* // Sometime later
|
|
2163
|
-
* app.stop()
|
|
2164
|
-
* ```
|
|
2165
|
-
*
|
|
2166
|
-
* @example
|
|
2167
|
-
* ```typescript
|
|
2168
|
-
* const app = new Elysia()
|
|
2169
|
-
* .get("/", () => 'hi')
|
|
2170
|
-
* .listen(3000)
|
|
2171
|
-
*
|
|
2172
|
-
* app.stop(true) // Abruptly any requests inflight
|
|
2173
|
-
* ```
|
|
2174
|
-
*/
|
|
2175
|
-
stop: (closeActiveConnections?: boolean) => Promise<this>;
|
|
2176
|
-
[Symbol.dispose]: () => void;
|
|
2177
|
-
/**
|
|
2178
|
-
* Wait until all lazy loaded modules all load is fully
|
|
2179
|
-
*/
|
|
2180
|
-
get modules(): PromiseGroup;
|
|
2181
|
-
}
|
|
2182
|
-
export { Elysia };
|
|
2183
|
-
export { t } from './type-system';
|
|
2184
|
-
export { validationDetail, fileType } from './type-system/utils';
|
|
2185
|
-
export type { ElysiaTypeCustomError, ElysiaTypeCustomErrorCallback } from './type-system/types';
|
|
2186
|
-
export { serializeCookie, Cookie, type CookieOptions } from './cookies';
|
|
2187
|
-
export type { Context, PreContext, ErrorContext } from './context';
|
|
2188
|
-
export { ELYSIA_TRACE, type TraceEvent, type TraceListener, type TraceHandler, type TraceProcess, type TraceStream } from './trace';
|
|
2189
|
-
export { getSchemaValidator, getResponseSchemaValidator } from './schema';
|
|
2190
|
-
export { replaceSchemaTypeFromManyOptions as replaceSchemaType } from './replace-schema';
|
|
2191
|
-
export { mergeHook, mergeObjectArray, redirect, StatusMap, InvertedStatusMap, form, replaceUrlPath, checksum, cloneInference, deduplicateChecksum, ELYSIA_FORM_DATA, ELYSIA_REQUEST_ID, sse } from './utils';
|
|
2192
|
-
export { status, mapValueError, ParseError, NotFoundError, ValidationError, InvalidFileType, InternalServerError, InvalidCookieSignature, ERROR_CODE, ElysiaStatus, ElysiaCustomStatusResponse, type SelectiveStatus } from './error';
|
|
2193
|
-
export type { EphemeralType, CreateEden, ComposeElysiaResponse, ElysiaConfig, SingletonBase, DefinitionBase, RouteBase, Handler, ComposedHandler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, SchemaValidator, VoidHandler, PreHandler, BodyHandler, OptionalHandler, AfterResponseHandler, ErrorHandler, LifeCycleEvent, LifeCycleStore, LifeCycleType, MaybePromise, UnwrapSchema, AnySchema, ModelsToTypes, Checksum, DocumentDecoration, InferContext, InferHandler, ResolvePath, MapResponse, BaseMacro, MacroManager, MacroToProperty, MergeElysiaInstances, MaybeArray, ModelValidator, MetadataBase, UnwrapBodySchema, UnwrapGroupGuardRoute, ModelValidatorError, ExcludeElysiaResponse, SSEPayload, StandaloneInputSchema, MergeStandaloneSchema, MergeTypeModule, GracefulHandler, AfterHandler, InlineHandler, ResolveHandler, TransformHandler, HTTPHeaders, EmptyRouteSchema, ExtractErrorFromHandle } from './types';
|
|
2194
|
-
export { env } from './universal/env';
|
|
2195
|
-
export { file, ElysiaFile } from './universal/file';
|
|
2196
|
-
export type { ElysiaAdapter } from './adapter';
|
|
2197
|
-
export { TypeSystemPolicy } from '@sinclair/typebox/system';
|
|
2198
|
-
export type { Static, TSchema } from '@sinclair/typebox';
|
|
1
|
+
import { BaseCookie, CookieOptions } from "./cookie/types.js";
|
|
2
|
+
import { Cookie } from "./cookie/cookie.js";
|
|
3
|
+
import { StatusMap, StatusMapBack } from "./constants.js";
|
|
4
|
+
import { ElysiaError, ElysiaStatus, InternalServerError, NotFound, ParseError, Problem, SelectiveStatus, ValidationError, problem, status, validationDetail } from "./error.js";
|
|
5
|
+
import { ElysiaFile, file } from "./universal/file.js";
|
|
6
|
+
import { env } from "./universal/env.js";
|
|
7
|
+
import { Server } from "./universal/server.js";
|
|
8
|
+
import { HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, RouteSchema, SSEPayload, UnwrapRoute, UnwrapSchema } from "./types.js";
|
|
9
|
+
import { bytes, form, prefix, redirect, sse } from "./utils.js";
|
|
10
|
+
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
11
|
+
import { InvalidCookie } from "./cookie/error.js";
|
|
12
|
+
import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like } from "./type/types.js";
|
|
13
|
+
import { TCookieField, TCookieObject } from "./type/elysia/cookie.js";
|
|
14
|
+
import { FileTypeDetector, fileType, setFileTypeDetector } from "./type/elysia/file-type.js";
|
|
15
|
+
import { TFiles } from "./type/elysia/files.js";
|
|
16
|
+
import { setupTypebox } from "./type/compat.js";
|
|
17
|
+
import { MultiValidator, StandardValidator, Validator } from "./validator/index.js";
|
|
18
|
+
import { TypeBoxValidator } from "./type/validator/index.js";
|
|
19
|
+
import { TypeSystem, t } from "./type/index.js";
|
|
20
|
+
import { AotFingerprint, Capture, Compiled, CompilerSession, ProgramId } from "./compile/aot.js";
|
|
21
|
+
import { AnyElysia, Elysia } from "./base.js";
|
|
22
|
+
import { borrow } from "./adapter/response-ownership.js";
|
|
23
|
+
export { AnyElysia, type AnySchema, type AotFingerprint, type BaseCookie, type BaseSchema, Compiled, type CompilerSession, type Context, type Cookie, type CookieOptions, Elysia, Elysia as default, ElysiaError, ElysiaFile, ElysiaStatus, type ErrorContext, type FileTypeDetector, type HTTPHeaders, type InputSchema, InternalServerError, InvalidCookie, type Macro, type MacroToContext, type MacroToProperty, Capture as Manifest, MultiValidator, NotFound, ParseError, type Problem, type ProgramId, type RouteSchema, type SSEPayload, type SelectiveStatus, type Server, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, StandardValidator, StatusMap, StatusMapBack, type TCookieField, type TCookieObject, type TFiles, TypeBoxValidator, TypeSystem, type UnwrapRoute, type UnwrapSchema, ValidationError, Validator, borrow, bytes, createBaseContext, createContext, env, file, fileType, form, prefix, problem, redirect, setFileTypeDetector, setupTypebox, sse, status, t, validationDetail };
|