Showing preview only (2,158K chars total). Download the full file or copy to clipboard to get everything.
Repository: elysiajs/elysia
Branch: main
Commit: 56310be9617b
Files: 270
Total size: 2.0 MB
Directory structure:
gitextract_5rm6upbg/
├── .eslintrc.json
├── .github/
│ ├── FUNDING.yaml
│ ├── ISSUE_TEMPLATE/
│ │ ├── 2-bug-report.yml
│ │ ├── 3-feature-request.yml
│ │ └── config.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── ci.yml
│ └── publish.yml
├── .gitignore
├── .npmignore
├── .npmrc
├── .prettierrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── build.ts
├── example/
│ ├── a.ts
│ ├── async-recursive.ts
│ ├── body.ts
│ ├── cookie.ts
│ ├── counter.ts
│ ├── custom-response.ts
│ ├── derive.ts
│ ├── error.ts
│ ├── extension.ts
│ ├── file.ts
│ ├── guard.ts
│ ├── headers.ts
│ ├── hook.ts
│ ├── html-import.ts
│ ├── http.ts
│ ├── index.html
│ ├── lazy/
│ │ └── index.ts
│ ├── lazy-module.ts
│ ├── native.ts
│ ├── nested-multipart-files.ts
│ ├── nested-schema.ts
│ ├── newFile.ts
│ ├── openapi.ts
│ ├── params.ts
│ ├── proxy.ts
│ ├── redirect.ts
│ ├── rename.ts
│ ├── response.ts
│ ├── router.ts
│ ├── schema.ts
│ ├── simple.ts
│ ├── sleep.ts
│ ├── spawn.ts
│ ├── store.ts
│ ├── stress/
│ │ ├── a.ts
│ │ ├── decorate.ts
│ │ ├── instance.ts
│ │ ├── memoir.ts
│ │ ├── multiple-routes.ts
│ │ └── sucrose.ts
│ ├── type-inference.ts
│ ├── uint8array.ts
│ ├── upload.ts
│ ├── video.ts
│ └── websocket.ts
├── knip.json
├── package.json
├── src/
│ ├── adapter/
│ │ ├── bun/
│ │ │ ├── compose.ts
│ │ │ ├── handler-native.ts
│ │ │ ├── handler.ts
│ │ │ └── index.ts
│ │ ├── cloudflare-worker/
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── types.ts
│ │ ├── utils.ts
│ │ └── web-standard/
│ │ ├── handler.ts
│ │ └── index.ts
│ ├── compose.ts
│ ├── context.ts
│ ├── cookies.ts
│ ├── dynamic-handle.ts
│ ├── error.ts
│ ├── formats.ts
│ ├── index.ts
│ ├── manifest.ts
│ ├── parse-query.ts
│ ├── replace-schema.ts
│ ├── schema.ts
│ ├── sucrose.ts
│ ├── trace.ts
│ ├── type-system/
│ │ ├── format.ts
│ │ ├── index.ts
│ │ ├── types.ts
│ │ └── utils.ts
│ ├── types.ts
│ ├── universal/
│ │ ├── env.ts
│ │ ├── file.ts
│ │ ├── index.ts
│ │ ├── request.ts
│ │ ├── server.ts
│ │ ├── types.ts
│ │ └── utils.ts
│ ├── utils.ts
│ └── ws/
│ ├── bun.ts
│ ├── index.ts
│ └── types.ts
├── test/
│ ├── adapter/
│ │ ├── bun/
│ │ │ └── index.test.ts
│ │ └── web-standard/
│ │ ├── cookie-to-header.test.ts
│ │ ├── map-compact-response.test.ts
│ │ ├── map-early-response.test.ts
│ │ ├── map-response.test.ts
│ │ ├── set-cookie.test.ts
│ │ └── utils.ts
│ ├── aot/
│ │ ├── analysis.test.ts
│ │ ├── generation.test.ts
│ │ ├── has-transform.test.ts
│ │ ├── has-type.test.ts
│ │ └── response.test.ts
│ ├── bun/
│ │ ├── router.test.ts
│ │ └── sql.test.ts
│ ├── cloudflare/
│ │ ├── .gitignore
│ │ ├── package.json
│ │ ├── script/
│ │ │ └── test.ts
│ │ ├── src/
│ │ │ └── index.ts
│ │ ├── tsconfig.json
│ │ ├── worker-configuration.d.ts
│ │ └── wrangler.jsonc
│ ├── cookie/
│ │ ├── explicit.test.ts
│ │ ├── implicit.test.ts
│ │ ├── response.test.ts
│ │ ├── signature.test.ts
│ │ └── unchanged.test.ts
│ ├── core/
│ │ ├── aot-strictpath.test.ts
│ │ ├── as.test.ts
│ │ ├── before-handle-arrow.test.ts
│ │ ├── compose.test.ts
│ │ ├── config.test.ts
│ │ ├── context.test.ts
│ │ ├── dynamic.test.ts
│ │ ├── elysia.test.ts
│ │ ├── formdata.test.ts
│ │ ├── handle-error.test.ts
│ │ ├── macro-lifecycle.test.ts
│ │ ├── modules.test.ts
│ │ ├── mount.test.ts
│ │ ├── native-static.test.ts
│ │ ├── normalize.test.ts
│ │ ├── path.test.ts
│ │ ├── redirect.test.ts
│ │ ├── sanitize.test.ts
│ │ ├── status.test.ts
│ │ └── stop.test.ts
│ ├── extends/
│ │ ├── decorators.test.ts
│ │ ├── error.test.ts
│ │ ├── models.test.ts
│ │ └── store.test.ts
│ ├── hoc/
│ │ └── index.test.ts
│ ├── lifecycle/
│ │ ├── after-handle.test.ts
│ │ ├── after-response.test.ts
│ │ ├── before-handle.test.ts
│ │ ├── derive.test.ts
│ │ ├── error.test.ts
│ │ ├── hook-types.test.ts
│ │ ├── map-derive.test.ts
│ │ ├── map-resolve.test.ts
│ │ ├── map-response.test.ts
│ │ ├── parser.test.ts
│ │ ├── request.test.ts
│ │ ├── resolve.test.ts
│ │ ├── response.test.ts
│ │ └── transform.test.ts
│ ├── macro/
│ │ └── macro.test.ts
│ ├── modules.ts
│ ├── node/
│ │ ├── .gitignore
│ │ ├── cjs/
│ │ │ ├── bun.lockb
│ │ │ ├── index.js
│ │ │ └── package.json
│ │ └── esm/
│ │ ├── bun.lockb
│ │ ├── index.js
│ │ └── package.json
│ ├── path/
│ │ ├── group.test.ts
│ │ ├── guard.test.ts
│ │ └── path.test.ts
│ ├── plugins/
│ │ ├── affix.test.ts
│ │ ├── checksum.test.ts
│ │ ├── error-propagation.test.ts
│ │ └── plugin.test.ts
│ ├── production/
│ │ └── index.test.ts
│ ├── response/
│ │ ├── custom-response.test.ts
│ │ ├── headers.test.ts
│ │ ├── range.test.ts
│ │ ├── redirect.test.ts
│ │ ├── sse-double-wrap.test.ts
│ │ ├── static.test.ts
│ │ └── stream.test.ts
│ ├── schema/
│ │ └── schema-utils.test.ts
│ ├── standard-schema/
│ │ ├── reference.test.ts
│ │ ├── standalone.test.ts
│ │ └── validate.test.ts
│ ├── sucrose/
│ │ ├── bracket-pair-range-reverse.test.ts
│ │ ├── bracket-pair-range.test.ts
│ │ ├── extract-main-parameter.test.ts
│ │ ├── find-alias.test.ts
│ │ ├── infer-body-reference.test.ts
│ │ ├── integration.test.ts
│ │ ├── query.test.ts
│ │ ├── remove-colon-alias.test.ts
│ │ ├── remove-default-parameter.test.ts
│ │ ├── retrieve-root-parameters.test.ts
│ │ ├── separate-function.test.ts
│ │ └── sucrose.test.ts
│ ├── timeout.ts
│ ├── tracer/
│ │ ├── aot.test.ts
│ │ ├── detail.test.ts
│ │ ├── timing.test.ts
│ │ └── trace.test.ts
│ ├── type-system/
│ │ ├── array-buffer.test.ts
│ │ ├── array-string.test.ts
│ │ ├── boolean-string.test.ts
│ │ ├── coercion-number.test.ts
│ │ ├── date.test.ts
│ │ ├── files.test.ts
│ │ ├── form.test.ts
│ │ ├── formdata.test.ts
│ │ ├── import.ts
│ │ ├── object-string.test.ts
│ │ ├── string-format.test.ts
│ │ ├── uint8array.test.ts
│ │ └── union-enum.test.ts
│ ├── types/
│ │ ├── async-modules.ts
│ │ ├── documentation.ts
│ │ ├── index.ts
│ │ ├── lifecycle/
│ │ │ ├── derive.ts
│ │ │ ├── resolve.ts
│ │ │ └── soundness.ts
│ │ ├── macro.ts
│ │ ├── plugins.ts
│ │ ├── schema-standalone.ts
│ │ ├── standard-schema/
│ │ │ └── index.ts
│ │ ├── type-system.ts
│ │ └── utils.ts
│ ├── units/
│ │ ├── class-to-object.test.ts
│ │ ├── deduplicate-checksum.test.ts
│ │ ├── get-schema-validator.test.ts
│ │ ├── has-ref.test.ts
│ │ ├── has-transform.test.ts
│ │ ├── merge-deep.test.ts
│ │ ├── merge-object-schemas.test.ts
│ │ ├── numeric.test.ts
│ │ └── replace-schema-type.test.ts
│ ├── utils.d.ts
│ ├── utils.ts
│ ├── validator/
│ │ ├── body.test.ts
│ │ ├── cookie.test.ts
│ │ ├── encode.test.ts
│ │ ├── exact-mirror.test.ts
│ │ ├── header.test.ts
│ │ ├── novalidate.test.ts
│ │ ├── params.test.ts
│ │ ├── query.test.ts
│ │ ├── response-validation-nested.test.ts
│ │ ├── response.test.ts
│ │ ├── standalone.test.ts
│ │ └── validator.test.ts
│ └── ws/
│ ├── aot.test.ts
│ ├── connection.test.ts
│ ├── destructuring.test.ts
│ ├── message.test.ts
│ └── utils.ts
├── tsconfig.dts.json
├── tsconfig.json
└── tsconfig.test.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintrc.json
================================================
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:sonarjs/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "sonarjs"],
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-mixed-spaces-and-tabs": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-namespace": "off",
"no-case-declarations": "off",
"no-extra-semi": "off",
"sonarjs/cognitive-complexity": "off",
"sonarjs/no-all-duplicated-branches": "off"
},
"ignorePatterns": ["example/*", "test/**/*"]
}
================================================
FILE: .github/FUNDING.yaml
================================================
github: SaltyAom
================================================
FILE: .github/ISSUE_TEMPLATE/2-bug-report.yml
================================================
name: 🐛 Bug Report
description: Report an issue that should be fixed
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thank you for submitting a bug report. It helps make Elysia.JS better.
If you need help or support using Elysia.JS, and are not reporting a bug, please
head over to Q&A discussions [Discussions](https://github.com/elysiajs/elysia/discussions/categories/q-a), where you can ask questions in the Q&A forum.
Make sure you are running the version of Elysia.JS and Bun.Sh
The bug you are experiencing may already have been fixed.
Please try to include as much information as possible.
- type: input
attributes:
label: What version of Elysia is running?
description: Copy the row with `elysia` dependency from output `bun pm ls` command
- type: input
attributes:
label: What platform is your computer?
description: |
For MacOS and Linux: copy the output of `uname -mprs`
For Windows: copy the output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in the PowerShell console
- type: input
attributes:
label: What environment are you using
description: |
Answer with runtime and version you are using.
- Bun version: `bun --version`
- Node version: `node --version`
- Deno version: `deno --version`
- Cloudflare Workers (compatability date if applicable)
- type: input
attributes:
label: Are you using dynamic mode?
description: Is your code using `new Elysia({ aot:false })`
- type: textarea
attributes:
label: What steps can reproduce the bug?
description: Explain the bug and provide a code snippet that can reproduce it.
validations:
required: true
- type: textarea
attributes:
label: What is the expected behavior?
description: If possible, please provide text instead of a screenshot.
- type: textarea
attributes:
label: What do you see instead?
description: If possible, please provide text instead of a screenshot.
- type: textarea
attributes:
label: Additional information
description: Is there anything else you think we should know?
- type: input
attributes:
label: Have you try removing the `node_modules` and `bun.lockb` and try again yet?
description: rm -rf node_modules && bun.lockb
================================================
FILE: .github/ISSUE_TEMPLATE/3-feature-request.yml
================================================
name: 🚀 Feature Request
description: Suggest an idea, feature, or enhancement
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thank you for submitting an idea. It helps make Elysia.JS better.
If you want to discuss Elysia.JS, or learn how others are using Elysia.JS, please
head to our [Discord](https://discord.com/invite/y7kH46ZE) server, where you can chat among the community.
- type: textarea
attributes:
label: What is the problem this feature would solve?
validations:
required: true
- type: textarea
attributes:
label: What is the feature you are proposing to solve the problem?
validations:
required: true
- type: textarea
attributes:
label: What alternatives have you considered?
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true
contact_links:
- name: 📗 Documentation Issue
url: https://github.com/elysiajs/documentation/issues/new/choose
about: Head over to our Documentation repository!
- name: 💬 Ask a Question
url: https://discord.gg/eaFJ2KDJck
about: Head over to our Discord!
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: 'npm'
directory: './'
schedule:
interval: 'daily'
- package-ecosystem: 'github-actions'
directory: './'
schedule:
interval: 'daily'
================================================
FILE: .github/workflows/ci.yml
================================================
name: Build and Test
on:
push:
pull_request:
jobs:
build:
name: Build and test code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install packages
run: bun install
- name: Build code
run: bun run build
- name: Test
run: bun run test
- name: Test
run: bun run test:cf
- name: Publish Preview
if: github.event_name == 'pull_request'
run: bunx pkg-pr-new publish
================================================
FILE: .github/workflows/publish.yml
================================================
name: Publish
on:
release:
types: [published]
defaults:
run:
shell: bash
permissions:
id-token: write
env:
# Enable debug logging for actions
ACTIONS_RUNNER_DEBUG: true
jobs:
publish-npm:
name: 'Publish: npm Registry'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup Bun'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-node@v5
with:
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
- name: Install packages
run: bun install
- name: Build code
run: bun run build
- name: Test
run: bun run test
- name: Test
run: bun run test:cf
- name: 'Publish'
run: |
NODE_AUTH_TOKEN="" npm publish --provenance --access=public
================================================
FILE: .gitignore
================================================
.DS_Store
node_modules
build
dump.rdb
dist
trace
.scannerwork
*.tsbuildinfo
.wrangler
.elysia
heap.json
server
================================================
FILE: .npmignore
================================================
.git
.gitignore
.github
.prettierrc
.eslintrc.js
.eslint.json
.swc.cjs.swcrc
.swc.esm.swcrc
.swcrc
.husky
.eslintrc.json
bun.lock
bun.lockb
node_modules
tsconfig.json
CHANGELOG.md
heap.json
example
tests
test
docs
src
.DS_Store
test
tsconfig.cjs.json
tsconfig.dts.json
tsconfig.esm.json
tsconfig.test.json
tsconfig.test.tsbuildinfo
CONTRIBUTING.md
CODE_OF_CONDUCT.md
trace
build.ts
.scannerwork
src
server
================================================
FILE: .npmrc
================================================
enable-pre-post-scripts=true
registry=https://registry.npmjs.org
always-auth=true
================================================
FILE: .prettierrc
================================================
{
"useTabs": true,
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
================================================
FILE: CHANGELOG.md
================================================
# 1.4.28 - 17 Mar 2025
Feature:
- [#1803](https://github.com/elysiajs/elysia/pull/1803) stream response with pull based backpressure
- [#1802](https://github.com/elysiajs/elysia/pull/1802) handle range header for file/blob response
- [#1722](https://github.com/elysiajs/elysia/pull/1772), [#1741](https://github.com/elysiajs/elysia/issues/1741) direct ReadableStream perf blow-up
Bug fix:
- [#1805](https://github.com/elysiajs/elysia/pull/1805) dynamic imports inside .guard not registering routes
- [#1771](https://github.com/elysiajs/elysia/issues/1771) breaks Bun HTML imports
- [#1797](https://github.com/elysiajs/elysia/pull/1797) await mapped error response promise
- [#1794](https://github.com/elysiajs/elysia/pull/1794) merge app cookie config into route cookie validator config
- [#1796](https://github.com/elysiajs/elysia/pull/1796) check custom parser by full name
- [#1795](https://github.com/elysiajs/elysia/pull/1795) write transformed cookie value to cookie entry directly
- [#1793](https://github.com/elysiajs/elysia/pull/1793) use cookie schema for cookie noValidate check
- [#1792](https://github.com/elysiajs/elysia/pull/1792) throw ValidationError instead of boolean in response encode path
- detect HTML bundle when inline response is Promise
Change:
- [#1613](https://github.com/elysiajs/elysia/pull/1613) export `ElysiaTypeCustomErrors`
- remove Bun specific built
- export `AnySchema`, `UnwrapSchema`, `ModelsToTypes` from root
- conditional set headers of String and Object when no set.headers is set
# 1.4.27 - 1 Mar 2026
Bug fix:
- getSchemaValidator: handle TypeBox as sub type
- handle cookie prototype pollution when parsing cookie
Improvement:
- conditional async on getSchemaValidator when schema is Standard Schema
- use Response.json on Bun
# 1.4.26 - 25 Feb 2026
Bug fix:
- [#1755](https://github.com/elysiajs/elysia/issues/1755) deduplicate local handler from global event
- [#1752](https://github.com/elysiajs/elysia/issues/1752) system router with trailing path doesn't match with non-trailing
- url format redos
- [#1747](https://github.com/elysiajs/elysia/issues/1747) parsing request from mount hang
# 1.4.25 - 12 Feb 2026
Feature:
- export ElysiaStatus
Bug fix:
- macro with conflict literal value per status
- recursive macro with conflict value per status
# 1.4.24 - 11 Feb 2026
Feature:
- graceful unsigned cookie transition
Bug fix:
- [#1733](https://github.com/elysiajs/elysia/pull/1733) preserve multiple set-cookie headers in mounted handlers
- object cookie with secret doesn't deserialized after parsed
# 1.4.23 - 9 Feb 2026
Feature:
- [#1719](https://github.com/elysiajs/elysia/pull/1719) add t.Union/t.Intersection handling in property enumerations/checks
- [#1697](https://github.com/elysiajs/elysia/pull/1697) extend complex formdata support to StandardSchema
- [#1656](https://github.com/elysiajs/elysia/pull/1675) serialize custom array-like custom class with array sub class
Bug fix:
- [#1721](https://github.com/elysiajs/elysia/issues/1721) Promise<Response> with response schema
- [#1700](https://github.com/elysiajs/elysia/issues/1700) distinct union object
- [#1683](https://github.com/elysiajs/elysia/pull/1683) response validation returns 500 instead of 422 for nested schemas in dynamic mode
- [#1679](https://github.com/elysiajs/elysia/pull/1679) preserve headers when throwing from AsyncGenerator
- [#1595](https://github.com/elysiajs/elysia/pull/1595) stream reference should point to teed value
- fix can't modify immutable headers error
Change:
- update exact-mirror to 0.2.7
# 1.4.22 - 14 Jan 2026
Improvement:
- use imperative check for `replaceURLPath` instead of allocating `new URL`
- reduce ts-ignore/ts-expect-error on promise map handler
- [#1655](https://github.com/elysiajs/elysia/pull/1655) decode single values in ArrayQuery
Bug fix:
- [#1671](https://github.com/elysiajs/elysia/issues/1671) mount produces incorrect URL path when Elysia instance has prefix option
- [https://github.com/elysiajs/elysia/issues/1617](https://github.com/elysiajs/elysia/issues/1617), [#1623](https://github.com/elysiajs/elysia/pull/1623) AOT compilation removes beforeHandle when using arrow function expression
- [#1667](https://github.com/elysiajs/elysia/issues/1667) skip body parsing on mount with dynamic mode
- [#1662](https://github.com/elysiajs/elysia/pull/1662) custom thenable fallback in `mapCompactResponse` causing runtime crash with undefined variable
- [#1661](https://github.com/elysiajs/elysia/pull/1661), [#1663](https://github.com/elysiajs/elysia/pull/1663) fix SSE double-wrapping bug when returning pre-formatted Response
- ValueError with summary missing types
- Elysia not using Bun.routes by default
# 1.4.21 - 4 Jan 2026
Improvement:
- [#1654](https://github.com/elysiajs/elysia/pull/1654) encode t.Date() to iso string
- [#1624](https://github.com/elysiajs/elysia/pull/1624) apply macros before merging hooks in group method
Bug fix:
- call Sucrose GC unref when possible (browser fallback)
- add allowUnsafeValidationDetails to Standard Validator
# 1.4.20 - 3 Jan 2026
Improvement:
- add `ModelValidator.schema` for accessing raw schema
- [#1636](https://github.com/elysiajs/elysia/issues/1636) add `subscriptions` to `Elysia.ws` context
- [#1638](https://github.com/elysiajs/elysia/pull/1638) unref Sucrose gc
Bug fix:
- [#1649](https://github.com/elysiajs/elysia/pull/1649) add null check for object properties (t.Record)
- [#1646](https://github.com/elysiajs/elysia/pull/1646) use constant-time comparison for signed cookie verification
- [#1639](https://github.com/elysiajs/elysia/issues/1639) compose: ReferenceError: "_r_r is not defined" when onError returns plain object & mapResponse exists
- [#1631](https://github.com/elysiajs/elysia/issues/1631) update Exact Mirror to 0.2.6
- [#1630](https://github.com/elysiajs/elysia/issues/1630) enforce fetch to return MaybePromise<Response>
Bug fix:
- `Elysia.models` broke when referencing non typebox model
# 1.4.19 - 13 Dec 2025
Security:
- reject invalid cookie signature when using cookie rotation
Improvement
- [#1609](https://github.com/elysiajs/elysia/issues/1609) calling afterResponse with aot: false
- [#1607](https://github.com/elysiajs/elysia/issues/1607), [#1606](https://github.com/elysiajs/elysia/issues/1606), [#1139](https://github.com/elysiajs/elysia/issues/1138) data coercion on nested form data
- [#1604](https://github.com/elysiajs/elysia/issues/1604) save lazy compilation of `Elysia.fetch` for up to 45x performance improvement
- [#1588](https://github.com/elysiajs/elysia/pull/1588), [#1587](https://github.com/elysiajs/elysia/pull/1587) add seen weakset during mergeDeep
Bug fix:
- [#1614](https://github.com/elysiajs/elysia/issues/1614) Cloudflare Worker with dynamic path
- add set immediate fallback
- [#1597](https://github.com/elysiajs/elysia/issues/1597) safeParse, parse to static type
- [#1596](https://github.com/elysiajs/elysia/issues/1596) handle context pass to function with sub context
- [#1591](https://github.com/elysiajs/elysia/pull/1591), [#1590](https://github.com/elysiajs/elysia/pull/1591) merge set.headers without duplicating Response
- [#1546](https://github.com/elysiajs/elysia/issues/1546) override group prefix type
- [#1526](https://github.com/elysiajs/elysia/issues/1526) default error handler doesn't work in Cloudflare Workers
- handle group with empty prefix in type-level
# 1.4.18 - 4 Dec 2025
Security:
- use `JSON.stringify` over custom escape implementation
# 1.4.17 - 2 Dec 2025
Improvement:
- [#1573](https://github.com/elysiajs/elysia/pull/1573) `Server` is always resolved to `any` when `@types/bun` is missing
- [#1568](https://github.com/elysiajs/elysia/pull/1568) optimize cookie value comparison using FNV-1a hash
- [#1549](https://github.com/elysiajs/elysia/pull/1549) Set-Cookie headers not sent when errors are thrown
- [#1579](https://github.com/elysiajs/elysia/pull/1579) HEAD to handle Promise value
Security:
- cookie injection, prototype pollution, and RCE
Bug fix:
- [#1550](https://github.com/elysiajs/elysia/pull/1550) excess property checking
- allow cookie.sign to be string
Change:
- [#1584](https://github.com/elysiajs/elysia/pull/1584) change customError property to unknown
- [#1556](https://github.com/elysiajs/elysia/issues/1556) prevent sending set-cookie header when cookie value is not modified
- [#1563](https://github.com/elysiajs/elysia/issues/1563) standard schema on websocket
- conditional parseQuery parameter
- conditional pass `c.request` to handler for streaming response
- fix missing `contentType` type on `parser`
# 1.4.16 - 13 Nov 2025
Improvement:
- ValidationError: add `messageValue` as an alias of `errorValue`
- ValidationError.detail now accept optional 2nd parameter `allowUnsafeValidatorDetails`
- macro: add `introspect`
- prevent redundant route compilation
- merge multiple macro resolve response
Bug fix:
- [#1543](https://github.com/elysiajs/elysia/pull/1524) respect toResponse() method on Error classes
- [#1537](https://github.com/elysiajs/elysia/issues/1537) websocket: ping/pong not being called
- [#1536](https://github.com/elysiajs/elysia/pull/1536) export ExtractErrorFromHandle
- [#1535](https://github.com/elysiajs/elysia/pull/1535) skip response validation for generators and streams
- [#1531](https://github.com/elysiajs/elysia/pull/1531) typo in ElysiaTypeCustomErrorCallback: valdation to validation
- [#1528](https://github.com/elysiajs/elysia/issues/1528) error in parsing request body validation errors with Zod
- [#1527](https://github.com/elysiajs/elysia/issues/1527) bracket handling in exact mirror
- [#1524](https://github.com/elysiajs/elysia/pull/1524) head request handler not working
# 1.4.15 - 3 Nov 2025
Bug fix:
- 1.4.14 regression with Eden Treaty, and OpenAPI type gen
# 1.4.14 - 3 Nov 2025
Feature:
- [#1520](https://github.com/elysiajs/elysia/issues/1520), [#1522](https://github.com/elysiajs/elysia/issues/1522) async handlers crash on HEAD request
- [#1510](https://github.com/elysiajs/elysia/issues/1510) strict status response
- [#1503](https://github.com/elysiajs/elysia/pull/1503) add t.NumericEnum() for numeric enum query handling
- [#1450](https://github.com/elysiajs/elysia/pull/1450) call onAfterResponse when onError returns a value
- remove redundant `Prettify`
- prettify response for OpenAPI type gen
- conditional apply macro context in type level
- improve type performance in general
Change:
- remove `Prettify2`, `Partial2`
# 1.4.13 - 23 Oct 2025
Feature:
- [#1453](https://github.com/elysiajs/elysia/issues/1453) add `allowUnsafeValidationDetails` for disabling unsafe validation details in production mode
- allow rapid stream in non browser mode or `ELYSIA_RAPID_STREAM` is set
- `afterResponse` now wait for generator stream to finish
- trace of `handle`, and `afterResponse` now wait for generator stream to finish
Bug fix:
- [#1502](https://github.com/elysiajs/elysia/issues/1502), [#1501](https://github.com/elysiajs/elysia/issues/1501) afterHandle doesn't update status
- [#1500](https://github.com/elysiajs/elysia/issues/1500) export `InvalidFileType` from root
- [#1495](https://github.com/elysiajs/elysia/pull/1495) request server hook parameters are typed as any (Bun 1.3.0)
- [#1483](https://github.com/elysiajs/elysia/pull/1483) handle standard schema validators in ValidationError.all
- [#1459](https://github.com/elysiajs/elysia/pull/1459) fix strictPath behavior when aot: false is set
- [#1455](https://github.com/elysiajs/elysia/pull/1455) graceful shutdown not awaiting server.stop
- [#1499](https://github.com/elysiajs/elysia/pull/1449) fails when merging with t.Optional schema
- remove encoding chunk from native static response in Bun adapter
Change:
- make `@types/bun` an optional dependency
# 1.4.12 - 14 Oct 2025
Improvement:
- named macro function callback
- adjust build script
# 1.4.11 - 12 Oct 2025
Bug fix:
- [#1469](https://github.com/elysiajs/elysia/issues/1469) incorrect ping, pong type signature
- [#1467](https://github.com/elysiajs/elysia/issues/1467) better error union handling in `onError`
- [#1463](https://github.com/elysiajs/elysia/issues/1463) responseValue is undefined in afterHandle when beforeHandle returns status
- [#1460](https://github.com/elysiajs/elysia/issues/1460) compressed response in mapResponse is corrupted if status !== 200
- [#1456](https://github.com/elysiajs/elysia/issues/1456) add response type check for stream
- [#1451](https://github.com/elysiajs/elysia/issues/1451) cookie validation is not running when there's no body schema
- make `file-type` non optional dependency to fix default build problem
# 1.4.10 - 9 Oct 2025
Bug fix:
- [#1406](https://github.com/elysiajs/elysia/issues/1406) enforce return type in OptionalHandler
- static handlers in Bun 1.3
- conditional use `crypto` randomUUID if not available (eg. iOS Safari)
Change:
- `Elysia.file` readstream value is now IIFE to re-read
# 1.4.9 - 29 Sep 2025
Improvement:
- add Cloudflare Worker test
- add `Sucrose.Settings`
- [#1443](https://github.com/elysiajs/elysia/pull/1443) add knip for detecting deadcode
# 1.4.8 - 27 Sep 2025
Improvement:
- automatically clear up sucrose cache when not used
- remove `Bun.hash` from checksum calculation
Change:
- make `file-type` optional to reduce bundle size
- [#1432](https://github.com/elysiajs/elysia/pull/1432) missing context (set) in mapResponse for ElysiaFile
- [#1435](https://github.com/elysiajs/elysia/pull/1435) missing cookies in SSE
# 1.4.7 - 22 Sep 2025
Feature:
- experimental `adapter/cloudflare-worker`
- add `ElysiaAdapter.beforeCompile`
Change:
- do not prettify routes when using `guard`, `group`
- use `process.getBuiltinModule` instead of dynamic import for file
- `Elysia.file.value` on Web Standard Adapter now is not a promise
# 1.4.6 - 18 Sep 2025
Improvement:
- [#1406](https://github.com/elysiajs/elysia/issues/1406) strictly check for 200 inline status code
- coerce union status value and return type
- add `BunHTMLBundleLike` to Elysia inline handler
- [#1405](https://github.com/elysiajs/elysia/issues/1405) prevent Elysia from being a dependency of itself
- [#1416](https://github.com/elysiajs/elysia/issues/1416) check if object is frozen before merging, add try-catch to prevent crash
- [#1419](https://github.com/elysiajs/elysia/issues/1419) guard doesn't apply scoped/global schema to object macro
- [#1425](https://github.com/elysiajs/elysia/issues/1425) DELETE doesn't inherit derive/resolve type
Change:
- [#1409](https://github.com/elysiajs/elysia/issues/1409) onTransform now doesn't include type as it isn't validated yet, creating confusion
Bug fix:
- [#1410](https://github.com/elysiajs/elysia/issues/1410) handle union derive/resolve property
- probably fix mergeDeep attempted to assign to readonly property
- derive/resolve inherit type in inline handler
# 1.4.5 - 15 Sep 2025
Improvement:
- soundness for guard, group
- overwrite primitive value if collide (intersectIfObject)
Bug fix:
- standard schema incorrectly validate cookie and coercion
- merge nested guard, group standalone schema properly
Breaking Change:
- no longer coerce type for .model with `t.Ref` by default
# 1.4.4 - 13 Sep 2025
Bug fix:
- merge schema in GET method
- remove accidental console.log
# 1.4.3 - 13 Sep 2025
Bug fix:
- `mapValueError` should return all possible value both in dev environment and production environment
- inline lifecycle get method doesn't inherit Singleton
# 1.4.2 - 13 Sep 2025
Bug fix:
- remove debug `q` from inline handler
# 1.4.1 - 13 Sep 2025
Bug fix:
- type error for inline Elysia.file
# 1.4.0 - 13 Sep 2025
Feature:
- standard validator
- macro schema, macro extension, macro detail
- lifecycle type soundness
- type inference reduced by ~11%
- [#861](https://github.com/elysiajs/elysia/issues/861) missing HEAD method when register route with GET
Improvement
- [#861](https://github.com/elysiajs/elysia/issues/861) automatically add HEAD method when defining GET route
Change
- ObjectString/ArrayString no longer produce default value by default due to security reasons
- Cookie now dynamically parse when format is likely JSON
- export `fileType` for external file type validation for accurate response
Breaking Change
- remove macro v1 due to non type soundness
- remove `error` function, use `status` instead
- deprecation notice for `response` in `mapResponse`, `afterResponse`, use `responseValue` instead
- remove reference array model by string eg. `user[]`, use `t.Array(t.Ref('user'))` instead
# 1.3.22 - 6 Sep 2025
Bug fix:
- safely unwrap t.Record
# 1.3.21 - 31 Aug 2025
Bug fix:
- [#1356](https://github.com/elysiajs/elysia/pull/1356) webSocket validation error handling in BunAdapter
- [#1358](https://github.com/elysiajs/elysia/pull/1358) allow overriding websocket handler with listen options
- [#1365](https://github.com/elysiajs/elysia/pull/1365) check if the plugin.constructor (fix import module in Bun 1.2.21)
- [#1367](https://github.com/elysiajs/elysia/pull/1367) .trace hooks (onAfterResponse, etc...) not being called
- [#1369](https://github.com/elysiajs/elysia/issues/1369) don't block microtask queue in SSE
# 1.3.20 - 24 Aug 2025
Change:
- mime is undefined when using `Elysia.file` in Web Standard Adapter
# 1.3.19 - 24 Aug 2025
Change:
- [#1357](https://github.com/elysiajs/elysia/issues/1357) return `Response` proxy as-is
Bug fix:
- [elysiajs/node#45](https://github.com/elysiajs/node/issues/45) detect Response polyfill on Node
# 1.3.18 - 23 Aug 2025
Bug fix:
- `ReadableStream` is not pass to `handleStream` in `mapCompactResponse`, and `mapEarlyResponse`
# 1.3.17 - 23 Aug 2025
Bug fix:
- [#1353](https://github.com/elysiajs/elysia/issues/1353) normalize encodeSchema with Transform
# 1.3.16 - 23 Aug 2025
Improvement:
- `sse` now infer type
- `sse` now accepts `ReadableStream` to return stream as `text/event-stream`
- refactor SSE handler
- support returning `ReadableStream` from generator or async generator
Change:
- sse no longer include generated id by default
Bug fix:
- static response now use callback clone instead of bind
# 1.3.15 - 21 Aug 2025
Bug fix:
- ValidationError.detail only handle custom error
# 1.3.14 - 21 Aug 2025
Improvement:
- custom error on production mode
- add `ValidationError.withDetail`
- add `withDetail` for additional error information
# 1.3.13 - 18 Aug 2025
Bug fix:
- important performance degration, exact mirror normalize doesn't apply correctly
- normalize optional property with special character
Change:
- update `exact-mirror` to `0.1.6`
# 1.3.12 - 19 Aug 2025
Bug fix:
- [#1348](https://github.com/elysiajs/elysia/issues/1348) onAfterResponse runs twice if NotFoundError thrown and onError provided
# 1.3.11 - 18 Aug 2025
Bug fix:
- [#1346](https://github.com/elysiajs/elysia/issues/1346) cannot declare 'mep' twice
# 1.3.10 - 18 Aug 2025
Bug fix:
- [#1028](https://github.com/elysiajs/elysia/issues/1028) query array nuqs format in dynamic mode
- unwrap t.Import in dynamic mode
# 1.3.9 - 18 Aug 2025
Feature:
- [#932](https://github.com/elysiajs/elysia/issues/932) add `t.ArrayBuffer`, `t.Uint8Array`
Bug fix:
- [#459](https://github.com/elysiajs/elysia/issues/459) route prefix should give type error when prefix is not start with '/'
- [#669](https://github.com/elysiajs/elysia/issues/669) add nullable field to t.Nullable for OpenAPI 3.0 spec
- [#711](https://github.com/elysiajs/elysia/issues/711) set default headers for non-aot
- [#713](https://github.com/elysiajs/elysia/issues/713) NotFoundError doesn't call onAfterResponse hook
- [#771](https://github.com/elysiajs/elysia/issues/771) skip body parsing if Content-Type is present but body is not
- [#747](https://github.com/elysiajs/elysia/issues/747) mapResponse inside mapError override error value
- [#812](https://github.com/elysiajs/elysia/issues/812) check for minItems length before array validation
- [#833](https://github.com/elysiajs/elysia/issues/833) cookie signing doesn't work in dynamic mode
- [#859](https://github.com/elysiajs/elysia/issues/859) clean non-root additionalProperties
- [#924](https://github.com/elysiajs/elysia/issues/924) decode path param
- [#985](https://github.com/elysiajs/elysia/issues/924) Nullable accept options
- [#1028](https://github.com/elysiajs/elysia/issues/1028) string | string[] query parameter, reference array
- [#1120](https://github.com/elysiajs/elysia/issues/1120) cannot set multiple cookies when response is a file
- [#1124](https://github.com/elysiajs/elysia/issues/1124) validate url encoded query
- [#1158](https://github.com/elysiajs/elysia/issues/1158) prevent side-effect from guard merge
- [#1162](https://github.com/elysiajs/elysia/issues/1162) handle encoded space in array query string
- [#1267](https://github.com/elysiajs/elysia/issues/1267) parse without contentType headers throw Bad Request
- [#1274](https://github.com/elysiajs/elysia/issues/1274) support .use(undefined | false) for conditional plugin
- [#1276](https://github.com/elysiajs/elysia/issues/1276) mapResponse with set inference produce invalid instruction
- [#1268](https://github.com/elysiajs/elysia/issues/1268) using number instead of stringifed value for reporting validation error
- [#1288](https://github.com/elysiajs/elysia/issues/1288) handle array query string in dynamic mode
- [#1294](https://github.com/elysiajs/elysia/issues/1294) return status from `derive` and `resolve` shouldn't call `onError`
- [#1297](https://github.com/elysiajs/elysia/issues/1297), [#1325](https://github.com/elysiajs/elysia/pull/1325) fix HTML imported pages in compiled apps
- [#1319](https://github.com/elysiajs/elysia/pull/1319) fix array of plugin usage causes incorrect path aggregation
- [#1323](https://github.com/elysiajs/elysia/issues/1323) don't duplicate error from plugin
- [#1327](https://github.com/elysiajs/elysia/pull/1327) ensure that t.Date value is Date in Encode
- dynamic handle should handle named parser
- instanceof ElysiaCustomStatusResponse should return true when import from root Elysia module
Improvement:
- remove `finally` from compose
- `NotFoundError` should parse query if inferred
- [#853](https://github.com/elysiajs/elysia/issues/853) Bun Static response now handle pre-compute `onRequest`, and `onError`
- prettify ElysiaWS type
- export `ElysiaCustomStatusResponse`
- handle type-level status check in after response
Change:
- status no longer make value as readonly
- afterResponse now call after response by scheduling setImmediate
- update memoirist to 0.4.0
- update exact-mirror to 0.1.5
# 1.3.8 - 31 Jul 2025
Improvement:
- ElysiaFile doesn't inherits `set.headers` eg. cors
- [Web Standard] automatically set `Content-Type`, `Content-Range` of ElysiaFile
Bug fix:
- [#1316](https://github.com/elysiajs/elysia/pull/1316) fix context type when multiple macros are selected
- [#1306](https://github.com/elysiajs/elysia/pull/1306) preserve type narrowing in getSchemaValidator
- add `set` to `handleFile` when file is `ElysiaFile`
- [Web Standard] inherit set.status for `ElysiaFile`
- make `ElysiaAdapter.stop` optional
# 1.3.7 - 31 Jul 2025
Bug fix:
- [#1314](https://github.com/elysiajs/elysia/issues/1314) coerce TransformDecodeError to ValidationError
- [#1313](https://github.com/elysiajs/elysia/pull/1313) onRequest not firing
- [#1311](https://github.com/elysiajs/elysia/issues/1311) [Exact Mirror] handle property starts with a number
- [#1310](https://github.com/elysiajs/elysia/issues/1310) webSocket fails to connect when inside group and guard
- [#1309](https://github.com/elysiajs/elysia/issues/1309) encode is not called when using dynamic handler
- [#1304](https://github.com/elysiajs/elysia/issues/1304) remove response body from HTTP 101, 204, 205, 304, 307, 308
Change:
- update exact mirror to 0.1.3
- warn when stop is called instead of throwing an error
# 1.3.6 - 24 Jul 2025
Improvement:
- [#1263](https://github.com/elysiajs/elysia/pull/1263) bun adapter add qi to routes that need query from guard
- [#1270](https://github.com/elysiajs/elysia/pull/1270) add Symbol.dispose
- [#1089](https://github.com/elysiajs/elysia/pull/1089) add stop function to ElysiaAdapter type
Bug fix:
- [#1126](https://github.com/elysiajs/elysia/pull/1126) websocket errors not catching
- [#1281](https://github.com/elysiajs/elysia/issues/1281) automatically enforce additional properties in nested schema (eg. array)
- Dynamic handle decode signed cookie secret instead of accidental hardcoded value
# 1.3.5 - 16 Jun 2025
Bug fix:
- [#1255](https://github.com/elysiajs/elysia/issues/1255) regression in serving an imported HTML file
- [#1251](https://github.com/elysiajs/elysia/issues/1251) property 'status' does not exist onError function
- [#1247](https://github.com/elysiajs/elysia/pull/1247) ensure WebSockets get routed properly without AoT compilation
- [#1246](https://github.com/elysiajs/elysia/issues/1246) property 'timeout' does not exist on type 'Server'
- [#1245](https://github.com/elysiajs/elysia/issues/1245) error on onAfterHandle (no property 'response')
- [#1239](https://github.com/elysiajs/elysia/issues/1239) t.Files validator breaks for response schema
- [#1187](https://github.com/elysiajs/elysia/pull/1187), [#1169](https://github.com/elysiajs/elysia/issues/1169) websocket beforeLoad not being executed
# 1.3.4 - 3 Jun 2025
Feature:
- sse helper
Bug fix:
- [#1237](https://github.com/elysiajs/elysia/issues/1237) ws in a group merge error
- [#1235](https://github.com/elysiajs/elysia/issues/1235) errors not handled correctly in resolve hook on dynamic mode
- [#1234](https://github.com/elysiajs/elysia/issues/1234) optional path parameters can't follow required ones
- [#1232](https://github.com/elysiajs/elysia/issues/1232) t.Files fails with array of files
Change:
- When yield is not sse, content-type is set to either `text/plain` or `application/json` based on the response type
# 1.3.3 - 27 May 2025
Bug fix:
- mapResponseContext is not passed to compose
- await `ElysiaFile` when not using Bun
- export `adapter/utils`
# 1.3.2 - 27 May 2025
Feature:
- Support Bun native static response per method for Bun >= 1.2.14
- [#1213](https://github.com/elysiajs/elysia/issues/1213) trace.time is undefined in .trace() callback
Improvement:
- implement all universal type
- offload `AsyncGenerator`, `ReplaceFile` from Eden Treaty to `CreateEden`
- [#1223](https://github.com/elysiajs/elysia/issues/1223) infer `status(200)` response from handler if not specified
- [#1185](https://github.com/elysiajs/elysia/issues/1185) use non-greedy match for `isContextPassToFunction` to prevent false positive
# 1.3.1 - 8 May 2025
Bug fix:
- [#1200](https://github.com/elysiajs/elysia/issues/1200) limited Bun Router to supported method
- [#1199](https://github.com/elysiajs/elysia/issues/1199) object are not normalized when t.Transform is provided
- [#1198](https://github.com/elysiajs/elysia/issues/1198), [#1188](https://github.com/elysiajs/elysia/issues/1188), [#1186](https://github.com/elysiajs/elysia/issues/1186) exclude wildcard route from Bun router
- [#1197](https://github.com/elysiajs/elysia/issues/1197) leave incorrect union field as-is
- [#1195](https://github.com/elysiajs/elysia/issues/1195) invalid onAfterHandle typing
- [#1194](https://github.com/elysiajs/elysia/issues/1194) normalize array response
- [#1193](https://github.com/elysiajs/elysia/issues/1193) undefine value.schema.noValidate
- [#1192](https://github.com/elysiajs/elysia/issues/1192) using a macro inside a group does not call the handler when using the `precompile` option
- [#1190](https://github.com/elysiajs/elysia/issues/1190) derive and resolve handlers not being executed on WS context
- [#1189](https://github.com/elysiajs/elysia/issues/1189) Type Inference Issue with Eden Treaty Group Endpoints
- [#1185](https://github.com/elysiajs/elysia/issues/1185) path is missing from Context when Bun System Router is used
- [#1184](https://github.com/elysiajs/elysia/issues/1184) Missing `mapEarlyResponse` on Bun System Router
Change:
- update `exact-mirror` to `0.1.2`
# 1.3.0 - 5 May 2025
Feature:
- add `exactMirror`
- add `systemRouter` config
- `standalone Validator`
- add `Elysia.Ref` for referencing schema with autocompletion instead of `t.Ref`
- support Ref inside inline schema
- add sucrose cache
- new validation `t.Form`, `t.NoValidate`
- use `file-type` to check file type
- add `INVALID_FILE_TYPE` error
- add `sanitize` options
Improvement:
- `encodeSchema` now stable and enabled by default
- optimize types
- reduce redundant type check when using Encode
- optimize isAsync
- unwrap Definition['typebox'] by default to prevent unnecessary UnwrapTypeModule call
- Elysia.form can now be type check
- refactor type-system
- refactor `_types` into `~Types`
- using aot compilation to check for custom Elysia type, eg. Numeric
- refactor `app.router.static`, and move static router code generation to compile phase
- optimize memory usage on `add`, `_use`, and some utility functions
- improve start up time on multiple route
- dynamically create cookie validator as needed in compilation process
- reduce object cloning
- optimize start index for finding delimiter of a content type header
- Promise can now be a static response
- `ParseError` now keeps stack trace
- refactor `parseQuery` and `parseQueryFromURL`
- add `config` options to `mount`
- recompile automatically after async modules is mounted
- support macro on when hook has function
- support resolve macro on ws
- [#1146](https://github.com/elysiajs/elysia/pull/1146) add support to return web API's File from handler
- [#1165](https://github.com/elysiajs/elysia/pull/1165) skip non-numeric status codes in response schema validation
- [#1177](https://github.com/elysiajs/elysia/issues/1177) cookie does not sign when an error is thrown
Bug fix:
- `Response` returned from `onError` is using octet stream
- unintentional memory allocation when using `mergeObjectArray`
- handle empty space on Date query
Change:
- only provide `c.request` to mapResponse when `maybeStream` is true
- use plain object for `routeTree` instead of `Map`
- remove `compressHistoryHook` and `decompressHistoryHook`
- webstandard handler now return `text/plain` if not on Bun
- use non const value for `decorate` unless explicitly specified
- `Elysia.mount` now set `detail.hide = true` by default
Breaking Change:
- remove `as('plugin')` in favor of `as('scoped')`
- remove root `index` for Eden Treaty
- remove `websocket` from `ElysiaAdapter`
- remove `inference.request`
# 1.2.25 - 6 Mar 2025
Bug fix:
- [#1108](https://github.com/elysiajs/elysia/issues/1108) use validation response instead of return type when schema is provided
- [#1105](https://github.com/elysiajs/elysia/pull/1105), [#1003](https://github.com/elysiajs/elysia/issues/1003) invalid parsing body with missed fields if used object model
# 1.2.24 - 2 Mar 2025
Bug fix:
- 200 object response is not inferring type in type-level
- [#1091](https://github.com/elysiajs/elysia/issues/1091) route is not defined when using trace
# 1.2.23 - 25 Feb 2025
Bug fix:
- [#1087](https://github.com/elysiajs/elysia/pull/1087) websocket to parse string array
- [#1088](https://github.com/elysiajs/elysia/pull/1088) infinite loop when inference body is empty
# 1.2.22 - 24 Feb 2025
Bug fix:
- [#1074](https://github.com/elysiajs/elysia/pull/1074) hasTransform doesn't detect Transform on root
- [#873](https://github.com/elysiajs/elysia/issues/873#issuecomment-2676628776) encode before type check
# 1.2.21 - 22 Feb 2025
Bug fix:
- [#671](https://github.com/elysiajs/elysia/issues/671#issuecomment-2676263442) Transform inside t.Intersect isn't detected
# 1.2.20 - 22 Feb 2025
Bug fix:
- [#671](https://github.com/elysiajs/elysia/issues/671#issuecomment-2675777040) Transform query schema check fails
- model type
# 1.2.19 - 22 Feb 2025
Bug fix:
- [#1078](https://github.com/elysiajs/elysia/issues/1078) array string default to '[]' instead of undefined
# 1.2.18 - 22 Feb 2025
Bug fix:
- duplicated static route may cause index conflict resulting in incorrect route
# 1.2.17 - 21 Feb 2025
Bug fix:
- `.mount` doesn't return pass entire request
# 1.2.16 - 21 Feb 2025
Improvement:
- `AfterHandler` infer response type
Change:
- [#1068](https://github.com/elysiajs/elysia/issues/1068) update `@sinclair/typebox` to `0.34.27`
Bug fix:
- [#1075](https://github.com/elysiajs/elysia/issues/1075) nested async plugins mismatch routes to handlers
- [#1073](https://github.com/elysiajs/elysia/issues/1073) file type validation not working
- [#1070](https://github.com/elysiajs/elysia/issues/1070) .mount is mutating the incoming request method
- mount path is incorrect when using prefix with trailing `*`
- [#873](https://github.com/elysiajs/elysia/issues/873) add `experimental.encodeSchema` for custom `Transform` Encode type
# 1.2.15 - 19 Feb 2025
Bug fix:
- [#1067](https://github.com/elysiajs/elysia/issues/1067) recompile async plugin once registered
- [#1052](https://github.com/elysiajs/elysia/issues/1052) webSocket errors not getting catched by error handler
- [#1038](https://github.com/elysiajs/elysia/issues/1038) incorrect type inference with deferred modules leads to TypeErrors in runtime
- [#1015](https://github.com/elysiajs/elysia/issues/1015) using a model by name in route query leads to type mispatch, yet validation succeeds if doesn't use Ref
- [#1047](https://github.com/elysiajs/elysia/issues/1047) ampersand in URL search params is discarded
- detect `Transform` inside `t.Array` in `hasTransform`
Improvement:
- add test cases for `hasTransform`
- `hasTransform` now supports Union, Intersect
- remove redundant `decodeURIComponent` in nested query
# 1.2.14 - 17 Feb 2025
Feature:
- parse nuqs string array format if query is specified as `t.Array(t.String())`
Improvement:
- handle recursive nested async plugin
- Response now handle proxy streaming
- [#971](https://github.com/elysiajs/elysia/issues/971) wrap import("fs/promises") AND wrap import("fs") in try-catch to avoid error (silly me, tee-hee~)
- handle nested array property swap for `replaceSchemaType`
Breaking Change:
- [Internal] `Elysia.modules` now return void
# 1.2.13 - 16 Feb 2025
Improvement:
- [#977](https://github.com/elysiajs/elysia/pull/977) use Registry instead of TypeSystem
- remove redundant switch-case for path mapping when strictPath is disabled and path is overlapped
- remove redundant allocation for nativeStaticHanlder when strictPath path is overlapped
Bug fix:
- [#1062](https://github.com/elysiajs/elysia/pull/1062) correctly set t.Date() defaults
- [#1050](https://github.com/elysiajs/elysia/issues/1050) app.onRequest(ctx => {ctx.server}): Can't find variable: getServer
- [#1040](https://github.com/elysiajs/elysia/pull/1040) undefined route context on aot=false
- [#1017](https://github.com/elysiajs/elysia/pull/1017) replace t.Number() for Type.Integer()
- [#976](https://github.com/elysiajs/elysia/pull/976) error responses with aot: false
- [#975](https://github.com/elysiajs/elysia/pull/975) await nested async plugins
- [#971](https://github.com/elysiajs/elysia/issues/971) wrap import("fs/promises") in try-catch to avoid error
- [discord](https://discord.com/channels/1044804142461362206/1289400305506844672/1289400305506844672) file format doesn't check for '*' format
# 1.2.12 - 4 Feb 2025
Bug fix:
- warn when non-existing macro is used
- parser doesn't generate optimize instruction
# 1.2.11 - 1 Feb 2025
Feature:
- Reduce memory usage:
- Compressed lifecycle event
- Avoid unnecessary declaration in compose.ts
- Lazily build radix tree for dynamic router
Change:
- Update TypeBox to 0.34.15
Bug fix:
- [#1039](vhttps://github.com/elysiajs/elysia/issues/1039) Elysia fails to start with an error inside its own code when using decorate twice with Object.create(null)
- [#1005](https://github.com/elysiajs/elysia/issues/1005) Parsing malformed body with NODE_ENV 'production' results in UNKNOWN error
- [#1037](https://github.com/elysiajs/elysia/issues/1037) Validation errors in production throw undefined is not an object (evaluating 'error2.schema')
- [#1036](https://github.com/elysiajs/elysia/issues/1036) Support Bun HTML import
# 1.2.10 - 5 Jan 2025
Feature:
- add shorthand property for macro function
Improvement:
- use `deuri` instead of `fast-decode-uri-component`
- [#985](https://github.com/elysiajs/elysia/issues/985) MaybeEmpty and Nullable should have options args
Bug fix:
- Macro function doesn't inherits local/scoped derive and resolve in type-level
# 1.2.9 - 28 Dec 2024
Bug fix:
- Resolve macro unintentionally return instead of assign new context
# 1.2.8 - 27 Dec 2024
Bug fix:
- [#966](https://github.com/elysiajs/elysia/issues/966) generic error somehow return 200
# 1.2.7 - 27 Dec 2024
Bug fix:
- macro doesn't work with guard
- [#981](https://github.com/elysiajs/elysia/issues/981) unable to deference schema, create default, and coerce value
- [#966](https://github.com/elysiajs/elysia/issues/966) `error`'s value return as-if when thrown
- [#964](https://github.com/elysiajs/elysia/issues/964) InvalidCookieSignature errors are not caught by onError
- [#952](https://github.com/elysiajs/elysia/issues/952) onAfterResponse does not provide mapped response value unless aot is disabled
- `mapResponse.response` is `{}` if no response schema is provided
- Response doesn't reconcile when handler return `Response` is used with `mapResponse`
- `onError` now accepts `error` as `number` when `Elysia.error` is thrown (but not returned)
# 1.2.6 - 25 Dec 2024
Bug fix:
- mapResponse with onError caused compilation error
# 1.2.5 - 25 Dec 2024
Bug fix:
- define universal/file in package export
# 1.2.4 - 25 Dec 2024
Bug fix:
- performance regression from eager access abortSignal
# 1.2.3 - 25 Dec 2024
Bug fix:
- [#973](https://github.com/elysiajs/elysia/issues/973) Parsing malformed body results in `UNKNOWN`-Error instead of `ParseError`
- [#971](https://github.com/elysiajs/elysia/issues/971) remove top level import, use dynamic import instead
- [#969](https://github.com/elysiajs/elysia/issues/969) Invalid context on `.onStart`, `.onStop`
- [#965](https://github.com/elysiajs/elysia/issues/965) [Composer] failed to generate optimized handler. Unexpected identifier 'mapCompactResponse'
- [#962](https://github.com/elysiajs/elysia/pull/962) fix schema default value when AOT is of
- decorator name with space is not working
# 1.2.2 - 24 Dec 2024
Bug fix:
- conditional import and require
# 1.2.1 - 23 Dec 2024
Bug fix:
- conditional import for fs
- object macro parameter maybe array
- optional return for macro
# 1.2.0 - 23 Dec 2024
Feature:
- Commitment to Universal Runtime Support
- Node Adapter
- Web Standard Adapter
- Bun Adapter
- Universal Utilities
- Name parser
- Add resolve support to Macro
- Improve WebSocket
- Support ping, pong and latest Bun feature
- Match type declaration with Bun
- Support for return, yield
- Match Context type
- Performance Improvement
- Entire rewrite
- bind over getter return
- Infer 422 validation
- Compilation minification
- Validation Stuff
- t.MaybeArray
- Typebox Module & Nested model
- Inline module
Improvement:
- Memory Usage
- [Internal] Register loosePath in compilation process to reduce memory usage and reduce registration time from O(2n) to O(n)
- Try to accept and coerce different version of Elysia plugin
- Event Listener now infers path parameter automatically based on scope
- Add ‘scoped’ to bulk `as` for casting type to ‘scoped’ similar to ‘plugin’
Change:
- Update `cookie` to 1.0.1
- Update TypeBox to 0.33
- `content-length` now accept number
Breaking Change:
- [Internal] Remove router internal property static.http.staticHandlers
- [Internal] Router history compile now link with history composed
# 1.1.27 - 23 Dec 2024
Bug fix:
- [#963](https://github.com/elysiajs/elysia/pull/963) array parser on query string when AOT is off
- [#961](https://github.com/elysiajs/elysia/pull/961) literal handler when AOT is off
# 1.1.26 - 4 Dev 2024
Bug fix:
- [#907](https://github.com/elysiajs/elysia/issues/907), [#872](https://github.com/elysiajs/elysia/issues/872), [#926](https://github.com/elysiajs/elysia/issues/926) BooleanString is not behave correctly if property is not provided
- [#929](https://github.com/elysiajs/elysia/issues/929) Non-ASCII characters cause querystring index to be incorrectly slice
- [#912](https://github.com/elysiajs/elysia/issues/912) handle JavaScript date numeric offset
# 1.1.25 - 14 Nov 2024
Bug fix:
- [#908](https://github.com/elysiajs/elysia/pull/908) boolean-string converted to string
- [#905](https://github.com/elysiajs/elysia/pull/905) avoid response normailization side effects
Change:
- don't minify identifiers in bun bundle
# 1.1.24 - 31 Oct 2024
Security:
- [#891](https://github.com/elysiajs/elysia/pull/891) Upgrade Cookie to 0.7.x to fix CVE-2024-47764
Bug fix:
- [#885](https://github.com/elysiajs/elysia/pull/885) unwrap transform errors
- [#903](https://github.com/elysiajs/elysia/pull/903) typebox object schemas without properties key
# 1.1.23 - 22 Oct 2024
Bug fix:
- Handle object with `.then` even if it's not promise (looking at you, Drizzle)
# 1.1.22 - 13 Oct 2024
Bug fix:
- Fix `set-cookie` to resent if value is accessed even without set
# 1.1.21 - 13 Oct 2024
Improvement:
- infer 200 response from handle if not specified
# 1.1.20 - 10 Oct 2024
Bug fix:
- merge guard and not specified hook responses status
# 1.1.19 - 7 Oct 2024
Bug fix:
- unable to return `error` from derive/resolve
# 1.1.18 - 4 Oct 2024
Breaking change:
- remove automatic conversion of 1-level deep object with file field to formdata
- migration: wrap a response with `formdata`
- (internal): remove `ELYSIA_RESPONSE` symbol
- (internal) `error` now use `class ElysiaCustomStatusResponse` instead of plain object
Improvement:
- Optimize `object type` response mapping performance
# 1.1.17 - 29 Sep 2024
Change:
- Coerce number to numeric on body root automatically
- Coerce boolean to booleanString on body root automatically
Bug fix:
- [#838](https://github.com/elysiajs/elysia/issues/838) invalid `onAfterResponse` typing
- [#855](https://github.com/elysiajs/elysia/issues/855) Validation with Numeric & Number options doesn't work
- [#843](https://github.com/elysiajs/elysia/issues/843) Resolve does not work with aot: false
# 1.1.16 - 23 Sep 2024
Bug fix:
- separate between `createStaticHandler` and `createNativeStaticHandler` for maintainability
- performance degradation using inline fetch on text static response and file
# 1.1.15 - 23 Sep 2024
Bug fix:
- `createStaticResponse` unintentionally mutate `set.headers`
# 1.1.14 - 23 Sep 2024
Feature:
- add auto-completion to `Content-Type` headers
Bug fix:
- exclude file from Bun native static response until Bun support
- set 'text/plain' for string if no content-type is set for native static response
# 1.1.13 - 18 Sep 2024
Feature:
- [#813](https://github.com/elysiajs/elysia/pull/813) allow UnionEnum to get readonly array by @BleedingDev
Bug fix:
- [#830](https://github.com/elysiajs/elysia/issues/830) Incorrect type for ws.publish
- [#827](https://github.com/elysiajs/elysia/issues/827) returning a response is forcing application/json content-type
- [#821](https://github.com/elysiajs/elysia/issues/821) handle "+" in query with validation
- [#820](https://github.com/elysiajs/elysia/issues/820) params in hooks inside prefixed groups are incorrectly typed never
- [#819](https://github.com/elysiajs/elysia/issues/819) setting cookie attribute before value cause cookie attribute to not be set
- [#810](https://github.com/elysiajs/elysia/issues/810) wrong inference of response in afterResponse, includes status code
# 1.1.12 - 4 Sep 2024
Feature:
- setup provenance publish
- [#808](https://github.com/elysiajs/elysia/pull/808) add UnionEnum type with JSON schema enum usage
- [#807](https://github.com/elysiajs/elysia/pull/807) add closeActiveConnections to Elysia.stop()
Bug fix:
- [#808](https://github.com/elysiajs/elysia/pull/808) ArrayString type cast as Object instead of Array
- config.nativeStaticResponse is not defined
# 1.1.11 - 1 Sep 2024
Feature:
- native Bun static response
- can be disabled by setting `app.config.nativeStaticResponse = false`
- [#93](https://github.com/elysiajs/elysia/issues/93) export TypeSystemPolicy
- [#752](https://github.com/elysiajs/elysia/issues/752) tye coercion on dynamic mode
Bug fix:
- [#332](https://github.com/elysiajs/elysia/issues/332) mount() does not preserve body when fetching through http server
- Using as('plugin') cast cause derive key to be unknown
# 1.1.10 30 Aug 2024
Bug fix:
- incorrect named export 'fasti-querystring' to 'fast-querystring'
# 1.1.9 - 28 Aug 2024
Change:
- getter fields no longer stringified to JSON by default on returning response
Bug fix:
- [#796](https://github.com/elysiajs/elysia/issues/796) ValueClone: Unable to clone value after 1.1.8 update
- [#795](https://github.com/elysiajs/elysia/issues/795) Broken Dates after 1.1.8 update
- [#793](https://github.com/elysiajs/elysia/issues/793) Unable to delete property. t.File()
# 1.1.8 - 27 Aug 2024
Feature:
- [#748](https://github.com/elysiajs/elysia/issues/748) add standardHostname config
Bug fix:
- [#787](https://github.com/elysiajs/elysia/issues/787) [#789](https://github.com/elysiajs/elysia/issues/789) [#737](https://github.com/elysiajs/elysia/issues/737) Unexpected TypeError on NODE_ENV=production in mapValueError
- [#793](https://github.com/elysiajs/elysia/issues/793) unable to delete property t.File()
- [#780](https://github.com/elysiajs/elysia/issues/780) error from sending empty body multipart/form-data
- [#779](https://github.com/elysiajs/elysia/issues/779) custom errors thrown in onRequest are not usable when caught in onError
- [#771](https://github.com/elysiajs/elysia/issues/771) error from body-parser when sent Content-Type header without body
- [#679](https://github.com/elysiajs/elysia/issues/679) plugin registered by async inline function don't work
- [#670](https://github.com/elysiajs/elysia/issues/670) support for classes and getter fields
# 1.1.7 - 19 Aug 2024
Bug fix:
- `parseQuery` is not parsing array on body
Change:
- rename `parseQuery` to `parseQueryFromURL`
- export fast-querystring.js path
# 1.1.6 - 12 Aug 2024
Feature:
- [#763](https://github.com/elysiajs/elysia/pull/763) add hide in detail to hide route from OpenAPI/swagger
- add streaming support for fetch proxy
Bug fix:
- [#776](https://github.com/elysiajs/elysia/issues/776) custom errors throw in onRequest do not get proper code set in onError
# 1.1.5 - 2 Aug 2024
Feature:
- refactor fastQuerystring using switch and bitwise flag
Bug fix:
- sucrose: invalid separateFunction on minified async function
- [#758](https://github.com/elysiajs/elysia/issues/758) guard doesn't apply cookie schema
# 1.1.4 - 23 Jul 2024
Feature:
- [#718](https://github.com/elysiajs/elysia/pull/718) implement normalization support for class instances with getter functions
Bug fix:
- removeColonAlias accidentally slice -2 end index for last parameter
- [#726](https://github.com/elysiajs/elysia/pull/726) lazy instantiation of `stringToStructureCoercions`
- [#750](https://github.com/elysiajs/elysia/issues/750) Cookie: Right side of assignment cannot be destructured
- [#749](https://github.com/elysiajs/elysia/issues/749) Query params following an array query are parsed as array items
- [#751](https://github.com/elysiajs/elysia/issues/751) Dynamic mode response failed if null or undefined value is returned
- [#741](https://github.com/elysiajs/elysia/issues/741) stream stringify object
# 1.1.3 - 17 Jul 2024
Change:
- sucrose: exact inference name
- use `mapResponse` instead of `mapCompactResponse` for stream
- [#727](https://github.com/elysiajs/elysia/issues/727)
- defers first stream execution before returning response
- [#729](https://github.com/elysiajs/elysia/issues/729)
- [#722](https://github.com/elysiajs/elysia/issues/722) derive context is not passed to onError
Bug fix:
- `onError` with scope not being able to infer context type
# 1.1.2 - 16 Jul 2024
Bug fix:
- [#724](https://github.com/elysiajs/elysia/issues/724), [bun#12594](https://github.com/oven-sh/bun/issues/12594) sucrose: possibly fix `bun build --compile` not being able to infer first, and last context parameter
- derive is being override by resolve in certain function
- [#722](https://github.com/elysiajs/elysia/issues/722) Type error with global `app.derive` followed by onError
- params on `onError` is now `{ [key in string]: string }` instead of `never`
- [#721](https://github.com/elysiajs/elysia/issues/721) unexpected isContextPassToFunction: minified whitespace of arrow function causing inaccurate separateFunction
# 1.1.1 - 16 Jul 2024
Breaking Change:
- parse query as `string` instead of `string | string[]` unless specified
# 1.1.0 - 16 Jul 2024
Feature:
- Trace v2
- Normalization is on by default
- Data type coercion
- Guard as, bulk as cast
- Response status coercion
- Optional path parameter
- Generator response stream
Breaking Change:
- Parse value as string for all validators unless explicitly specified.
- See [50a5d92](https://github.com/elysiajs/elysia/commit/50a5d92ea3212c5f95f94552e4cb7d31b2c253ad), [44bf279](https://github.com/elysiajs/elysia/commit/44bf279c3752c6909533d19c83b24413d19d27fa).
- Remove objects auto-parsing in query unless explicitly specified via query
- Except query string as defined in RFC 3986, TLDR; query string could be either string or array of string.
- Rename `onResponse` to `onAfterResponse`
- [Internal] Remove $passthrough in favor of toResponse
- [Internal] UnwrapRoute type now always resolve with status code
Improvement:
- Add auto-complete for `set.headers`
- Add `server` property
- `onError` supports array function
- Parse query object with and without schema
- Sucrose: improve isContextPassToFunction, and extractMainParameter stability
- Add `replaceSchemaType`
- Add `route` to `context`
- Optimize recursive MacroToProperty type
- Parse query array and object
- Optimize code path for `composeGeneralHandler`
- Add debug report on compiler panic
- Reduce memory usage of route registration ~36% on large codebase
- Reduce compilation code path
- Remove trace inference
- Reduce router compilation code path
- removing route handler compilation cache (st${index}, stc${index})
- Add undefined union to cookie in case if cookie is not present
- Optimize response status resolve type inference
Change:
- Deprecated `ObjectString` for parsing array
- Using `Cookie<unknown>` instead of `Cookie<any>` if schema is not defined
- Remove prototype poluation from hook
- remove static analysis for query name
- remove query replace '+' in favor removing static query analysis
- mapResponse is now called in error event
- reconcilation decorator in type level
Bug fix:
- Normalize headers accidentally use query validator check instead
- `onError` missing trace symbol
- Headers validator compilation is not cached
- Deduplicate macro propagation
- Websocket in nested group now work
- Error response is not check unless successful status code is provided
# 1.0.27 - 2 Jul 2024
Bug fix:
- [#640](https://github.com/elysiajs/elysia/issues/640) Unable to access root level macros in plugins
- [#606](https://github.com/elysiajs/elysia/issues/606) Object encoding in query parameters
# 1.0.26 - 30 Jun 2024
Bug fix:
- mapResponse is not called on beforeHandle, and afterHandle
# 1.0.25 - 21 Jun 2024
Bug fix:
- type is resolved as `File` if `@types/bun` is not installed when using with Eden Treaty
# 1.0.24 - 18 Jun 2024
Bug fix:
- `derive`, `resolve` support void return
- [#677](https://github.com/elysiajs/elysia/issues/677) Query params validation for array of string fail
# 1.0.23 - 9 Jun 2024
Feature:
- add `toResponse` for mapping custom response
- [#606](https://github.com/elysiajs/elysia/issues/606) Object encoding in query parameters
Bug fix:
- [#654](https://github.com/elysiajs/elysia/pull/654) set correct normalization behavior for addtional properties
- [#649](https://github.com/elysiajs/elysia/pull/649) cookie decode value might be null
- [#664](https://github.com/elysiajs/elysia/issues/664) "default" option is not being applied on validation
- [#656](https://github.com/elysiajs/elysia/issues/656) ctx.query doesn't work in some case
- set forceDynamicQuery to true by default
- [#658](https://github.com/elysiajs/elysia/issues/658) aot does not recognize the use of ctx.body within a try catch
- [#630](https://github.com/elysiajs/elysia/issues/630) accessing ctx.query directly breaks the object
# 1.0.22 - 23 May 2024
Breaking Change:
- set default cookie path to `/`
Feature:
- add `form` utility for returning explicit formdata
- add object with image to return as `formdata`
Bug fix:
- return `Bun.file` by specifying `t.File()` and `t.Object({ any: t.File() })` as a response
# 1.0.21 - 21 May 2024
Breaking Change:
- `t.type({ error })` now accepts `(error: ({ type, validator, value, errors }) => unknown)` instead of `(error: (type, validator, value) => unknown)`
Improvement:
- `t.type({ error })` accepts `string | number | boolean | Object` instead of `string`
- `t.type({ error })` return `string | number | boolean | Object | void` instead of `string`
- add `errors: ValueError[]` to `t.type({ error({ errors }) {} })`
Bug fix:
- [#644](https://github.com/elysiajs/elysia/issues/644) redirect doesn't work with `aot: false`
- [#641](https://github.com/elysiajs/elysia/issues/641) cookie schema validation doesn't work with `aot: true`
- [#615](https://github.com/elysiajs/elysia/issues/615) highlight derive and resolve when using `onError`
# 1.0.20 - 13 May 2024
Bug fix:
- macro is not inherits inside group
# 1.0.19 - 13 May 2024
Bug fix:
- remove set.clone spread operator for mapping Response
# 1.0.18 - 11 May 2024
Feature:
- add support for partitioned cookie
Bug fix:
- recursive MacroToProperty type on unknown macro
# 1.0.17 - 9 May 2024
Improvement:
- add context.url to get full URL string (including query)
- reduce query parsing instruction
# 1.0.16 - 2 May 2024
Bug fix:
- [ratelimit#28](https://github.com/rayriffy/elysia-rate-limit/issues/28) trace hang when using server-timing with rate-limit plugin
# 1.0.15 - 27 Apr 2024
Feature:
- add `redirect` function to `Context`
Improvement:
- sucrose: remove unreachable query bracket check, reduce bracket instruction
- sucrose: query accessor keyword check at initialization instead of in loop
- sucrose: remove accessor check
- sucrose: skip query check for immediate return
Change:
- sucrose: add `isArrowReturn` to `separateFunction`
- sucrose: skip inference queries check if `query` is not found
Change:
- allow custom parser when `type` is specified
- add `contentType` to context
- soft deprecate `contentType` as 2nd `parse` parameter
Bug fix:
- [#622](https://github.com/elysiajs/elysia/issues/622) sucrose: mistake cookie for query
- duplicate format found
- using `parse`, `type`, `body` generate invalid syntax
# 1.0.14 - 22 Apr 2024
Improvement:
- [#596](https://github.com/elysiajs/elysia/pull/596) account for 20x response status schemas for type safety
Bug fix:
- [#615](https://github.com/elysiajs/elysia/issues/615)
- [588](https://github.com/elysiajs/elysia/issues/588) separate async derive/resolve function doesn't get await
- primitive thrown result in invalid type
# 1.0.12 - 5 Apr 2024
Improvement:
- export `InferContext` and `InferHandler`
Bug fix:
- remove accidental `console.log` in `compile`
# 1.0.12 - 5 Apr 2024
Feature:
- add `InferContext`
Bug fix:
- returning null with response validation cause error
# 1.0.11 - 2 Apr 2024
Bug fix:
- possibly fix for "Duplicate type kind 'Files' detected"
- add ajv-formats
- [#562](https://github.com/elysiajs/elysia/pull/575) %26 (&) to be interpreted as & (query separator)
# 1.0.10 - 30 Mar 2024
Bug fix:
- [ServerTiming#1](https://github.com/elysiajs/elysia-server-timing/issues/1) late beforeHandle on set trace inference doesn't produce exit instruction
# 1.0.9 - 25 Mar 2024
Feature:
- `Elysia.config.detail` constructor
- shorthand `Elysia.tags` to constructor, `LocalHook`
- guard inherits detail
Bug fix:
- inference link on `precompile: false` creating unnecessary instruction
# 1.0.8 - 25 Mar 2024
Feature:
- [#562](https://github.com/elysiajs/elysia/pull/562) add `normalize` config
Improvement:
- Scope cookie instruction to route level instead of global config
- [#557](https://github.com/elysiajs/elysia/pull/557) cache tsc buildinfo for running faster
- [#551](https://github.com/elysiajs/elysia/pull/551) use AnyElysia instead of inline Elysia<any>
Bug fix:
- [#564](https://github.com/elysiajs/elysia/pull/564) Fixing "ReadableStream is locked"
- [#552](https://github.com/elysiajs/elysia/pull/552) fix: shift promise in PromiseGroup even when rejected
# 1.0.7 - 20 Mar 2024
Feature:
- add Elysia.propagate to propagate hook type from 'local' to 'scoped'
Improvement:
- remove function.$elysia
- remove function extension
Bug fix:
- duplicate macro call
- [#548](https://github.com/elysiajs/elysia/issues/548) additional case for "accessing all query params using property name (ctx.query) doesn't work anymore"
- [#599](https://github.com/elysiajs/elysia/issues/559) plugin with scoped settings not functioning correctly
# 1.0.6 - 20 Mar 2024
Bug fix:
- inline function doesn't propagate correctly on type level
# 1.0.5 - 19 Mar 2024
Improvement:
- using regex for date pattern matching before using new Date validation
- using tsc to emit declaration file instead of tsup
- add `mapResponse` to MacroManager
Bug fix:
- Ephemeral and Volatile type isn't recognize by MacroManager
- inline guard cookie doesn't apply to local instance
# 1.0.4 - 18 Mar 2024
Improvement:
- resolve, derive soundness
# 1.0.3 - 18 Mar 2024
Improvement:
- Reduce instruction for static resource
Bug fix:
- Fix returning mulitple status code using `error` doesn't accept the response
# 1.0.2 - 18 Mar 2024
Feature:
- add `scoped` support for `derive` and `resolve`
Improvement:
- Type soundness
- type inference performance improvement
# 1.0.1 - 18 Mar 2024
Improvement:
- `mapHandler` now check passthrough once instead of twice
- exclude return type of`ELYSIA_RESPONSE` type from `derive` and `resolve`
- throw error if `error` is return in `derive` and `resolve`
- handle `return error` on `transform`
- [#502](https://github.com/elysiajs/elysia/pull/502) merge response schema from parent scope
Bug fix:
- explicit `type: 'json'` with body schema throw unexpected `body.Check` is not a function
- [#549](https://github.com/elysiajs/elysia/pull/549) await the .modules of nested Elysia instances
- [#548](https://github.com/elysiajs/elysia/issues/548) Accessing all query params using property name (ctx.query) doesn't work anymore
# 1.0.0 - 16 Mar 2024
Improvement:
- fine-grained reactive cookie
- using single source of truth for cookie
- macro support for websocket
- add `mapResolve`
- add `{ as: 'global' | 'scoped' | 'local' }` to lifecycle event
- add ephemeral type
- inline `error` to handler
- inline `error` has auto-completion and type checking based on status code
- handler now check return type of `error` based on status code
- utility `Elysia._types` for types inference
- [#495](https://github.com/elysiajs/elysia/issues/495) Provide user friendly error for failed parse
- handler now infers return type for error status for Treaty
- `t.Date` now allow stringified date
- improves type test case
- add test case for all life-cycle
- resolve, mapResolve, derive, mapDerive use ephemeral type to scope down accurately
- inference query dynamic variable
Breaking Change:
- [#513](https://github.com/elysiajs/elysia/issues/513) lifecycle is now local first
Change:
- group private API property
- move `Elysia.routes` to `Elysia.router.history`
- detect possible json before return
- unknown response now return as-is instead of JSON.stringify()
- change Elysia validation error to JSON instead of string
- static content evalute hook JIT instead of AOT
Bug fix:
- [#466](https://github.com/elysiajs/elysia/issues/466) Async Derive leaks request context to other requests if `aot: true`
- [#505](https://github.com/elysiajs/elysia/issues/505) Empty ObjectString missing validation inside query schema
- [#503](https://github.com/elysiajs/elysia/issues/503) Beta: undefined class when using decorate and derive
- onStop callback called twice when calling .stop
- mapDerive now resolve to `Singleton['derive']` instead of `Singleton['store']`
- `ValidationError` doesn't return `content-type` as `application/json`
- validate `error(status, value)` validate per status
- derive/resolve always scoped to Global
- duplicated onError call if not handled
- [#516](https://github.com/elysiajs/elysia/issues/516) server timing breaks beforeHandle guards
- cookie.remove() doesn't set correct cookie path
# 0.8.17 - 12 Feb 2024
Feature:
- [#474](https://github.com/elysiajs/elysia/pull/474) Numeric Cookie with length >= 16 cant be parsed to number
- [#476](https://github.com/elysiajs/elysia/pull/476) Using a query key that contains a hyphen or a dot raises a SyntaxError
- [#460](https://github.com/elysiajs/elysia/pull/460)
- [#458](https://github.com/elysiajs/elysia/pull/458) Multiple scoped plugins do not register routes
- [#457](https://github.com/elysiajs/elysia/pull/457) Elysia arguments scoped and prefix do not work at the same time
Change:
- [#472](https://github.com/elysiajs/elysia/pull/472) Move documentation issue template to documentation repository
# 0.8.16 - 6 Feb 2024
Feature:
- [#448](https://github.com/elysiajs/elysia/pull/448) BooleanString - @bogeychan
Bug fix:
- [#451](https://github.com/elysiajs/elysia/pull/464) handle spread operator use on possible null or undefined
- [#460](https://github.com/elysiajs/elysia/pull/460)
- [#457](https://github.com/elysiajs/elysia/pull/457) scoped plugin instances now respect the prefix property
- [#458](https://github.com/elysiajs/elysia/pull/458) adding a second scoped plugin does not unmount the route handler of a previously added scoped instance anymore.
# 0.8.15 - 30 Jan 2024
Bug fix:
- [#451](https://github.com/elysiajs/elysia/issues/451) macro does not run when it should (macro deduplication)
- [#450](https://github.com/elysiajs/elysia/issues/450) Local hook parse doesn't get executed with `aot: false`
# 0.8.14 - 26 Jan 2024
Bug fix:
- types are missing in `exports.*`
- [#441](https://github.com/elysiajs/elysia/issues/441) Vite doesn't get bundle without main
# 0.8.13 - 26 Jan 2024
Bug fix:
- types is not import
- bun build regression on export * from '@sinclair/typebox/system'
- update memoirist to use mjs
# 0.8.12 - 26 Jan 2024
Change:
- using .mjs for es module
# 0.8.11 - 26 Jan 2024
Change:
- using tsup instead of swc
- [#441](https://github.com/elysiajs/elysia/issues/441) remove nanoid, using web crypto randomInt instead
Bug fix:
- [#446](https://github.com/elysiajs/elysia/pull/446) numeric string check to use Number instead of parseInt
- [#445](https://github.com/elysiajs/elysia/pull/445) empty body custom response when set.headers is empty
# 0.8.10 - 24 Jan 2024
Bug fix:
- [#440](https://github.com/elysiajs/elysia/pull/440) query params with + sign did not get converted
- [#433](https://github.com/elysiajs/elysia/pull/433) remove crypto, unblock vite bundling, cloudflare worker support
- [#422](https://github.com/elysiajs/elysia/pull/422) add check for instanceof if constructor.name doesn't match
# 0.8.9 - 11 Jan 2024
Bug fix:
- macro panic
# 0.8.8. - 2 Jan 2024
Bug fix:
- Add TypeBox back to Bun bundle
# 0.8.7 - 1 Jan 2024
Improvement:
- [#385](https://github.com/elysiajs/elysia/issues/385) If error is instanceof Response, respond with it
Bug fix:
- onRequest doesn't early return
- handle thrown error function
- [#373](https://github.com/elysiajs/elysia/issues/373) cookie is not set when File is return
- [#379](https://github.com/elysiajs/elysia/issues/379) WebSocket: Sending a space character ' ' receives 0
- [#317](https://github.com/elysiajs/elysia/issues/317) Exclude TypeBox from bundling
# 0.8.6. - 29 Dec 2023
Bug fix:
- body without default value thrown Object.assign error
# 0.8.5. - 27 Dec 2023
Bug fix:
- Bun entry point
# 0.8.4. - 27 Dec 2023
Bug fix:
- macro caused an Object.entries cannot be undefined
- `mapResponse` and `afterHandle` missing decorators
# 0.8.3. - 23 Dec 2023
Bug fix:
- add early return on `isContextPassToFunction` for static content to prevent invalid regex
# 0.8.2 - 23 Dec 2023
Bug fix:
- `ctx.path` and `ctx.qi` is missing when using `onRequest`
# 0.8.1 - 23 Dec 2023
Bug fix:
- `be` is undefined when using `afterResponse` with `mapResponse`
# 0.8.0 - 23 Dec 2023
Feature:
- `headers` initialization function
- macro
- static content
- default property
- error function
- add stack trace to plugin checksum configurable by `config.analytic` (default to false)
- new life-cycle
- `resolve`: derive after validation
- `mapResponse`: custom response mapping
Improvement:
- lazy query reference
- add content-range header to `File` and `Blob` by default if etag is not used
- update TypeBox to 0.32
- override lifecycle response of `be` and `af`
Breaking Change:
- `afterHandle` no longer early return
Change:
- change validation response to JSON
- differentiate derive from `decorator['request']` as `decorator['derive']`
- `derive` now don't show infer type in onRequest
Bug fix:
- remove `headers`, `path` from `PreContext`
- remove `derive` from `PreContext`
- Elysia type doesn't output custom `error`
- `onStart` doesn't reflect server
# 0.7.31 - 9 Dec 2023
Improvement:
- [#345](https://github.com/elysiajs/elysia/pull/345) add font to `SchemaOptions`
- Update `@types/cookie` to `^0.6.0`
Bug fix:
- [#338](https://github.com/elysiajs/elysia/pull/338) guard sandbox did not inherit global config.
- [#330](https://github.com/elysiajs/elysia/pull/330) preserve query params for mounted handler
- [#332](https://github.com/elysiajs/elysia/pull/332) reexport TSchema from typebox
- [#319](https://github.com/elysiajs/elysia/pull/319) TypeBox Ref error when using Elysia.group()
# 0.7.30 - 5 Dec 2023
Bug fix:
- Emergency release override latest beta
# 0.7.29 - 19 Nov 2023
Bug fix:
- WebSocket params conflict with defined type
- Inherits status code on custom error
# 0.7.28 - 16 Nov 2023
Chore:
- Update `cookie` to `0.6.0`
Bug fix:
- [#314](https://github.com/elysiajs/elysia/pull/314) Unable to dereference schema with 'undefined' when using t.Ref
# 0.7.27 - 16 Nov 2023
Bug fix:
- [#312](https://github.com/elysiajs/elysia/issues/312) default params type suggestion for WebSocket
- [#310](https://github.com/elysiajs/elysia/issues/310) Preserve original hostname when using `.mount()`
- [#309](https://github.com/elysiajs/elysia/issues/309) t.RegExp doesn't work due to requiring default value
- [#308](https://github.com/elysiajs/elysia/issues/308) t.Numeric should not convert empty string to 0
- [#305](https://github.com/elysiajs/elysia/issues/305) Elysia({ scoped: true }) should still expose defined routes on type level
- [#304](https://github.com/elysiajs/elysia/issues/304) Using a hook/guard/schema with a handler function and request without body results in a "Unexpected end of JSON input"-error
- [#299](https://github.com/elysiajs/elysia/issues/299) Missing request.path parameter in .onRequest
- [#289](https://github.com/elysiajs/elysia/issues/289) Ability to localize TypeBox errors
- [#272](https://github.com/elysiajs/elysia/issues/272) onError handler has error property as undefined on Cloudflare Workers
- [#210](https://github.com/elysiajs/elysia/issues/210) t.Numeric not validating properly
- [#188](https://github.com/elysiajs/elysia/issues/188) Status codes of the error classes don't match the response through onError
- [#140](https://github.com/elysiajs/elysia/issues/140) plugin hierarchy messes up derive function in child plugin
- [#27](https://github.com/elysiajs/elysia/issues/27) Websocket definition in groups
# 0.7.26 - 15 Nov 2023
Bug fix:
- duplicated lifecycle event if using function plugin async
# 0.7.25 - 14 Nov 2023
Bug fix:
- Leaked type from `guard` callback and `group guard`
# 0.7.24 - 8 Nov 2023
Bug fix:
- add `ReadableStream` to response mapping to `mapResponse`
# 0.7.23 - 8 Nov 2023
Bug fix:
- Send `exit` status on early return with trace set
# 0.7.22 - 8 Nov 2023
Change:
- Rewrite `trace`
Bug fix:
- trace not awaiting multiple trace process
- trace hang on early `beforeHandle` return
- `afterHandle` with `trace.afterHandle` AoT cause duplicate value header
# 0.7.21 - 27 Oct 2023
Bug fix:
- [#281](https://github.com/elysiajs/elysia/pull/281) add cookie.remove options
- add `await traceDone` to early return
# 0.7.20 - 26 Oct 2023
Bug fix:
- `trace` is stuck when inherits to plugin
Improvement:
- add unit test for `mapCompactResponse`, `Passthrough`
# 0.7.19 - 25 Oct 2023
Bug fix:
- add `$passthrough` for `mapCompactResponse`
# 0.7.18 - 24 Oct 2023
Feature:
- add map handler for `ReadableStream`
- add `$passthrough` for custom property for response mapping
Bug fix:
- `.route` accept `string[]` instead of `string`
Change:
- remove `ElyEden`
# 0.7.17 - 15 Oct 2023
Feature:
- add `ElyEden`
- re-add `id` to websocket
Bug fix:
- [#255](https://github.com/elysiajs/elysia/issues/255) removeCookie sends HTTP-Header that is ignored by the Browser
- [#263](https://github.com/elysiajs/elysia/issues/263) http and websocket on same route
- [#269](https://github.com/elysiajs/elysia/pull/269) Correct handling of Buffer object
# 0.7.16 - 10 Oct 2023
Improvement:
- `t.Cookie` cookie option type
- [#253](https://github.com/elysiajs/elysia/pull/253) platform agnostic cookie
- Decorator like `state`, `decorate` and `derive`, doesn't apply to WebSocket `data`
- re-export `Static` from
# 0.7.15 - 26 Sep 2023
Change:
- Update TypeBox to 0.31.17
- [#218](https://github.com/elysiajs/elysia/pull/218) Fix [#213](https://github.com/elysiajs/elysia/pull/213) prepend async redefined routes (partial fix)
- Using set `onRequest` doesn't set headers and status on empty error handler
# 0.7.14 - 26 Sep 2023
Bug fix:
- Make `t.Files` parameter optional
- model remap now using `TSchema` instead of literal type for creating type abstraction
# 0.7.13 - 25 Sep 2023
Improvement:
- Using listener instead of microtick to handle `trace.set`
- Set default cookie path to '/'
Bug fix:
- Duplicate group path when hook is provided
# 0.7.12 - 23 Sep 2023
Bug fix:
- Handle cookie expire time
- Set default value of config.cookie.path to '/'
# 0.7.11 - 23 Sep 2023
Improvement:
- Skip cookie validation if schema is empty object
Bug fix:
- Accept cookie property from constructor when schema is not defined
# 0.7.10 - 23 Sep 2023
Bug fix:
- handle FFI object in deepMerge, fix Prisma
# 0.7.9 - 23 Sep 2023
Bug fix:
- async instance cause config to be undefined
# 0.7.8 - 23 Sep 2023
Bug fix:
- async instance cause type conflict
# 0.7.7 - 22 Sep 2023
Bug fix:
- [#210](https://github.com/elysiajs/elysia/issues/210) `t.Numeric` allowing plain `String`
- `t.ObjectString` allowing plain `String`
- [#209](https://github.com/elysiajs/elysia/issues/209) `t.MaybeEmpty` tolerate `null` and `undefined`
- [#205](https://github.com/elysiajs/elysia/issues/205) WebSocket routes not working in plugins
- [#195](https://github.com/elysiajs/elysia/pull/195), [#201](https://github.com/elysiajs/elysia/pull/201) allow WebSocket destructuring
# 0.7.6 - 21 Sep 2023
Bug fix:
- Separate return type by status
# 0.7.5 - 21 Sep 2023
Bug fix:
- inject derive to `GraceHandler`
# 0.7.4 - 21 Sep 2023
Bug fix:
- check for class-like object
- add `GraceHandler` to access both `app` and `context`
# 0.7.3 - 21 Sep 2023
Bug fix:
- resolve 200 by default when type is not provided
# 0.7.2 - 20 Sep 2023
Bug fix:
- decorator and store is resolved as `undefined` in `onError` hook
- deepMerge with Module object
- Retain comment in `.d.ts`
# 0.7.1 - 20 Sep 2023
Bug Fix:
- Class property is removed when calling deepMerge
# 0.7.0 - 20 Sep 2023
Feature:
- rewrite type
- rewrite Web Socket
- add mapper method
- add affix, prefix, suffix
- trace
- typeBox.Transfom
- rewrite Type.ElysiaMeta to use TypeBox.Transform
- new type:
- t.Cookie
- t.ObjectString
- t.MaybeEmpty
- t.Nullable
- add `Context` to `onError`
- lifecycle hook now accept array function
- true encapsulation scope
Improvement:
- static Code Analysis now support rest parameter
- breakdown dynamic router into single pipeline instead of inlining to static router to reduce memory usage
- set `t.File` and `t.Files` to `File` instead of `Blob`
- skip class instance merging
- handle `UnknownContextPassToFunction`
- [#157](https://github.com/elysiajs/elysia/pull/179) WebSocket - added unit tests and fixed example & api by @bogeychan
- [#179](https://github.com/elysiajs/elysia/pull/179) add github action to run bun test by @arthurfiorette
Breaking Change:
- remove `ws` plugin, migrate to core
- rename `addError` to `error`
Change:
- using single findDynamicRoute instead of inlining to static map
- remove `mergician`
- remove array routes due to problem with TypeScript
Bug fix:
- strictly validate response by default
- `t.Numeric` not working on headers / query / params
- `t.Optional(t.Object({ [name]: t.Numeric }))` causing error
- add null check before converting `Numeric`
- inherits store to instance plugin
- handle class overlapping
- [#187](https://github.com/elysiajs/elysia/pull/187) InternalServerError message fixed to "INTERNAL_SERVER_ERROR" instead of "NOT_FOUND" by @bogeychan
- [#167](https://github.com/elysiajs/elysia/pull/167) mapEarlyResponse with aot on after handle
# 0.6.24 - 18 Sep 2023
Feature:
- [#149](https://github.com/elysiajs/elysia/pulls/149) support additional status codes in redirects
Improvement:
- [#157](https://github.com/elysiajs/elysia/pulls/157) added unit tests and fixed example & api
Bug fix:
- [#167](https://github.com/elysiajs/elysia/pulls/167) mapEarlyResponse with aot on after handle
- [#160](https://github.com/elysiajs/elysia/pulls/160) typo in test suite name
- [#152](https://github.com/elysiajs/elysia/pulls/152) bad code in Internal server error class
# 0.6.23 - 12 Sep 2023
Bug fix:
- Maximum callstack for duplicated deep class / object
- [#121](https://github.com/elysiajs/elysia/issues/121) Cannot use PrismaClient in .decorate or .state
# 0.6.22 - 11 Sep 2023
Bug fix:
- Remove `const` and `RemoveDeepWritable` from decorate to allow function call
# 0.6.21 - 10 Sep 2023
Feature:
- [#112](https://github.com/elysiajs/elysia/issues/112) Route arrays
# 0.6.20 - 9 Sep 2023
Bug fix:
- [#107](https://github.com/elysiajs/elysia/issues/107) Elysia handler local hooks not recognizing registered errors on app instance
# 0.6.19 - 7 Sep 2023
Bug fix:
- Inherits state and error from plugin instance
# 0.6.18 - 5 Sep 2023
Improvement:
- Automatically parse File to `Files` if set
# 0.6.17 - 4 Sep 2023
Bug fix:
- [#98](https://github.com/elysiajs/elysia/issues/98) Add context.set.cookie to accept array of string
- [#92](https://github.com/elysiajs/elysia/pull/92) WebSocket beforeHandle unable to access plugins / state / derive's
# 0.6.16 - 1 Sep 2023
Bug fix:
- inherits `onError` lifecycle from plugin instance
# 0.6.15 - 31 Aug 2023
Bug fix:
- inherits `set` if `Response` is returned
# 0.6.14 - 28 Aug 2023
Bug fix:
- deduplicate plugin via global model
- duplicated life-cycle
- top-down plugin deduplication
- plugin life-cycle leak on new model
- add `Elysia.scope` to contain lifecycle, store, and decorators
# 0.6.13 - 28 Aug 2023
Bug fix:
- make this.server.reload optional to make Node compatability work
- duplicate path name when using prefix config with group
- don't filter local event inside new plugin model group
- Remove post.handler in return
# 0.6.12 - 26 Aug 2023
Bug fix:
- Make this.server.reload optional to make Node compatability work
# 0.6.11 - 16 Aug 2023
Bug fix:
- [#86](https://github.com/elysiajs/elysia/issues/86) Group prefix repeating on inline function callback
- [#88](https://github.com/elysiajs/elysia/issues/88), onResponse hooks validation return non 400
# 0.6.10 - 13 Aug 2023
Bug fix:
- Query is set to pathname when ? not presented in dynamic mode
# 0.6.9 - 11 Aug 2023
Bug fix:
- Derive not working on dynamic mode
# 0.6.8 - 11 Aug 2023
Bug fix:
- append routes on dynamic mode
# 0.6.7 - 11 Aug 2023
Bug fix:
- use: Plugin type inference
# 0.6.6 - 11 Aug 2023
Bug fix:
- Collide Elysia.prefix on other methods
# 0.6.5 - 11 Aug 2023
Bug fix:
- Collide Elysia.prefix type
# 0.6.4 - 11 Aug 2023
Bug fix:
- Collide Elysia.prefix type
- Add skip group with prefix instance see [#85](https://github.com/elysiajs/elysia/pull/85)
# 0.6.3 - 8 Aug 2023
Bug fix:
- resolve .code and [ERROR_CODE]
# 0.6.2 - 8 Aug 2023
Change:
- Add **ErrorCode** symbol
Bug fix:
- Inline guard hook
- Error code not handled
- Set default query to {} when presented
# 0.6.1 - 6 Aug 2023
Improvement:
- Drop usage of `node:process` to support Cloudflare Worker
# 0.6.0 - 6 Aug 2023
Feature:
- Introducing Dynamic Mode (aot: false)
- Introducing `.mount`
- Introducing `.error` for handling Strict Error Type
- Plugin checksum for plugin deduplication
- Add `.onResponse`
Improvement:
- TypeBox 0.30
- AfterHandle now automatically maps the value
- Using Bun Build for targeting Bun
- Support Cloudflare worker with Dynamic Mode (and ENV)
Change:
- Moved registerSchemaPath to @elysiajs/swagger
# 0.6.0-alpha.4
Feature:
- Add `addError` to declaratively add Error to scope
- Add `afterHandle` now can return a literal value instead of limited to only `Response`
# 0.6.0-alpha.3 - 29 Jul 2023
Feature:
- Introduce `.mount`
- Add dynamic mode for TypeBox
- Add $elysiaChecksum to deduplicate lifecycle event
- Add $elysiaHookType to differentiate between global and local hook in `use`
Fix:
- Deduplication of plugin's lifecycle (see $elysiaHookType)
Change:
- Using Bun Build for target Bun
Breaking Change:
- [Internal] refactored `getSchemaValidator`, `getResponseSchemaValidator` to named parameters
- [Internal] moved `registerSchemaPath` to `@elysiajs/swagger`
# 0.6.0-alpha.2
Feature:
- [Internal] Add qi (queryIndex) to context
- Add `error` field to Elysia type system for adding custom error message
# 0.6.0-alpha.1
Feature:
- [Internal] Add support for accessing composedHandler via routes
# 0.6.0-alpha.0
Feature:
- Dynamic mode for Cloudflare Worker
- Support for registering custom error code
- Using `loosePath` (by default), and add `config.strictPath
- Support for setting basePath
- Recursive path typing
Improvement:
- Slighty improve type checking speed
Bug Fix:
- recursive schema collision causing infinite type
Breaking Change:
- Remove Elysia Symbol (Internal)
# 0.5.25 - 25 Jul 2023
Bug fix:
- ws resolve type to undefined instead of unknown cause unexpected type mismatched when not provided
# 0.5.24 - 22 Jul 2023
Bug fix:
- [#68](https://github.com/elysiajs/elysia/issues/68) invalid path params when using numeric
# 0.5.23 - 20 Jul 2023
Bug fix:
- [#68](https://github.com/elysiajs/elysia/issues/68) invalid optional query params when using numeric
# 0.5.22 - 9 Jul 2023
Bug fix:
- update onAfterHandle to be Response only
# 0.5.20 - 23 Jun 2023
Bug fix:
- async fn on Static Code Analysis
# 0.5.19 - 19 Jun 2023
Bug fix:
- optimize `ws` plugin type
# 0.5.18 - 11 Jun 2023
Bug fix:
- `mapEarlyResponse` is missing on request
# 0.5.17 - 7 Jun 2023
Improvement:
- Respect explicit body type first
- `mapCompactResponse` on `null` or `undefined` type
Bug fix:
- Mapped unioned type on Static Code Analysis
- `form` is `undefined` when using parsing `formData`
# 0.5.16 - 5 Jun 2023
Improvement:
- Respect inner scope of lifecycle first
- Add type support for local `afterHandle`
Bug fix:
- `onAfterHandler` cause response to mutate on void
# 0.5.15 - 4 Jun 2023
Improvement:
- Map CommonJS module in package.json
# 0.5.14 - 4 June 2023
Improvement:
- Using tsc to compile CommonJS instead of SWC to support `module.exports` syntax
# 0.5.13 - 4 June 2023
Bug fix:
- Add loosen type for onError's code for defying custom error status
# 0.5.12 - 3 June 2023
Bug fix:
- Multiple onRequest cause error
# 0.5.11 - 31 May 2023
Improvement:
- Experimental basic support for Static Code Analysis in Nodejs
# 0.5.10 - 31 May 2023
Bug fix:
- h is undefined when using headers in Node environment
- Update Memoirist to 0.1.4 to support full CommonJS
# 0.5.9 - 30 May 2023
Improvement:
- Add content-type support for 'none', 'arrayBuffer' / 'application/octet-stream'
- Add type support type registration of wildcard params
- Add support for 'config.basePath'
# 0.5.8 - 27 May 2023
Improvement:
- Add support for returning a class instance
# 0.5.7 - 25 May 2023
Bug fix:
- Bun is undefined on other runtime
# 0.5.6 - 25 May 2023
Improvement:
- Using `new Response` instead of factory `Response.json`
# 0.5.5 - 25 May 2023
Improvement:
- Using request.json() to handle application/json body instead of JSON.parse(await c.text())
# 0.5.4 - 25 May 2023
Improvement:
- Add Static Code Analysis for conditional try-catch
- Reduce usage of method to accessor
# 0.5.3 - 22 May 2023
Improvement:
- Add `mapCompactResponse` for static code analysis
- Using `constructor.name` to inline object mapping
- Using single assignment for URL destructuring
- Using default map for dynamic route to remove static map label and break
Bug fix:
- Web Socket context.headers is empty [Elysia#46](https://github.com/elysiajs/elysia/issues/46)
# 0.5.2 - 16 May 2023
Improvement:
- Static Code Analysis for fallback route
Bug fix:
- Remove constant generic from `state` to be mutable
# 0.5.1 - 16 May 2023
Bug fix:
- Syntax error if multiple numeric type is set
- Prevent fallthrough behavior of switch map
# 0.5.0 - 15 May 2023
Improvement:
- Add CommonJS support for running Elysia with Node adapter
- Remove manual fragment mapping to speed up path extraction
- Inline validator in `composeHandler` to improve performance
- Use one time context assignment
- Add support for lazy context injection via Static Code Analysis
- Ensure response non nullability
- Add unioned body validator check
- Set default object handler to inherits
- Using `constructor.name` mapping instead of `instanceof` to improve speed
- Add dedicated error constructor to improve performance
- Conditional literal fn for checking onRequest iteration
- improve WebSocket type
Bug fix:
- Possible
Breaking Change:
- Rename `innerHandle` to `fetch`
- to migrate: rename `.innerHandle` to `fetch`
- Rename `.setModel` to `.model`
- to migrate: rename `setModel` to `model`
- Remove `hook.schema` to `hook`
- to migrate: remove schema and curly brace `schema.type`:
```ts
// from
app.post('/', ({ body }) => body, {
schema: {
body: t.Object({
username: t.String()
})
}
})
// to
app.post('/', ({ body }) => body, {
body: t.Object({
username: t.String()
})
})
```
- remove `mapPathnameRegex` (internal)
# 0.5.0-beta.8 - 15 May 2023
Bug fix:
- it recompile on async
# 0.5.0-beta.7 15 May 2023
Bug fix:
- detect promise on parse
- using swc to compile to commonjs
# 0.5.0-beta.6 - 15 May 2023
Improvement:
- Improve merge schema type
# 0.5.0-beta.5 - 15 May 2023
Bug fix:
- Add support for ALL method for dynamic path
- Add support for parser in pre-compiled body
# 0.5.0-beta.4 - 15 May 2023
Bug fix:
- Use Memoirist instead of Raikiri in ws
# 0.5.0-beta.3 - 15 May 2023
Improvement:
- Static Code Analysis on derive
# 0.5.0-beta.2 - 14 May 2023
Improvement:
- Re-compile on lazy modules
# 0.5.0-beta.1 - 14 May 2023
Improvement:
- Merge nested schema type
# 0.4.14 - 2 May 2023
Fix:
- set default object handler to inherits
# 0.4.13 - 28 Apr 2023
Fix:
- emergency override experimental version
# 0.4.12 - 26 Apr 2023
Fix:
- CatchResponse to return 200 status code by default when using Eden Treaty
# 0.4.11 - 26 Apr 2023
Fix:
- response schema doesn't unwrap response type
# 0.4.10 - 25 Apr 2023
Fix:
- Update Raikiri stability
# 0.4.9 - 21 Apr 2023
Improvement:
- Add support for `parse` in websocket [#33](https://github.com/elysiajs/elysia/pull/33)
Fix:
- Inherits out-of-order `onError` life cycle in nested group
- Update Raikiri to 0.1.2 to handle mangled part
# 0.4.8 - 18 Apr 2023
Fix:
- Fix LocalHandler doesn't check single type response
# 0.4.7 - 18 Apr 2023
Improvement:
- Update Raikiri to ^1.1.0
# 0.4.6 - 10 Apr 2023
Improvement:
- perf: add static route main class
- perf: reduce `ComposedHandler` to function instead of nested object
Fix:
- `group` and `guard` shouldn't decorate a request on type-level (acceptable on run-time level for shared memory)
# 0.4.5 - 6 Apr 2023
Fix:
- Using default value check for `set.status` instead truthy value
# 0.4.4 - 6 Apr 2023
Improvement:
- using `isNotEmpty` for `mapResponse`
- pre check if `set.headers['Set-Cookie']` is array before converting to headers
- using `mapPathnameAndQueryRegEx.exec(request.url)` instead of `request.url.match(mapPathnameAndQueryRegEx)`
# 0.4.3 - 31 Mar 2023
Fix:
- Scoped decorators
# 0.4.2 - 31 Mar 2023
Improvement:
- Use constructor name for faster handler matching
- Map Promise
# 0.4.1 - 31 Mar 2023
Fix:
- remove type module from package.json
# 0.4.0 - 30 Mar 2023
Feature:
- Ahead of Time compilation
- TypeBox 0.26
- Validate response per status instead of union
- Add `if` for conditional route
- Custom Validation Error
Improvement:
- Update TypeBox to 0.26.8
- Inline a declaration for response type
- Refactor some type for faster response
- Use Typebox `Error().First()` instead of iteration
- Add `innerHandle` for returning an actual response (for benchmark)
Breaking Change:
- Separate `.fn` to `@elysiajs/fn`
# 0.3.2 - 26 Mar 2023
Fix:
- child to inhertis WebSocket plugin (https://github.com/elysiajs/elysia/issues/27)
- multiple status response does not work with the group (https://github.com/elysiajs/elysia/issues/28)
# 0.3.1 - 17 Mar 2023
Fix:
- Wildcard fallback of Raikiri
# 0.3.0 - 17 Mar 2023
Feature:
- Elysia Fn
- Suport `multipart/form-data`
- `t.File` and `t.Files` for file validation
- `schema.content` for specifying content type
Improvement:
- Add string format: 'email', 'uuid', 'date', 'date-time'
- Update @sinclair/typebox to 0.25.24
- Update Raikiri to 0.2.0-beta.0 (ei)
- Add file upload test thanks to #21 (@amirrezamahyari)
- Pre compile lowercase method for Eden
- Reduce complex instruction for most Elysia types
- Change store type to `unknown`
- Compile `ElysiaRoute` type to literal
- Optimize type compliation, type inference and auto-completion
- Improve type compilation speed
- Improve TypeScript inference between plugin registration
- Optimize TypeScript inference size
- Context creation optimization
- Use Raikiri router by default
- Remove unused function
- Refactor `registerSchemaPath` to support OpenAPI 3.0.3
- Add `error` inference for Eden
- Mark `@sinclair/typebox` as optional `peerDenpendencies`
Fix:
- Raikiri 0.2 thrown error on not found
- Union response with `t.File` is not working
- Definitions isn't defined on Swagger
- details are missing on group plugin
- group plugin, isn't unable to compile schema
- group is not exportable because EXPOSED is a private property
- Multiple cookies doesn't set `content-type` to `application/json`
- `EXPOSED` is not export when using `fn.permission`
- Missing merged return type for `.ws`
- Missing nanoid
- context side-effects
- `t.Files` in swagger is referring to single file
- Eden response type is unknown
- Unable to type `setModel` inference definition via Eden
- Handle error thrown in non permission function
- Exported variable has or is using name 'SCHEMA' from external module
- Exported variable has or is using name 'DEFS' from external module
- Possible errors for building Elysia app with `declaration: true` in `tsconfig.json`
Breaking Change:
- Rename `inject` to `derive`
- Depreacate `ElysiaRoute`, changed to inline
- Remove `derive`
- Update from OpenAPI 2.x to OpenAPI 3.0.3
- Move context.store[SYMBOL] to meta[SYMBOL]
# 0.3.0-rc.9 - 16 Mar 2023
Improvement:
- Add string format: 'email', 'uuid', 'date', 'date-time'
# 0.3.0-rc.8 - 16 Mar 2023
Fix:
- Raikiri 0.2 thrown error on not found
# 0.3.0-rc.7 - 16 Mar 2023
Improvement:
- Update @sinclair/typebox to 0.25.24
- Update Raikiri to 0.2.0-beta.0 (ei)
- Add file upload test thanks to #21 (@amirrezamahyari)
# 0.3.0-rc.6 - 10 Mar 2023
Fix:
- Union response with `t.File` is not working
# 0.3.0-rc.5 - 10 Mar 2023
Fix:
- Definitions isn't defined on Swagger
- details are missing on group plugin
- group plugin, isn't unable to compile schema
- group is not exportable because EXPOSED is a private property
# 0.3.0-rc.4 - 9 Mar 2023
Fix:
- console.log while using cookie
# 0.3.0-rc.3 - 9 Mar 2023
Breaking Change:
- Rename `inject` to `derive`
Fix:
- Multiple cookies doesn't set `content-type` to `application/json`
- `EXPOSED` is not export when using `fn.permission`
# 0.3.0-rc.2 - 7 Mar 2023
Fix:
- Missing merged return type for `.ws`
# 0.3.0-rc.1 - 7 Mar 2023
Fix:
- Missing nanoid
# 0.3.0-beta.6 - 4 Mar 2023
Fix:
- context side-effects
# 0.3.0-beta.5 - 1 Mar 2023
Improvement:
- Pre compile lowercase method for Eden
# 0.3.0-beta.3 - 27 Feb 2023
Improvement:
- ~33% faster for compiling type inference
- Reduce complex instruction for most Elysia types
- Change store type to `unknown`
Fix:
- `t.Files` in swagger is referring to single file
- Eden response type is unknown
# 0.3.0-beta.2 - 27 Feb 2023
Improvement:
- Compile `ElysiaRoute` type to literal
- Optimize type compliation, type inference and auto-completion
- Improve type compilation speed by ~3x
Fix:
- Unable to type `setModel` inference definition via Eden
Breaking Change:
- Depreacate `ElysiaRoute`, changed to inline
# 0.3.0-beta.1 - 25 Feb 2023
Fix:
- Handle error thrown in non permission function
# 0.3.0-beta.0 - 25 Feb 2023
Feature:
- Elysia Fn
- Suport `multipart/form-data`
- `t.File` and `t.Files` for file validation
- `schema.content` for specifying content type
Improvement:
- Improve TypeScript inference between plugin registration
- Optimize TypeScript inference size
- Context creation optimization
- Use Raikiri router by default
- Remove unused function
- Refactor `registerSchemaPath` to support OpenAPI 3.0.3
- Add `error` inference for Eden
- Mark `@sinclair/typebox` as optional `peerDenpendencies`
Fix:
- Exported variable has or is using name 'SCHEMA' from external module
- Exported variable has or is using name 'DEFS' from external module
- Possible errors for building Elysia app with `declaration: true` in `tsconfig.json`
Breaking Change:
- Remove `derive`
- Update from OpenAPI 2.x to OpenAPI 3.0.3
- Move context.store[SYMBOL] to meta[SYMBOL]
# 0.2.9 - 20 Feb 2023
Bug fix:
- `group` doesn't inherits `onError`
# 0.2.8 - 20 Feb 2023
Bug fix:
- `group` doesn't inherits `onError`
# 0.2.7 - 15 Feb 2023
Improvement:
- Remove `bind(this)`
# 0.2.6 - 10 Feb 2023
Feature:
- Add supports for multiple cookie
# 0.2.5 - 1 Feb 2023
Improvement:
- Minor optimization
# 0.2.4 - 1 Feb 2023
Improvement:
- Using SWC to bundle and minification
- Minor optimization
# 0.2.3 - 30 Jan 2023
Improvement:
- Update Raikiri to 0.0.0-beta.4
Change:
- Remove strictPath option and enabled by default
# 0.2.2 - 30 Jan 2023
Improvement:
- Migrate from @medley/router to Raikiri
- Minor optimization
# 0.2.0-rc.1 - 24 Jan 2023
Improvement:
- Map OpenAPI's schema detail on response
- Fix Type instantiation is excessively deep and possibly infinite
- Improve TypeScript inference time by removing recursive type in generic
- Inferred body is never instead of unknown
# 0.2.0-rc.0 - 23 Jan 2023
Feature:
- Add support for reference model via `.model`
- Add support for OpenAPI's `definitions` field
# 0.2.0-beta.2 - 22 Jan 2023
Feature:
- Add support for custom openapi field using `schema.detail`
- Add support for custom code for `response`
Improvement:
- Unioned status type for response
- Optimize TypeScript inference performance
# 0.2.0-beta.1 - 22 Jan 2023
Breaking Change:
- `onParse` now accepts `(context: PreContext, contentType: string)` instead of `(request: Request, contentType: string)`
- To migrate, add `.request` to context to access `Request`
Feature:
- `onRequest` and `onParse` now can access `PreContext`
- Support `application/x-www-form-urlencoded` by default
Improvement:
- body parser now parse `content-type` with extra attribute eg. `application/json;charset=utf-8`
# 0.2.0-beta.0 - 17 Jan 2023
Feature:
- Support for Async / lazy-load plugin
Improvement:
- Decode URI parameter path parameter
- Handle union type correctly
# 0.1.3 - 12 Jan 2023
Improvement:
- Validate `Response` object
- Union type inference on response
# 0.1.2 - 31 Dec 2022
Bug fix:
- onRequest doesn't run in `group` and `guard`
# 0.1.1 - 28 Dec 2022
Improvement:
- Parse encoded URI on querystring
- Exclude URI fragment from querystring
- Blasphemy hack for updating Elysia server using `--hot`
- Exclude fragment on `getPath`
# 0.1.0 - 24 Dec 2022
[[Reburn](https://youtu.be/xVPDszGmTgg?t=1139)] is the first *stable* beta release for Elysia.
Happy Christmas, wishing you happy tonight as we release the first stable release of Elysia.
With this API is now stabilized, and Elysia will focus on growing its ecosystem and plugins for common patterns.
## Eden
Introducing [Eden](https://elysiajs.com/plugins/eden.html), a fully type-safe client for Elysia server like tRPC.
A 600 bytes client for Elysia server, no code generation need, creating a fully type-safe, and auto-complete for both client and server.
See Eden in action [on Twitter](https://twitter.com/saltyAom/status/1602362204799438848?s=20&t=yqyxaNx_W0MNK9u3wnaK3g)
## The fastest
With a lot effort put into micro-optimization and re-architecture, Elysia is the fastest Bun web framework benchmarked on 24 December 2022, outperformed 2/3 category put into test.
See benchmark results at [Bun http benchmark](https://github.com/SaltyAom/bun-http-framework-benchmark)
## Improved Documentation
Elysia now have an improved documentation at [elysiajs.com](https://elysiajs.com).
Now with a proper landing page, searchable content, and revised content put into.
## Afterward
Merry Christmas, and happy new year.
As 0.1 released, we recommended to give Elysia a try and build stuff with it.
With the wonderful tools, we are happy to looking forward to see what wonderful software will you build.
---
> Fly away, let me fly away
> Never hide in dark
> Head on, start a riot
> Fly away, defying fate in my way
> Crush it
> Make it!
> Feel
> My
> Heart!
# 0.1.0.rc.10 - 21 Dec 2022
Change:
- Remove cjs format as Bun can import ESM from CJS
- Remove comment on build file, rely on .t.ds instead
# 0.1.0.rc.9 - 19 Dec 2022
Change:
- Support plugins which use `getPath`, and `mapQuery` on 0.1.0-rc.6
# 0.1.0.rc.8 - 16 Dec 2022
Improvement:
- Infers type from `group`, and `guard`
Change:
- `Elysia.handle` now only accept valid `URL`
# 0.1.0.rc.7 - 15 Dec 2022
Improvement:
- Minor optimization
- `Router.register` now returns type
- Inline default bodyParser
# 0.1.0.rc.6 - 13 Dec 2022
Fix:
- `.listen` object is now optional
# 0.1.0.rc.5 - 13 Dec 2022
Breaking Change:
- `onError` change its type:
```typescript
// Previously
onError: (error: Error, code: ErrorCode)
// Now
onError: (params: {
error: Error
code: ErrorCode
set: Context['set']
}) => any
```
To migrate, add curly brace to `onError` parameters.
- `onRequest` change its type:
```typescript
// Previously
onRequest: (request: Request, store: Instance['Store']) => any
// Now
onRequest: (params: {
request: Request,
store: Instance['store']
set: Context['set']
})
```
To migrate, add curly brace to `onRequest` parameters.
Feature:
- Manual patch for [bun#1435](https://github.com/oven-sh/bun/issues/1435), and unblock test suite for error handler.
# 0.1.0.rc.4 - 12 Dec 2022
Fix:
- Remove `console.log` for '*'
# 0.1.0.rc.3 - 12 Dec 2022
Feature:
- Strict type for `SCHEMA`
- Infered type parameters for `SCHEMA`
Fix:
- Auto prefix path with `/` for non
- Fallback catch all route for registered parameter
# 0.1.0.rc.2 - 8 Dec 2022
Fix:
- skip body parsing for 'HEAD'
- missing response status on some error
- compatability for cjs
- add main fields for Bundlephobia supports
- add declaration file for both esm and cjs
- ship `src` for TypeScript support with `declare global`
# 0.1.0.rc.1 - 6 Dec 2022
Stabilized API
Feature:
- add header access to context via `context.header`
Breaking Change:
- rename `schema.header` to `schema.headers`
# 0.0.0-experimental.55 - 1 Dec 2022
Bug fix:
- `inject` now accept `Context`
# 0.0.0-experimental.54 - 1 Dec 2022
Feature:
- `derive` to creating derive state
- `inject` to decorate method based on context
# 0.0.0-experimental.53 - 24 Nov 2022
Feature:
- `.all` for registering path with any method
Improvement:
- `getSchemaValidator` now infer output type to be reusable with `@kingworldjs/trpc`
Bug fix:
- `handler.hooks` is undefined on 404
# 0.0.0-experimental.52 - 23 Nov 2022
Improvement:
- Decorators is now lazily allocate
- `.serve` now accept numberic string as port for convenient with `process.env`
# 0.0.0-experimental.51 - 22 Nov 2022
[[Just Right Slow]](https://youtu.be/z7nN7ryqU28) introduce breaking major changes of KingWorld, specific on a plugin system.
Previously, we define plugin by accepting 2 parameters, `KingWorld` and `Config` like this:
```typescript
const plugin = (app: KingWorld, config) => app
new KingWorld().use(plugin, {
// Provide some config here
})
```
However, this has flaw by the design because:
- No support for async plugin
- No generic for type inference
- Not possible to accept 3...n parameters (if need)
- Hard/heavy work to get type inference
To fix all of the problem above, KingWorld now accept only one parameter.
A callback which return KingWorld Instance, but accept anything before that.
```typescript
const plugin = (config) => (app: KingWorld) => app
new KingWorld().use(plugin({
// provide some config here
}))
```
This is a workaround just like the way to register async plugin before exp.51, we accept any parameters in a function which return callback of a KingWorld instance.
This open a new possibility, plugin can now be async, generic type is now possible.
More over that, decorate can now accept any parameters as it doesn't really affect any performance or any real restriction.
Which means that something like this is now possible.
```typescript
const a = <Name extends string = string>(name: Name) => (app: KingWorld) => app.decorate(name, {
hi: () => 'hi'
})
new KingWorld()
.use(a('customName'))
// Retrieve generic from plugin, not possible before exp.51
.get({ customName } => customName.hi())
```
This lead to even more safe with type safety, as you can now use any generic as you would like.
The first plugin to leverage this feature is [jwt](https://github.com/saltyaom/kingworld-jwt) which can introduce jwt function with custom namespace which is type safe.
Change:
- new `decorators` property for assigning fast `Context`
# 0.0.0-experimental.50 - 21 Nov 2022
Improvement:
- Faster router.find performance
- Faster query map performance
- Early return on not found
- Better type for `router`
Change:
- Remove `storeFactory` from router
# 0.0.0-experimental.49 - 19 Nov 2022
Bug fix:
- Conditionally return header in response
# 0.0.0-experimental.48 - 18 Nov 2022
Bug fix:
- Import Context as non-default
- TypeScript's type not infering Context
# 0.0.0-experimental.47 - 18 Nov 2022
Bug fix:
- Remove `export default Context` as it's a type
- Import Context as non-default
# 0.0.0-experimental.46 - 18 Nov 2022
Bug fix:
- Add custom response to `Blob`
# 0.0.0-experimental.45 - 18 Nov 2022
Bug fix:
- Set default HTTP status to 200 (https://github.com/oven-sh/bun/issues/1523)
# 0.0.0-experimental.44 - 18 Nov 2022
Improvement:
- Faster object iteration for setting headers
- `KingWorld` config now accept `Serve` including `SSL`
Change:
- Use direct comparison for falsey value
# 0.0.0-experimental.42 - 13 Nov 2022
Bug fix:
- Router doesn't handle part which start with the same letter
# 0.0.0-experimental.41 - 9 Nov 2022
Change:
- Internal schema now use correct OpenAPI type (KingWorld need CORRECTION 💢💢)
# 0.0.0-experimental.40 - 9 Nov 2022
Breaking Change:
- `Context` is now `interface` (non-constructable)
- `responseHeaders`, `status`, `redirect` is now replaced with `set`
- To migrate:
```typescript
// From
app.get('/', ({ responseHeaders, status, redirect }) => {
responseHeaders['server'] = 'KingWorld'
status(401)
redirect('/')
})
// To
app.get('/', ({ set }) => {
set.headers['server'] = 'KingWorld'
set.status = 401
set.redirect = '/'
})
```
Improvement:
- Global `.schema` now infer type for handler
- Add JSDocs for main method with example
- `.listen` now accept `Bun.Server` as a callback function
- Response support for `FileBlob`
# 0.0.0-experimental.39 - 8 Nov 2022
Breaking Change:
- `method` is changed to `route`
Improvement:
- `LocalHook` now prefers the nearest type instead of the merge
- Merge the nearest schema first
- add `contentType` as a second parameter for `BodyParser`
Bug fix:
- Correct type for `after handle`
- Fix infinite cycling infer type for `Handler`
# 0.0.0-experimental.38 - 7 Nov 2022
Bug fix:
- Correct type for `afterHandle`
# 0.0.0-experimental.37 - 6 Nov 2022
[[Sage]](https://youtu.be/rgM5VGYToQQ) is one of the major experimental releases and breaking changes of KingWorld.
The major improvement of Sage is that it provides almost (if not) full support for TypeScript and type inference.
## Type Inference
KingWorld has a complex type of system. It's built with the DRY principle in mind, to reduce the developer's workload.
That's why KingWorld tries to type everything at its best, inferring type from your code into TypeScript's type.
For example, writing schema with nested `guard` is instructed with type and validation.
This ensures that your type will always be valid no matter what, and inferring type to your IDE automatically.

You can even type `response` to make your that you didn't leak any important data by forgetting to update the response when you're doing a migration.
## Validator
KingWorld's validator now replaced `zod`, and `ajv` with `@sinclair/typebox`.
With the new validator, validation is now faster than the previous version by 188x if you're using zod, and 4.1x if you're using ajv adapter.
With Edge Computing in mind, refactoring to new validate dropped the unused packages and reduced size by 181.2KB.
To give you an idea, KingWorld without a validator is around 10KB (non-gzipped).
Memory usage is also reduced by almost half by changing the validator.
###### According to M1 Max running `example/simple.ts`, running exp.36 uses 24MB of memory while exp.37 use 12MB of memory
This greatly improves the performance of KingWorld in a long run.
## Changelog
Breaking Change:
- Replace `zod`, `zod-to-json-schema`, `ajv`, with `@sinclair/typebox`
Improvement:
- `use` now accept any non `KingWorld<{}, any>`
- `use` now combine typed between current instance and plugin
- `use` now auto infer type if function is inline
- `LocalHook` can now infer `params` type from path string
Change:
- `TypedSchema` is now replaced with `Instance['schema']`
# 0.0.0-experimental.36 - 4 Nov 2022
Breaking Change:
- `AfterRequestHandle` now accept (`Context`, `Response`) instead of `(Response, Context)`
Improvement:
- `.guard` now combine global and local recursively
- `.use` now inherits schema
# 0.0.0-experimental.35 - 3 Nov 2022
Bug fix:
- Remove `console.log` on failed validation
# 0.0.0-experimental.34 - 3 Nov 2022
Improvement:
- Add Ajv 8.11.0
- Error log for validation is updated to `instancePath`
# 0.0.0-experimental.33 - 3 Nov 2022
Feature:
- `.schema` for global schema validation
- `.start`, `.stop` and accept `KingWorld<Instance>` as first parameter
Improvement:
- `.guard` now auto infer type from schema to `Handler`
- scoped `.guard` now inherits hook
- `NewInstance` now inherits `InheritSchema`
Bug fix:
- Rename `afterHandle` to `onAfterHandle` to match naming convention
- Make `afterHandle` in `RegisterHook` optional
- Internal type conversion between `Hook`, `LocalHook`
# 0.0.0-experimental.32 - 2 Nov 2022
Feature:
- add `afterHandle` hook
Improvement:
- Using `WithArray<T>` to reduce redundant type
Bug fix:
- `beforeHandle` hook doesn't accept array
# 0.0.0-experimental.31 - 2 Nov 2022
Bug fix:
- Add `zod` by default
# 0.0.0-experimental.30 - 2 Nov 2022
Bug fix:
- Add `zod-to-json-schema` by default
# 0.0.0-experimental.29 - 2 Nov 2022
[Regulus]
This version introduces rework for internal architecture. Refine, and unify the structure of how KingWorld works internally.
Although many refactoring might require, I can assure you that this is for the greater good, as the API refinement lay down a solid structure for the future of KingWorld.
Thanks to API refinement, this version also introduced a lot of new interesting features, and many APIs simplified.
Notable improvements and new features:
- Define Schema, auto-infer type, and validation
- Simplifying Handler's generic
- Unifying Life Cycle into one property
- Custom Error handler, and body-parser
- Before start/stop and clean up effect
# 0.0.0-experimental.28 - 30 Oct 2022
Happy halloween.
This version named [GHOST FOOD] is one of the big improvement for KingWorld, I have been working on lately.
It has a lot of feature change for better performance, and introduce lots of deprecation.
Be sure to follow the migration section in `Breaking Change`.
Feature:
- Auto infer type from `plugin` after merging with `use`
- `decorate` to extends `Context` method
- add `addParser`, for custom handler for parsing body
Breaking Change:
- Moved `store` into `context.store`
- To migrate:
```typescript
// From
app.get(({}, store) => store.a)
// To
app.get(({ store }) => store.a)
```
- `ref`, and `refFn` is now removed
- Remove `Plugin` type, simplified Plugin type declaration
- To migrate:
```typescript
// From
import type { Plugin } from 'kingworld'
const a: Plugin = (app) => app
// To
import type { KingWorld } from 'kingworld'
const a = (app: KingWorld) => app
```
- Migrate `Header` to `Record<string, unknown>`
- To migrate:
```typescript
app.get("/", ({ responseHeader }) => {
// From
responseHeader.append('X-Powered-By', 'KingWorld')
// To
responseHeader['X-Powered-By', 'KingWorld']
return "KingWorld"
})
```
Change:
- Store is now globally mutable
Improvement:
- Faster header initialization
- Faster hook initialization
# 0.0.0-experimental.27 - 23 Sep 2022
Feature:
- Add `config.strictPath` for handling strict path
# 0.0.0-experimental.26 - 10 Sep 2022
Improvement:
- Improve `clone` performance
- Inline `ref` value
- Using object to store internal route
Bug fix:
- 404 on absolute path
# 0.0.0-experimental.25 - 9 Sep 2022
Feature:
- Auto infer typed for `params`, `state`, `ref`
- `onRequest` now accept async function
- `refFn` syntax sugar for adding fn as reference instead of `() => () => value`
Improvement:
- Switch from `@saltyaom/trek-router` to `@medley/router`
- Using `clone` instead of flatten object
- Refactor path fn for inline cache
- Refactor `Context` to class
Bug fix:
- `.ref()` throw error when accept function
# 0.0.0-experimental.24 - 21 Aug 2022
Change:
- optimized for `await`
# 0.0.0-experimental.23 - 21 Aug 2022
Feature:
- Initialial config is now available, starting with `bodyLimit` config for limiting body size
Breaking Change:
- `ctx.body` is now a literal value instead of `Promise`
- To migrate, simply remove `await`
Change:
- `default` now accept `Handler` instead of `EmptyHandler`
Bug fix:
- Default Error response now return `responseHeaders`
- Possibly fixed parsing body error benchmark
# 0.0.0-experimental.22 - 19 Aug 2022
Breaking Change:
- context.body is now deprecated, use request.text() or request.json() instead
Improvement:
- Using reference header to increase json response speed
- Remove `body` getter, setter
Change:
- Using `instanceof` to early return `Response`
# 0.0.0-experimental.21 - 14 Aug 2022
Breaking Change:
- `context.headers` now return `Header` instead of `Record<string, string>`
Feature:
- Add status function to `Context`
- `handle` now accept `number | Serve`
- Remove `querystring` to support native Cloudflare Worker
- Using raw headers check to parse `body` type
# 0.0.0-experimental.20 - 13 Aug 2022
Feature:
- Handle error as response
# 0.0.0-experimental.19 - 13 Aug 2022
Change:
- Use Array Spread instead of concat as it's faster by 475%
- Update to @saltyaom/trek-router 0.0.7 as it's faster by 10%
- Use array.length instead of array[0] as it's faster by 4%
# 0.0.0-experimental.18 - 8 Aug 2022
Change:
- With lazy initialization, KingWorld is faster by 15% (tested on 14' M1 Max)
- Micro optimization
- Remove `set` from headers
# 0.0.0-experimental.17 - 15 Jul 2022
Change:
- Remove dependencies: `fluent-json-schema`, `fluent-schema-validator`
- Update `@saltyaom/trek-router` to `0.0.2`
# 0.0.0-experimental.16 - 15 Jul 2022
Breaking Change:
- Move `hook.schema` to separate plugin, [@kingworldjs/schema](https://github.com/saltyaom/kingworld-schema)
- To migrate, simply move all `hook.schema` to `preHandler` instead
Change:
- Rename type `ParsedRequest` to `Context`
- Exposed `#addHandler` to `_addHandler`
# 0.0.0-experimental.15 - 14 Jul 2022
Breaking Change:
- Rename `context.responseHeader` to `context.responseHeaders`
- Change type of `responseHeaders` to `Header` instead of `Record<string, string>`
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Maintaners are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Mainteiners have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the maintainers. All complaints will be reviewed and investigated promptly and fairly.
All maintainers are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from maintainers, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at <https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
================================================
FILE: CONTRIBUTING.md
================================================
# Welcome to Elysia contributing guide
Thank you for investing your time in contributing to Elysia! Any contribution you make will be amazing :sparkles:.
Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
## Setup Local Development Environment
Elysia test cases are using [bun](https://bun.sh). Make sure you have the [latest version of bun](https://github.com/oven-sh/bun/releases) installed in your system.
To run Elysia locally:
1. Clone this repository
2. run `bun install` in project's root
3. Run development with `bun run dev`
### Unit Testing
All of the test files are located inside the [`test/`](test/) directory. Unit testing are powered by [bun's test](https://github.com/oven-sh/bun/tree/main/packages/bun-internal-test).
- `bun test` to run all the test inside the [`test/`](test/) directory
- `bun test test/<test-file>.ts` to run a specific test
## Pull Request Guidelines
Recommended to use `main` branch as a base to work on.
#### General Recommendation
- Please kindly verify that you have run test suite before request a review from maintainers with `bun run test`
- We do not condone the usage of any form of plagiarism or copying code without proper attribution.
- We do not tolerate disrespectful or inappropriate behavior within the community.
- AI generated pull request without human interaction, review and supervision may result in close without further notice or ban from future contribution to Elysia.
#### Adding New Features
- Provide a reason why you would like to add this feature. Ideally before creating a PR, create a new issue with, explain the reason, tag as `feature request` and tag maintainer eg. "saltyaom"
- It's recommended to add test cases to cover core feature of the feature you intent to add
#### Fixing Bug
- When opening an pull request fixing existing issue, please kindly include the issue link or id in the description
- Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.
- It's OK to have multiple small commits as you work on the PR. GitHub can automatically squash them before merging.
## Thanks :purple_heart:
Thanks for all your contributions and efforts towards improving Elysia. We thank you for being part of our community :sparkles:!
================================================
FILE: LICENSE
================================================
Copyright 2022 saltyAom
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
<p align=center>
<img src=https://github.com/user-attachments/assets/8168188b-ffaf-444f-8d09-c516ce140824 alt="Elysia Banner" />
</p>
<h3 align=center>Elysia</h3>
<p align=center>Ergonomic Framework for Humans</p>
<p align=center>
<a href=https://elysiajs.com>Documentation</a> | <a href=https://discord.gg/eaFJ2KDJck>Discord</a> | <a href=https://github.com/sponsors/SaltyAom>Sponsors</a>
</p>
<br>
<p align=center>TypeScript with End-to-End Type Safety, type integrity, and exceptional developer experience. Supercharged by Bun.</p>
<br>

<!---
```bash
bun create elysia app
```

## Documentation
The documentation is available on [elysiajs.com](https://elysiajs.com).
## Contributing
See [Contributing Guide](CONTRIBUTING.md) and please follow our [Code of Conduct](CODE_OF_CONDUCT.md).
## Discord
Come join the [Discord community channel~](https://discord.gg/eaFJ2KDJck)
--->
================================================
FILE: build.ts
================================================
import { $ } from 'bun'
import { build } from 'tsup'
import { fixImportsPlugin } from 'esbuild-fix-imports-plugin'
import pack from './package.json'
if ('elysia' in pack.dependencies)
throw new Error("Error can't be a dependency of itself")
await $`rm -rf dist`
await build({
entry: ['src/**/*.ts'],
outDir: 'dist',
format: ['esm', 'cjs'],
target: 'node20',
minifySyntax: true,
minifyWhitespace: false,
minifyIdentifiers: false,
splitting: false,
sourcemap: false,
cjsInterop: false,
clean: true,
bundle: false,
external: ['@sinclair/typebox', 'file-type'],
esbuildPlugins: [fixImportsPlugin()]
})
await $`tsc --project tsconfig.dts.json`
process.exit()
================================================
FILE: example/a.ts
================================================
import { Elysia, t } from '../src'
import { req } from '../test/utils'
const app = new Elysia()
.get('/', async () => {
const file = Bun.file('test/kyuukurarin.mp4')
// Wrap the stream in another ReadableStream
// perhaps we are concatenating streams or whatever
const body = new ReadableStream({
async start(controller) {
const reader = file.stream().getReader()
try {
while (true) {
const { done, value } = await reader.read()
if (done) break
controller.enqueue(value)
}
controller.close()
} catch (err) {
controller.error(err)
} finally {
reader.releaseLock()
}
}
})
// Returning the stream uses 100% for several minutes
return body
// Returning the same stream wrapped in a Response servers the stream in a fraction of a second
// return new Response(body);
})
.listen(3000)
================================================
FILE: example/async-recursive.ts
================================================
import { Elysia } from '../src'
import { req } from '../test/utils'
const delay = <T extends (...args: any) => any>(
callback: T,
ms = 617
): Promise<ReturnType<T>> => Bun.sleep(ms).then(callback)
const yay = () => delay(() => new Elysia().use(import('./lazy')))
const yay2 = () => delay(() => new Elysia().use(yay), 5)
const yay3 = () => delay(() => new Elysia().use(yay2), 10)
const wrapper = new Elysia().use(async () => delay(() => yay3(), 6))
const app = new Elysia().use(wrapper)
await app.modules
// should works
app.handle(req('/lazy'))
.then((x) => x.text())
.then(console.log)
================================================
FILE: example/body.ts
================================================
import { Elysia, t } from '../src'
const app = new Elysia()
// Add custom body parser
.onParse(async ({ request, contentType }) => {
switch (contentType) {
case 'application/Elysia':
return request.text()
}
})
.post('/', ({ body: { username } }) => `Hi ${username}`, {
body: t.Object({
id: t.Number(),
username: t.String()
})
})
// Increase id by 1 from body before main handler
.post('/transform', ({ body }) => body, {
transform: ({ body }) => {
body.id = body.id + 1
},
body: t.Object({
id: t.Number(),
username: t.String()
}),
detail: {
summary: 'A'
}
})
.post('/mirror', ({ body }) => body)
.listen(3000)
console.log('🦊 Elysia is running at :8080')
================================================
FILE: example/cookie.ts
================================================
import { Elysia, t } from '../src'
const app = new Elysia({
cookie: {
secrets: 'Fischl von Luftschloss Narfidort',
sign: 'name'
}
})
.get(
'/council',
({ cookie: { council } }) =>
(council.value = [
{
name: 'Rin',
affilation: 'Administration'
}
]),
{
cookie: t.Cookie({
council: t.Array(
t.Object({
name: t.String(),
affilation: t.String()
})
)
})
}
)
.get('/create', ({ cookie: { name } }) => (name.value = 'Himari'))
.get(
'/update',
({ cookie: { name } }) => {
name.value = 'seminar: Rio'
name.value = 'seminar: Himari'
name.maxAge = 86400
return name.value
},
{
cookie: t.Cookie({
name: t.Optional(t.String())
})
}
)
.listen(3000)
================================================
FILE: example/counter.ts
================================================
import { Elysia } from '../src'
new Elysia()
.state('counter', 0)
.get('/', ({ store }) => store.counter++)
.listen(3000)
================================================
FILE: example/custom-response.ts
================================================
import { Elysia } from '../src'
const prettyJson = new Elysia()
.mapResponse(({ response }) => {
if (response instanceof Object)
return new Response(JSON.stringify(response, null, 4))
})
.as('scoped')
new Elysia()
.use(prettyJson)
.get('/', () => ({
hello: 'world'
}))
.listen(3000)
================================================
FILE: example/derive.ts
================================================
import { Elysia } from '../src'
new Elysia()
.state('counter', 0)
.derive(({ store }) => ({
increase() {
store.counter++
}
}))
.derive(({ store }) => ({
store: {
doubled: store.counter * 2,
tripled: store.counter * 3
}
}))
.get('/', ({ increase, store }) => {
increase()
const { counter, doubled, tripled } = store
return {
counter,
doubled,
tripled
}
})
.listen(3000, ({ hostname, port }) => {
console.log(`🦊 running at http://${hostname}:${port}`)
})
================================================
FILE: example/error.ts
================================================
import { Elysia, t } from '../src'
new Elysia()
.post('/', ({ body }) => body, {
body: t.Object({
username: t.String(),
password: t.String(),
nested: t.Optional(
t.Object({
hi: t.String()
})
)
}),
error({ error }) {
console.log(error)
}
})
.listen(3000)
================================================
FILE: example/extension.ts
================================================
import { Elysia, t } from '../src'
const a0 = new Elysia().get('/a0', () => 'a')
const a1 = new Elysia().get('/a1', () => 'a')
const a2 = new Elysia().get('/a2', () => 'a')
const a3 = new Elysia().get('/a3', () => 'a')
const a4 = new Elysia().get('/a4', () => 'a')
const a5 = new Elysia().get('/a5', () => 'a')
const a6 = new Elysia().get('/a6', () => 'a')
const a7 = new Elysia().get('/a7', () => 'a')
const a8 = new Elysia().get('/a8', () => 'a')
const a9 = new Elysia().get('/a9', () => 'a')
const a10 = new Elysia().get('/a10', () => 'a')
const a11 = new Elysia().get('/a11', () => 'a')
const a12 = new Elysia().get('/a12', () => 'a')
const a13 = new Elysia().get('/a13', () => 'a')
const a14 = new Elysia().get('/a14', () => 'a')
const a15 = new Elysia().get('/a15', () => 'a')
const a16 = new Elysia().get('/a16', () => 'a')
const a17 = new Elysia().get('/a17', () => 'a')
const a18 = new Elysia().get('/a18', () => 'a')
const a19 = new Elysia().get('/a19', () => 'a')
const a20 = new Elysia().get('/a20', () => 'a')
const a21 = new Elysia().get('/a21', () => 'a')
const a22 = new Elysia().get('/a22', () => 'a')
const a23 = new Elysia().get('/a23', () => 'a')
const a24 = new Elysia().get('/a24', () => 'a')
const a25 = new Elysia().get('/a25', () => 'a')
const a26 = new Elysia().get('/a26', () => 'a')
const a27 = new Elysia().get('/a27', () => 'a')
const a28 = new Elysia().get('/a28', () => 'a')
const a29 = new Elysia().get('/a29', () => 'a')
const a30 = new Elysia().get('/a30', () => 'a')
const a31 = new Elysia().get('/a31', () => 'a')
const a32 = new Elysia().get('/a32', () => 'a')
const a33 = new Elysia().get('/a33', () => 'a')
const a34 = new Elysia().get('/a34', () => 'a')
const a35 = new Elysia().get('/a35', () => 'a')
const a36 = new Elysia().get('/a36', () => 'a')
const a37 = new Elysia().get('/a37', () => 'a')
const a38 = new Elysia().get('/a38', () => 'a')
const a39 = new Elysia().get('/a39', () => 'a')
const a40 = new Elysia().get('/a40', () => 'a')
const a41 = new Elysia().get('/a41', () => 'a')
const a42 = new Elysia().get('/a42', () => 'a')
const a43 = new Elysia().get('/a43', () => 'a')
const a44 = new Elysia().get('/a44', () => 'a')
const a45 = new Elysia().get('/a45', () => 'a')
const a46 = new Elysia().get('/a46', () => 'a')
const a47 = new Elysia().get('/a47', () => 'a')
const a48 = new Elysia().get('/a48', () => 'a')
const a49 = new Elysia().get('/a49', () => 'a')
const a50 = new Elysia().get('/a50', () => 'a')
const a51 = new Elysia().get('/a51', () => 'a')
const a52 = new Elysia().get('/a52', () => 'a')
const a53 = new Elysia().get('/a53', () => 'a')
const a54 = new Elysia().get('/a54', () => 'a')
const a55 = new Elysia().get('/a55', () => 'a')
const a56 = new Elysia().get('/a56', () => 'a')
const a57 = new Elysia().get('/a57', () => 'a')
const a58 = new Elysia().get('/a58', () => 'a')
const a59 = new Elysia().get('/a59', () => 'a')
const a60 = new Elysia().get('/a60', () => 'a')
const a61 = new Elysia().get('/a61', () => 'a')
const a62 = new Elysia().get('/a62', () => 'a')
const a63 = new Elysia().get('/a63', () => 'a')
const a64 = new Elysia().get('/a64', () => 'a')
const a65 = new Elysia().get('/a65', () => 'a')
const a66 = new Elysia().get('/a66', () => 'a')
const a67 = new Elysia().get('/a67', () => 'a')
const a68 = new Elysia().get('/a68', () => 'a')
const a69 = new Elysia().get('/a69', () => 'a')
const a70 = new Elysia().get('/a70', () => 'a')
const a71 = new Elysia().get('/a71', () => 'a')
const a72 = new Elysia().get('/a72', () => 'a')
const a73 = new Elysia().get('/a73', () => 'a')
const a74 = new Elysia().get('/a74', () => 'a')
const a75 = new Elysia().get('/a75', () => 'a')
const a76 = new Elysia().get('/a76', () => 'a')
const a77 = new Elysia().get('/a77', () => 'a')
const a78 = new Elysia().get('/a78', () => 'a')
const a79 = new Elysia().get('/a79', () => 'a')
const a80 = new Elysia().get('/a80', () => 'a')
const a81 = new Elysia().get('/a81', () => 'a')
const a82 = new Elysia().get('/a82', () => 'a')
const a83 = new Elysia().get('/a83', () => 'a')
const a84 = new Elysia().get('/a84', () => 'a')
const a85 = new Elysia().get('/a85', () => 'a')
const a86 = new Elysia().get('/a86', () => 'a')
const a87 = new Elysia().get('/a87', () => 'a')
const a88 = new Elysia().get('/a88', () => 'a')
const a89 = new Elysia().get('/a89', () => 'a')
const a90 = new Elysia().get('/a90', () => 'a')
const a91 = new Elysia().get('/a91', () => 'a')
const a92 = new Elysia().get('/a92', () => 'a')
const a93 = new Elysia().get('/a93', () => 'a')
const a94 = new Elysia().get('/a94', () => 'a')
const a95 = new Elysia().get('/a95', () => 'a')
const a96 = new Elysia().get('/a96', () => 'a')
const a97 = new Elysia().get('/a97', () => 'a')
const a98 = new Elysia().get('/a98', () => 'a')
const a99 = new Elysia().get('/a99', () => 'a')
const app1 = new Elysia()
.use(a0)
.use(a1)
.use(a2)
.use(a3)
.use(a4)
.use(a5)
.use(a6)
.use(a7)
.use(a8)
.use(a9)
.use(a10)
.use(a11)
.use(a12)
.use(a13)
.use(a14)
.use(a15)
.use(a16)
.use(a17)
.use(a18)
.use(a19)
.use(a20)
.use(a21)
.use(a22)
.use(a23)
.use(a24)
.use(a25)
.use(a26)
.use(a27)
.use(a28)
.use(a29)
.use(a30)
.use(a31)
.use(a32)
.use(a33)
.use(a34)
.use(a35)
.use(a36)
.use(a37)
.use(a38)
.use(a39)
.use(a40)
const app2 = new Elysia()
.use(a41)
.use(a42)
.use(a43)
.use(a44)
.use(a45)
.use(a46)
.use(a47)
.use(a48)
.use(a49)
.use(a50)
.use(a51)
.use(a52)
.use(a53)
.use(a54)
.use(a55)
.use(a56)
.use(a57)
.use(a58)
.use(a59)
.use(a60)
.use(a61)
.use(a62)
.use(a63)
.use(a64)
.use(a65)
.use(a66)
.use(a67)
.use(a68)
.use(a69)
.use(a70)
.use(a71)
.use(a72)
.use(a73)
.use(a74)
.use(a75)
.use(a76)
.use(a77)
.use(a78)
.use(a79)
const app3 = new Elysia()
.use(a80)
.use(a81)
.use(a82)
.use(a83)
.use(a84)
.use(a85)
.use(a86)
.use(a87)
.use(a88)
.use(a89)
.use(a90)
.use(a91)
.use(a92)
.use(a93)
.use(a94)
.use(a95)
.use(a96)
.use(a97)
.use(a98)
.use(a99)
const main = new Elysia().use(app1).use(app2).use(app3)
================================================
FILE: example/file.ts
================================================
import { Elysia, file } from '../src'
import Page from './index.html'
/**
* Example of handle single static file
*
* @see https://github.com/elysiajs/elysia-static
*/
new Elysia()
.headers({
server: 'Elysia'
})
.onRequest(({ request }) => {
console.log(request.method, request.url)
})
.get('/', Page)
.get('/tako', file('./example/takodachi.png'))
.get('/mika.mp4', Bun.file('test/kyuukurarin.mp4'))
.listen(3000)
================================================
FILE: example/guard.ts
================================================
import { Elysia, t } from '../src'
new Elysia()
.state('name', 'salt')
.get('/', ({ store: { name } }) => `Hi ${name}`, {
query: t.Object({
name: t.String()
})
})
// If query 'name' is not preset, skip the whole handler
.guard(
{
query: t.Object({
name: t.String()
})
},
(app) =>
app
// Query type is inherited from guard
.get('/profile', ({ query }) => `Hi`)
// Store is inherited
.post('/name', ({ store: { name }, body, query }) => name, {
body: t.Object({
id: t.Number({
minimum: 5
}),
username: t.String(),
profile: t.Object({
name: t.String()
})
})
})
)
.listen(3000)
================================================
FILE: example/headers.ts
================================================
import { Elysia } from '../src'
import cookie from '../src/index'
new Elysia()
.get('/', ({ set }) => {
set.headers['x-powered-by'] = 'Elysia'
set.status = 'Bad Request'
})
.listen(3000)
================================================
FILE: example/hook.ts
================================================
import { Elysia } from '../src'
new Elysia()
// Create global mutable state
.state('counter', 0)
// Increase counter by 1 on every request on any handler
.onTransform(({ store }) => {
store.counter++
})
.get('/', ({ store: { counter } }) => counter, {
// Increase counter only when this handler is called
transform: [
({ store }) => {
store.counter++
},
({ store }) => {
store.counter++
}
]
})
.listen(3000)
================================================
FILE: example/html-import.ts
================================================
import { Elysia, t } from '../src'
import Page from './index.html'
new Elysia()
.get('/', Page)
.get('/mika.mp4', Bun.file('test/kyuukurarin.mp4'))
.listen(3000)
================================================
FILE: example/http.ts
================================================
import { Elysia, t } from '../src'
const t1 = performance.now()
const loggerPlugin = new Elysia()
.get('/hi', () => 'Hi')
.decorate('log', () => 'A')
.decorate('date', () => new Date())
.state('fromPlugin', 'From Logger')
.use((app) => app.state('abc', 'abc'))
const app = new Elysia()
.onRequest(({ set }) => {
set.headers = {
'Access-Control-Allow-Origin': '*'
}
})
.use(loggerPlugin)
.state('build', Date.now())
.get('/', () => 'Elysia')
.get('/tako', () => Bun.file('./example/takodachi.png'))
.get('/json', () => ({
hi: 'world'
}))
.get('/root/plugin/log', ({ log, store: { build } }) => {
log()
return build
})
.get('/wildcard/*', () => 'Hi Wildcard')
.get('/query', () => 'Elysia', {
beforeHandle: ({ query }) => {
console.log('Name:', query?.name)
if (query?.name === 'aom') return 'Hi saltyaom'
},
query: t.Object({
name: t.String()
})
})
.post('/json', async ({ body }) => body, {
body: t.Object({
name: t.String(),
additional: t.String()
})
})
.post('/transform-body', async ({ body }) => body, {
beforeHandle: (ctx) => {
ctx.body = {
...ctx.body,
additional: 'Elysia'
}
},
body: t.Object({
name: t.String(),
additional: t.String()
})
})
.get('/id/:id', ({ params: { id } }) => id, {
transform({ params }) {
params.id = +params.id
},
params: t.Object({
id: t.Number()
})
})
.post('/new/:id', async ({ body, params }) => body, {
params: t.Object({
id: t.Number()
}),
body: t.Object({
username: t.String()
})
})
.get('/trailing-slash', () => 'A')
.group('/group', (app) =>
app
.onBeforeHandle<{
query: {
name: string
}
}>(({ query }) => {
if (query?.name === 'aom') return 'Hi saltyaom'
})
.get('/', () => 'From Group')
.get('/hi', () => 'HI GROUP')
.get('/elysia', () => 'Welcome to Elysian Realm')
.get('/fbk', () => 'FuBuKing')
)
.get('/response-header', ({ set }) => {
set.status = 404
set.headers['a'] = 'b'
return 'A'
})
.get('/this/is/my/deep/nested/root', () => 'Hi')
.get('/build', ({ store: { build } }) => build)
.get('/ref', ({ date }) => date())
.get('/response', () => new Response('Hi'))
.get('/error', () => new Error('Something went wrong'))
.get('/401', ({ set }) => {
set.status = 401
return 'Status should be 401'
})
.get('/timeout', async () => {
await new Promise((resolve) => setTimeout(resolve, 2000))
return 'A'
})
.all('/all', () => 'hi')
.onError(({ code, error, set }) => {
if (code === 'NOT_FOUND') {
set.status = 404
return 'Not Found :('
}
})
const t2 = performance.now()
app.listen(8080, ({ hostname, port }) => {
console.log(`🦊 Elysia is running at http://${hostname}:${port}`)
})
console.log('took', t2 - t1, 'ms')
================================================
FILE: example/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<title>Bun HTML Import</title>
</head>
<body>
<h1>Hi</h1>
<video>
<!-- <source src="/mika.mp4" type="video/mp4" /> -->
</video>
</body>
</html>
================================================
FILE: example/lazy/index.ts
================================================
import Elysia from '../../src'
export const lazy = (app: Elysia) =>
app.state('a', 'b').get('/lazy', 'Hi from lazy loaded module')
export default lazy
================================================
FILE: example/lazy-module.ts
================================================
import { Elysia } from '../src'
const plugin = (app: Elysia) => app.get('/plugin', () => 'Plugin')
const asyncPlugin = async (app: Elysia) => app.get('/async', () => 'A')
const app = new Elysia()
.decorate('a', () => 'hello')
.use(plugin)
.use(import('./lazy'))
.use((app) => app.get('/inline', ({ store: { a } }) => 'inline'))
.get('/', ({ a }) => a())
.listen(3000)
await app.modules
console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
)
================================================
FILE: example/native.ts
================================================
Bun.serve({
port: 3000,
fetch: (request) => {
throw new Error('A')
},
error(request) {
return new Response('error')
}
})
================================================
FILE: example/nested-multipart-files.ts
================================================
import { Elysia, t } from '../src'
/**
* Example: Nested File Uploads with Multipart Forms
*
* Elysia supports nested file uploads using dot notation in multipart forms.
* This allows you to organize files and data in a nested structure while
* still using standard multipart/form-data encoding.
*
* How it works:
* 1. Client sends files with dot notation keys (e.g., "user.avatar")
* 2. Elysia automatically reconstructs the nested object structure
* 3. Your handler receives a properly nested object
*/
const app = new Elysia()
// Basic nested file upload
.post(
'/user/profile',
({ body }) => ({
message: 'Profile created!',
user: {
name: body.user.name,
avatarSize: body.user.avatar.size
}
}),
{
body: t.Object({
user: t.Object({
name: t.String(),
avatar: t.File()
})
})
}
)
// Deeply nested files
.post(
'/user/portfolio',
({ body }) => ({
bio: body.user.profile.bio,
photoCount: body.user.profile.photos.length
}),
{
body: t.Object({
user: t.Object({
profile: t.Object({
bio: t.String(),
photos: t.Files()
})
})
})
}
)
// Mixed flat and nested fields
.post(
'/post',
({ body }) => ({
title: body.title,
authorName: body.author.name,
imageSize: body.author.avatar.size
}),
{
body: t.Object({
title: t.String(),
author: t.Object({
name: t.String(),
avatar: t.File()
})
})
}
)
.listen(3000)
console.log(`🦊 Server running at http://${app.server?.hostname}:${app.server?.port}`)
/**
* Client-side usage (with fetch):
*
* const formData = new FormData()
* formData.append('user.name', 'John')
* formData.append('user.avatar', fileBlob)
*
* await fetch('http://localhost:3000/user/profile', {
* method: 'POST',
* body: formData
* })
*
*
* Eden client usage (future):
*
* await client.user.profile.post({
* user: {
* name: 'John',
* avatar: fileBlob // Eden will flatten this automatically
* }
* })
*/
================================================
FILE: example/nested-schema.ts
================================================
import { Elysia, t } from '../src'
new Elysia()
.guard(
{
query: t.Object({
name: t.String()
})
},
(app) =>
app
.get('/', ({ query }) => 'A', {
beforeHandle: ({ query }) => {},
query: t.Object({
a: t.String()
})
})
.guard(
{
headers: t.Object({
a: t.String()
})
},
(app) =>
app.get('/a', () => 'A', {
beforeHandle: ({ query }) => {},
body: t.Object({
username: t.String()
})
})
)
)
.get('*', () => 'Star now work')
.listen(3000)
================================================
FILE: example/newFile.ts
================================================
================================================
FILE: example/openapi.ts
================================================
import { Elysia, t } from '../src'
import { openapi as OpenAPI } from '@elysiajs/openapi'
import { fromTypes } from '@elysiajs/openapi/gen'
const openapi = (a: any) =>
new Elysia().use((app) => {
app.use(
// @ts-ignore
OpenAPI(a)
)
return app
})
// Elysia 1.4: lifecycle event type soundness
export const app = new Elysia()
.use(
openapi({
references: fromTypes('example/openapi.ts')
})
)
.macro({
auth: {
response: {
409: t.Literal('Conflict')
},
beforeHandle({ status }) {
if (Math.random() < 0.05) return status(410)
},
resolve: () => ({ a: 'a' })
}
})
.onError(({ status }) => {
if (Math.random() < 0.05) return status(400)
})
.resolve(({ status }) => {
if (Math.random() < 0.05) return status(401)
})
.onBeforeHandle([
({ status }) => {
if (Math.random() < 0.05) return status(402)
},
({ status }) => {
if (Math.random() < 0.05) return status(403)
}
])
.guard({
beforeHandle: [
({ status }) => {
if (Math.random() < 0.05) return status(405)
},
({ status }) => {
if (Math.random() < 0.05) return status(406)
}
],
afterHandle({ status }) {
if (Math.random() < 0.05) return status(407)
},
error({ status }) {
if (Math.random() < 0.05) return status(408)
}
})
.post(
'/',
({ status }) =>
Math.random() < 0.05 ? status(409, 'Conflict') : 'Type Soundness',
{
auth: true,
response: {
411: t.Literal('Length Required')
}
}
)
.listen(3000)
// app['~Routes']['post']['response']
================================================
FILE: example/params.ts
================================================
import { Elysia } from '../src'
const app = new Elysia()
.get('/', () => 'Elysia')
// Retrieve params, automatically typed
.get('/id/:id', ({ params }) => params.id)
.listen(3000)
console.log('Listen')
================================================
FILE: example/proxy.ts
================================================
import { Elysia } from '../src'
new Elysia()
.all('/*', ({ request, params, query }) =>
fetch({
...request,
url: `https://macosplay.com/${params['*']}?${new URLSearchParams(query)}`
})
)
.listen(3000)
================================================
FILE: example/redirect.ts
================================================
import { Elysia } from '../src'
new Elysia()
.get('/', () => 'Hi')
.get('/redirect', ({ redirect }) => redirect('/'))
.listen(3000)
================================================
FILE: example/rename.ts
================================================
import { Elysia, t } from '../src'
// ? Elysia#83 | Proposal: Standardized way of renaming third party plugin-scoped stuff
// this would be a plugin provided by a third party
const myPlugin = new Elysia()
.decorate('myProperty', 42)
.model('salt', t.String())
new Elysia()
.use(
myPlugin
// map decorator, rename "myProperty" to "renamedProperty"
.decorate(({ myProperty, ...decorators }) => ({
renamedProperty: myProperty,
...decorators
}))
// map model, rename "salt" to "pepper"
.model(({ salt, ...models }) => ({
...models,
pepper: t.String()
}))
// Add prefix
.prefix('decorator', 'unstable')
)
.get(
'/mapped',
({ unstableRenamedProperty }) => unstableRenamedProperty
)
.post('/pepper', ({ body }) => body, {
body: 'pepper',
// response: t.String()
})
================================================
FILE: example/response.ts
================================================
import { Elysia } from '../src'
new Elysia()
.get('/', ({ set }) => {
set.headers['X-POWERED-BY'] = 'Elysia'
// Return custom response
return new Response('Shuba Shuba', {
headers: {
duck: 'shuba duck'
},
status: 418
})
})
.listen(3000)
================================================
FILE: example/router.ts
================================================
import { Elysia } from '../src'
const prefix = <Prefix extends string = string>(prefix: Prefix) =>
new Elysia({ prefix })
.state('b', 'b')
.get('/2', () => 2)
.guard({}, (app) => app.get('/do', () => 'something'))
.group('/v2', (app) => app.guard({}, (app) => app.get('/ok', () => 1)))
const a = new Elysia()
.get('/a', () => 'A')
.guard({}, (app) => app.get('/guard', () => 'a'))
.use(prefix('prefixed'))
.listen(3000)
================================================
FILE: example/schema.ts
================================================
import { Elysia, t } from '../src'
const app = new Elysia()
.model({
name: t.Object({
name: t.String()
}),
b: t.Object({
response: t.Number()
}),
authorization: t.Object({
authorization: t.String()
})
})
// Strictly validate response
.get('/', () => 'hi')
// Strictly validate body and response
.post('/', ({ body, query }) => body.id, {
body: t.Object({
id: t.Number(),
username: t.String(),
profile: t.Object({
name: t.String()
})
})
})
// Strictly validate query, params, and body
.get('/query/:id', ({ query: { name }, params }) => name, {
query: t.Object({
name: t.String()
}),
params: t.Object({
id: t.String()
}),
response: {
200: t.String(),
300: t.Object({
error: t.String()
})
}
})
.guard(
{
headers: 'authorization'
},
(app) =>
app
.derive(({ headers }) => ({
userId: headers.authorization
}))
.get('/', ({ userId }) => 'A')
.post('/id/:id', ({ query, body, params, userId }) => body, {
params: t.Object({
id: t.Number()
}),
transform({ params }) {
params.id = +params.id
}
})
)
.listen(3000)
================================================
FILE: example/simple.ts
================================================
import { Elysia } from '../src'
// Simple Hello World
const t1 = performance.now()
new Elysia()
.get('/', () => 'Hi')
.listen(3000)
console.log(performance.now() - t1)
// Bun.serve({
// port: 8080,
// fetch() {
// return new Response('Hi')
// }
// })
================================================
FILE: example/sleep.ts
================================================
const sleep = (time: number) => new Promise(resolve => setTimeout(resolve, time))
Bun.serve({
port: 3000,
fetch: async () => {
await sleep(1000)
return new Response('Hi')
}
})
================================================
FILE: example/spawn.ts
================================================
import { $ } from 'bun'
import { cpus } from 'os'
const total = cpus().length - 1
const ops = []
for (let i = 0; i < total; i++)
ops.push($`NODE_ENV=production bun example/a.ts`)
await Promise.all(ops)
================================================
FILE: example/store.ts
================================================
import { Elysia } from '../src'
new Elysia()
// Create globally mutable store
.state('name', 'Fubuki')
.get('/id/:id', ({ params: { id }, store: { name } }) => `${id} ${name}`)
================================================
FILE: example/stress/a.ts
================================================
import { getHeapSpaceStatistics } from 'v8'
import { Elysia, t } from '../../src'
import { generateHeapSnapshot } from 'bun'
const memory = process.memoryUsage().heapTotal / 1024 / 1024
const total = 500
const sub = 1
const app = new Elysia()
const plugin = new Elysia()
const t1 = performance.now()
for (let i = 0; i < total * sub; i++)
plugin.get(`/${i}`, () => 'hi', { response: t.String() })
app.use(plugin)
const t2 = performance.now()
Bun.gc(true)
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
const totalRoutes = total * sub
const totalTime = t2 - t1
const avgTimePerRoute = totalTime / totalRoutes
console.log(`${totalRoutes} routes took ${totalTime.toFixed(4)} ms`)
console.log(`Average ${avgTimePerRoute.toFixed(4)} ms per route`)
console.log(`${(memoryAfter - memory).toFixed(2)} MB memory used`)
================================================
FILE: example/stress/decorate.ts
================================================
import { Elysia, t } from '../../src'
const total = 1000
const sub = 50
const app = new Elysia()
const memory = process.memoryUsage().heapTotal / 1024 / 1024
console.log(`${total} Elysia instances with ${sub} decorations each`)
const t1 = performance.now()
for (let i = 0; i < total; i++) {
const plugin = new Elysia()
for (let j = 0; j < sub; j++)
plugin.decorate('a', {
[`value-${i * sub + j}`]: 1
})
app.use(plugin)
}
const t2 = performance.now()
Bun.gc(true)
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
console.log(+(memoryAfter - memory).toFixed(2), 'MB memory used')
console.log('total', +(t2 - t1).toFixed(2), 'ms')
console.log(+((t2 - t1) / (total * sub)).toFixed(6), 'decoration/ms')
================================================
FILE: example/stress/instance.ts
================================================
import { Elysia, t } from '../../src'
const total = 100
const sub = 5
const app = new Elysia({ precompile: true })
const memory = process.memoryUsage().heapTotal / 1024 / 1024
const t1 = performance.now()
for (let i = 0; i < total; i++) {
const plugin = new Elysia({
cookie: {
domain: 'saltyaom.com',
priority: 'high',
secrets: 'a',
sign: 'a'
}
})
for (let j = 0; j < sub; j++) plugin.get(`/${i * sub + j}`, () => 'hi')
app.use(plugin)
}
const t2 = performance.now()
Bun.gc(true)
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
console.log(+(memoryAfter - memory).toFixed(2), 'MB memory used')
console.log(+(t2 - t1).toFixed(2), 'ms')
================================================
FILE: example/stress/memoir.ts
================================================
import { t } from '../../src'
import { Memoirist } from 'memoirist'
const total = 1000
const stack: Memoirist<any>[] = []
{
const t1 = performance.now()
const memory = process.memoryUsage().heapTotal / 1024 / 1024
for (let i = 0; i < total; i++) {
for (let i = 0; i < 2; i++) {
const router = new Memoirist()
// router.add('GET', '/a', () => 'Hello, World!')
// router.add('GET', '/b', () => 'Hello, World!')
stack.push(router)
}
}
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
const took = performance.now() - t1
console.log(
Intl.NumberFormat().format(total),
'routes took',
+took.toFixed(4),
'ms'
)
console.log('Average', +(took / total).toFixed(4), 'ms / route')
console.log(memoryAfter - memory, 'MB memory used')
}
================================================
FILE: example/stress/multiple-routes.ts
================================================
import { Elysia, t } from '../../src'
import v8 from 'v8'
const total = 500
{
const app = new Elysia({ precompile: true })
const t1 = performance.now()
const memory = process.memoryUsage().heapTotal / 1024 / 1024
for (let i = 0; i < total; i++)
app.get(`/id/${i}`, () => 'hello', {
response: t.String()
})
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
const took = performance.now() - t1
console.log(
Intl.NumberFormat().format(total),
'routes took',
+took.toFixed(4),
'ms'
)
console.log('Average', +(took / total).toFixed(4), 'ms / route')
console.log(memoryAfter - memory, 'MB memory used')
console.log(((memoryAfter - memory) / total) * 1024, 'KB memory used')
// v8.writeHeapSnapshot()
}
================================================
FILE: example/stress/sucrose.ts
================================================
// @ts-nocheck
import { sucrose } from '../../src/sucrose'
const total = 100_000
const t = performance.now()
for (let i = 0; i < total; i++) {
sucrose({
handler: function ({ query }) {
query.a
},
afterHandle: [],
beforeHandle: [
function a({ params: { a, c: d }, ...rest }) {
query.b
},
({ error }) => {}
],
error: [
function a({ query, query: { a, c: d }, headers: { hello } }) {
query.b
},
({ query: { f } }) => {}
],
mapResponse: [],
onResponse: [],
parse: [],
request: [],
start: [],
stop: [],
trace: [],
transform: []
})
}
const took = performance.now() - t
console.log(
Intl.NumberFormat().format(total),
'check took',
+took.toFixed(4),
'ms'
)
console.log('Average', +(took / total).toFixed(4), 'ms / check')
================================================
FILE: example/type-inference.ts
================================================
import { Elysia } from '../src'
const counter = (app: Elysia) => app.state('counter', 0)
new Elysia()
.use(counter)
.guard({}, (app) => app.get('/id/:id', ({ store: { counter } }) => counter))
.listen(3000)
================================================
FILE: example/uint8array.ts
================================================
import { Elysia, t } from '../src'
new Elysia()
.post('/', ({ body }) => body, {
body: t.Uint8Array()
})
.listen(3000)
const response = await fetch('http://localhost:3000', {
method: 'POST',
body: new Uint8Array([
229, 143, 175, 230, 132, 155, 227, 129, 143, 227, 129, 166, 227, 129,
148, 227, 130, 129, 227, 130, 147
]),
headers: { 'content-type': 'application/octet-stream' }
})
console.log(response.status)
console.log(await response.text())
================================================
FILE: example/upload.ts
================================================
import { Elysia, t } from '../src'
import { upload } from '../test/utils'
const app = new Elysia()
.post('/single', ({ body: { file } }) => file, {
body: t.Object({
file: t.File()
})
})
.post(
'/multiple',
({ body: { files } }) => files.reduce((a, b) => a + b.size, 0),
{
body: t.Object({
files: t.Files()
})
}
)
.listen(3000)
const { request } = upload('/single', {
file: 'millenium.jpg'
})
app.handle(request)
.then((r) => r.text())
.then(console.log)
================================================
FILE: example/video.ts
================================================
import { Elysia } from 'elysia'
new Elysia()
.get('/', Bun.file('test/kyuukurarin.mp4'))
.listen(3000)
================================================
FILE: example/websocket.ts
================================================
import { Elysia } from '../src'
const app = new Elysia()
.state('start', 'here')
.ws('/ws', {
open(ws) {
ws.subscribe('asdf')
console.log('Open Connection:', ws.id)
},
close(ws) {
console.log('Closed Connection:', ws.id)
},
message(ws, message) {
ws.publish('asdf', message)
ws.send(message)
}
})
.get('/publish/:publish', ({ params: { publish: text } }) => {
app.server!.publish('asdf', text)
return text
})
.listen(3000, (server) => {
console.log(`http://${server.hostname}:${server.port}`)
})
================================================
FILE: knip.json
================================================
{
"entry": [
"src/index.ts"
],
"project": [
"src/**/*.{js,ts}"
],
"ignoreDependencies": [
"@types/cookie",
"arktype",
"@elysiajs/openapi",
"eslint-plugin-security",
"expect-type",
"prettier",
"valibot",
"zod",
"file-type"
],
"ignoreBinaries": [
"dist/bun/index.js"
]
}
================================================
FILE: package.json
================================================
{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.4.28",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
"email": "saltyaom@gmail.com"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./ws": {
"types": "./dist/ws/index.d.ts",
"import": "./dist/ws/index.mjs",
"require": "./dist/ws/index.js"
},
"./ws/types": {
"types": "./dist/ws/types.d.ts",
"import": "./dist/ws/types.mjs",
"require": "./dist/ws/types.js"
},
"./ws/bun": {
"types": "./dist/ws/bun.d.ts",
"import": "./dist/ws/bun.mjs",
"require": "./dist/ws/bun.js"
},
"./compose": {
"types": "./dist/compose.d.ts",
"import": "./dist/compose.mjs",
"require": "./dist/compose.js"
},
"./context": {
"types": "./dist/context.d.ts",
"import": "./dist/context.mjs",
"require": "./dist/context.js"
},
"./cookies": {
"types": "./dist/cookies.d.ts",
"import": "./dist/cookies.mjs",
"require": "./dist/cookies.js"
},
"./error": {
"types": "./dist/error.d.ts",
"import": "./dist/error.mjs",
"require": "./dist/error.js"
},
"./schema": {
"types": "./dist/schema.d.ts",
"import": "./dist/schema.mjs",
"require": "./dist/schema.js"
},
"./sucrose": {
"types": "./dist/sucrose.d.ts",
"import": "./dist/sucrose.mjs",
"require": "./dist/sucrose.js"
},
"./trace": {
"types": "./dist/trace.d.ts",
"import": "./dist/trace.mjs",
"require": "./dist/trace.js"
},
"./type-system": {
"types": "./dist/type-system/index.d.ts",
"import": "./dist/type-system/index.mjs",
"require": "./dist/type-system/index.js"
},
"./type-system/format": {
"types": "./dist/type-system/format.d.ts",
"import": "./dist/type-system/format.mjs",
"require": "./dist/type-system/format.js"
},
"./type-system/utils": {
"types": "./dist/type-system/utils.d.ts",
"import": "./dist/type-system/utils.mjs",
"require": "./dist/type-system/utils.js"
},
"./type-system/types": {
"types": "./dist/type-system/types.d.ts",
"import": "./dist/type-system/types.mjs",
"require": "./dist/type-system/types.js"
},
"./types": {
"types": "./dist/types.d.ts",
"import": "./dist/types.mjs",
"require": "./dist/types.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"import": "./dist/utils.mjs",
"require": "./dist/utils.js"
},
"./parse-query": {
"types": "./dist/parse-query.d.ts",
"import": "./dist/parse-query.mjs",
"require": "./dist/parse-query.js"
},
"./adapter": {
"types": "./dist/adapter/index.d.ts",
"import": "./dist/adapter/index.mjs",
"require": "./dist/adapter/index.js"
},
"./adapter/utils": {
"types": "./dist/adapter/utils.d.ts",
"import": "./dist/adapter/utils.mjs",
"require": "./dist/adapter/utils.js"
},
"./adapter/bun": {
"types": "./dist/adapter/bun/index.d.ts",
"import": "./dist/adapter/bun/index.mjs",
"require": "./dist/adapter/bun/index.js"
},
"./adapter/bun/handler": {
"types": "./dist/adapter/bun/handler.d.ts",
"import": "./dist/adapter/bun/handler.mjs",
"require": "./dist/adapter/bun/handler.js"
},
"./adapter/bun/compose": {
"types": "./dist/adapter/bun/compose.d.ts",
"import": "./dist/adapter/bun/compose.mjs",
"require": "./dist/adapter/bun/compose.js"
},
"./adapter/cloudflare-worker": {
"types": "./dist/adapter/cloudflare-worker/index.d.ts",
"import": "./dist/adapter/cloudflare-worker/index.mjs",
"require": "./dist/adapter/cloudflare-worker/index.js"
},
"./adapter/web-standard": {
"types": "./dist/adapter/web-standard/index.d.ts",
"import": "./dist/adapter/web-standard/index.mjs",
"require": "./dist/adapter/web-standard/index.js"
},
"./adapter/web-standard/handler": {
"types": "./dist/adapter/web-standard/handler.d.ts",
"import": "./dist/adapter/web-standard/handler.mjs",
"require": "./dist/adapter/web-standard/handler.js"
},
"./universal": {
"types": "./dist/universal/index.d.ts",
"import": "./dist/universal/index.mjs",
"require": "./dist/universal/index.js"
},
"./universal/server": {
"types": "./dist/universal/server.d.ts",
"import": "./dist/universal/server.mjs",
"require": "./dist/universal/server.js"
},
"./universal/env": {
"types": "./dist/universal/env.d.ts",
"import": "./dist/universal/env.mjs",
"require": "./dist/universal/env.js"
},
"./universal/file": {
"types": "./dist/universal/file.d.ts",
"import": "./dist/universal/file.mjs",
"require": "./dist/universal/file.js"
}
},
"repository": {
"type": "git",
"url": "https://github.com/elysiajs/elysia"
},
"bugs": "https://github.com/elysiajs/elysia/issues",
"homepage": "https://github.com/elysiajs/elysia",
"keywords": [
"bun",
"http",
"web",
"server"
],
"license": "MIT",
"scripts": {
"test": "bun run test:functionality && bun run test:types && bun run test:node",
"test:functionality": "bun test && bun run test:imports",
"test:imports": "bun run test/type-system/import.ts",
"test:types": "tsc --project tsconfig.test.json",
"test:node": "npm install --prefix test/node/cjs && npm install --prefix test/node/esm/ && node test/node/cjs/index.js && node test/node/esm/index.js",
"test:cf": "npm install --prefix test/cloudflare && cd test/cloudflare && bun run cf-typegen && bun run test",
"dev": "bun run --watch example/a.ts",
"build": "rm -rf dist && bun build.ts",
"deadcode": "knip",
"release": "bun run build && bun run test && bun publish"
},
"dependencies": {
"cookie": "^1.1.1",
"exact-mirror": "^0.2.7",
"fast-decode-uri-component": "^1.0.1",
"memoirist": "^0.4.0"
},
"devDependencies": {
"@elysiajs/openapi": "^1.4.1",
"@types/bun": "^1.3.5",
"@types/cookie": "1.0.0",
"@types/fast-decode-uri-component": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^8.30.1",
"@typescript-eslint/parser": "^8.30.1",
"arktype": "^2.1.22",
"esbuild-fix-imports-plugin": "^1.0.22",
"eslint": "^9.24.0",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-sonarjs": "^3.0.2",
"expect-type": "^1.2.1",
"file-type": "^20.4.1",
"knip": "^5.64.1",
"prettier": "^3.5.3",
"tsup": "^8.4.0",
"typescript": "^5.8.3",
"valibot": "^1.1.0",
"zod": "^4.1.5"
},
"peerDependencies": {
"@types/bun": ">= 1.2.0",
"@sinclair/typebox": ">= 0.34.0 < 1",
"exact-mirror": ">= 0.0.9",
"file-type": ">= 20.0.0",
"openapi-types": ">= 12.0.0",
"typescript": ">= 5.0.0"
},
"overrides": {
"esbuild": "0.25.4"
},
"peerDependenciesMeta": {
"@types/bun": {
"optional": true
},
"typescript": {
"optional": true
}
}
}
================================================
FILE: src/adapter/bun/compose.ts
================================================
import { mapEarlyResponse } from './handler'
import { sucrose, type Sucrose } from '../../sucrose'
import { createHoc, createOnRequestHandler, isAsync } from '../../compose'
import { randomId, ELYSIA_REQUEST_ID, redirect, isNotEmpty } from '../../utils'
import { status } from '../../error'
import { ELYSIA_TRACE } from '../../trace'
import type { AnyElysia } from '../..'
import type { InternalRoute, InputSchema } from '../../types'
const allocateIf = (value: string, condition: unknown) =>
condition ? value : ''
const createContext = (
app: AnyElysia,
route: InternalRoute,
inference: Sucrose.Inference,
isInline = false
) => {
let fnLiteral = ''
// @ts-expect-error private
const defaultHeaders = app.setHeaders
const hasTrace = !!app.event.trace?.length
if (hasTrace) fnLiteral += `const id=randomId()\n`
const isDynamic = /[:*]/.test(route.path)
const standardHostname = app.config.handler?.standardHostname ?? true
const getQi =
`const u=request.url,` +
`s=u.indexOf('/',${standardHostname ? 11 : 7}),` +
`qi=u.indexOf('?',s+1)\n`
const needsQuery =
inference.query ||
!!route.hooks.query ||
!!(route.hooks.standaloneValidator as InputSchema[])?.find(
(x) => x.query
) ||
app.event.request?.length
if (needsQuery) fnLiteral += getQi
const getPath = !inference.path
? ''
: !isDynamic
? `path:'${route.path}',`
: `get path(){` +
(needsQuery ? '' : getQi) +
`if(qi===-1)return u.substring(s)\n` +
`return u.substring(s,qi)\n` +
`},`
fnLiteral +=
allocateIf(`const c=`, !isInline) +
`{request,` +
`store,` +
allocateIf(`qi,`, needsQuery) +
allocateIf(`params:request.params,`, isDynamic) +
getPath +
allocateIf(
`url:request.url,`,
hasTrace || inference.url || needsQuery
) +
`redirect,` +
`status,` +
`set:{headers:` +
(isNotEmpty(defaultHeaders)
? 'Object.assign({},app.setHeaders)'
: 'Object.create(null)') +
`,status:200}`
if (inference.server) fnLiteral += `,get server(){return app.getServer()}`
if (hasTrace) fnLiteral += ',[ELYSIA_REQUEST_ID]:id'
{
let decoratorsLiteral = ''
// @ts-expect-error private
for (const key of Object.keys(app.singleton.decorator))
decoratorsLiteral += `,'${key}':decorator['${key}']`
fnLiteral += decoratorsLiteral
}
fnLiteral += `}\n`
return fnLiteral
}
export const createBunRouteHandler = (app: AnyElysia, route: InternalRoute) => {
const hasTrace = !!app.event.trace?.length
// @ts-expect-error private property
const hasHoc = !!app.extender.higherOrderFunctions.length
let inference = sucrose(
route.hooks,
// @ts-expect-error
app.inference
)
inference = sucrose(
{
handler: route.handler
},
inference
)
let fnLiteral =
'const handler=data.handler,' +
`app=data.app,` +
'store=data.store,' +
`decorator=data.decorator,` +
'redirect=data.redirect,' +
'route=data.route,' +
'mapEarlyResponse=data.mapEarlyResponse,' +
allocateIf('randomId=data.randomId,', hasTrace) +
allocateIf(`ELYSIA_REQUEST_ID=data.ELYSIA_REQUEST_ID,`, hasTrace) +
allocateIf(`ELYSIA_TRACE=data.ELYSIA_TRACE,`, hasTrace) +
allocateIf(`trace=data.trace,`, hasTrace) +
allocateIf(`hoc=data.hoc,`, hasHoc) +
'status=data.status\n'
if (app.event.request?.length)
fnLiteral += `const onRequest=app.event.request.map(x=>x.fn)\n`
fnLiteral += `${app.event.request?.find(isAsync) ? 'async' : ''} function map(request){`
const needsQuery =
inference.query ||
!!route.hooks.query ||
!!(route.hooks.standaloneValidator as InputSchema[])?.find(
(x) => x.query
)
// inference.query require declaring const 'qi'
if (hasTrace || needsQuery || app.event.request?.length) {
fnLiteral += createContext(app, route, inference)
fnLiteral += createOnRequestHandler(app)
fnLiteral += 'return handler(c)}'
} else
fnLiteral += `return handler(${createContext(app, route, inference, true)})}`
fnLiteral += createHoc(app)
return Function(
'data',
fnLiteral
)({
app,
handler: route.compile?.() ?? route.composed,
redirect,
status,
// @ts-expect-error private property
hoc: app.extender.higherOrderFunctions.map((x) => x.fn),
store: app.store,
decorator: app.decorator,
route: route.path,
randomId: hasTrace ? randomId : undefined,
ELYSIA_TRACE: hasTrace ? ELYSIA_TRACE : undefined,
ELYSIA_REQUEST_ID: hasTrace ? ELYSIA_REQUEST_ID : undefined,
trace: hasTrace ? app.event.trace?.map((x) => x?.fn ?? x) : undefined,
mapEarlyResponse: mapEarlyResponse
})
}
================================================
FILE: src/adapter/bun/handler-native.ts
================================================
import { isHTMLBundle } from './index'
import type { Context } from '../../context'
import type { AnyLocalHook, MaybePromise } from '../../types'
import { mapResponse } from './handler'
export const createNativeStaticHandler = (
handle: unknown,
hooks: AnyLocalHook,
set?: Context['set']
): (() => MaybePromise<Response>) | undefined => {
if (typeof handle === 'function' || handle instanceof Blob) return
if (isHTMLBundle(handle)) return () => handle as any
const response = mapResponse(
handle instanceof Response
? handle.clone()
: handle instanceof Promise
? handle.then((x) =>
x instanceof Response
? x.clone()
: isHTMLBundle(x)
? () => x
: x
)
: handle,
set ?? {
headers: {}
}
)
if (
!hooks.parse?.length &&
!hooks.transform?.length &&
!hooks.beforeHandle?.length &&
!hooks.afterHandle?.length
) {
if (response instanceof Promise)
return response.then((response) => {
if (!response) return
return response.clone()
}) as any as () => Promise<Response>
return () => response.clone() as Response
}
}
================================================
FILE: src/adapter/bun/handler.ts
================================================
// Similar to adapter/web-standard/handler but
// string case is omitted header out
// (this has a significant performance difference on Bun)
/* eslint-disable sonarjs/no-nested-switch */
/* eslint-disable sonarjs/no-duplicate-string */
import {
createResponseHandler,
createStreamHandler,
handleFile,
handleSet
} from '../utils'
import { ElysiaFile } from '../../universal/file'
import { isNotEmpty } from '../../utils'
import { Cookie } from '../../cookies'
import { ElysiaCustomStatusResponse } from '../../error'
import type { Context } from '../../context'
import type { AnyLocalHook } from '../../types'
// Response.json is faster than new Response(JSON.stringify()) in Bun
// https://x.com/jarredsumner/status/2023328556210921948
export const mapResponse = (
response: unknown,
set: Context['set'],
request?: Request
): Response => {
if (isNotEmpty(set.headers) || set.status !== 200 || set.cookie) {
handleSet(set)
switch (response?.constructor?.name) {
case 'String':
return new Response(response as string, set as any)
case 'Array':
case 'Object':
return Response.json(response, set as any)
case 'ElysiaFile':
return handleFile((response as ElysiaFile).value as File, set, request)
case 'File':
return handleFile(response as File, set, request)
case 'Blob':
return handleFile(response as Blob, set, request)
case 'ElysiaCustomStatusResponse':
set.status = (response as ElysiaCustomStatusResponse<200>).code
return mapResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
case undefined:
if (!response) return new Response('', set as any)
return Response.json(response, set as any)
case 'Response':
return handleResponse(response as Response, set, request)
case 'Error':
return errorToResponse(response as Error, set)
case 'Promise':
return (response as Promise<any>).then((x) =>
mapResponse(x, set, request)
) as any
case 'Function':
return mapResponse((response as Function)(), set, request)
case 'Number':
case 'Boolean':
return new Response(
(response as number | boolean).toString(),
set as any
)
case 'Cookie':
if (response instanceof Cookie)
return new Response(response.value, set as any)
return new Response(response?.toString(), set as any)
case 'FormData':
return new Response(response as FormData, set as any)
default:
// recheck Response, Promise, Error because some library may extends Response
if (response instanceof Response)
return handleResponse(response as Response, set, request)
if (response instanceof Promise)
return response.then((x) => mapResponse(x, set)) as any
if (response instanceof Error)
return errorToResponse(response as Error, set)
if (response instanceof ElysiaCustomStatusResponse) {
set.status = (
response as ElysiaCustomStatusResponse<200>
).code
return mapResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
}
if (
// @ts-expect-error
typeof response?.next === 'function' ||
response instanceof ReadableStream
)
return handleStream(response as any, set, request) as any
if (typeof (response as Promise<unknown>)?.then === 'function')
return (response as Promise<unknown>).then((x) =>
mapResponse(x, set)
) as any
// custom class with an array-like value
// eg. Bun.sql`` result
if (Array.isArray(response))
return Response.json(response) as any
// @ts-expect-error
if (typeof response?.toResponse === 'function')
return mapResponse((response as any).toResponse(), set)
if ('charCodeAt' in (response as any)) {
const code = (response as any).charCodeAt(0)
if (code === 123 || code === 91)
return Response.json(response, set as any) as any
}
return new Response(response as any, set as any)
}
}
// Stream response defers a 'set' API, assume that it may include 'set'
if (
// @ts-expect-error
typeof response?.next === 'function' ||
response instanceof ReadableStream
)
return handleStream(response as any, set, request) as any
return mapCompactResponse(response, request)
}
export const mapEarlyResponse = (
response: unknown,
set: Context['set'],
request?: Request
): Response | undefined => {
if (response === undefined || response === null) return
if (isNotEmpty(set.headers) || set.status !== 200 || set.cookie) {
handleSet(set)
switch (response?.constructor?.name) {
case 'String':
return new Response(response as string, set as any)
case 'Array':
case 'Object':
return Response.json(response, set as any)
case 'ElysiaFile':
return handleFile((response as ElysiaFile).value as File, set, request)
case 'File':
return handleFile(response as File, set, request)
case 'Blob':
return handleFile(response as File | Blob, set, request)
case 'ElysiaCustomStatusResponse':
set.status = (response as ElysiaCustomStatusResponse<200>).code
return mapEarlyResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
case undefined:
if (!response) return
return Response.json(response, set as any)
case 'Response':
return handleResponse(response as Response, set, request)
case 'Promise':
return (response as Promise<unknown>).then((x) =>
mapEarlyResponse(x, set)
) as any
case 'Error':
return errorToResponse(response as Error, set)
case 'Function':
return mapEarlyResponse((response as Function)(), set)
case 'Number':
case 'Boolean':
return new Response(
(response as number | boolean).toString(),
set as any
)
case 'FormData':
return new Response(response as FormData)
case 'Cookie':
if (response instanceof Cookie)
return new Response(response.value, set as any)
return new Response(response?.toString(), set as any)
default:
if (response instanceof Response)
return handleResponse(response, set, request)
if (response instanceof Promise)
return response.then((x) => mapEarlyResponse(x, set)) as any
if (response instanceof Error)
return errorToResponse(response as Error, set)
if (response instanceof ElysiaCustomStatusResponse) {
set.status = (
response as ElysiaCustomStatusResponse<200>
).code
return mapEarlyResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
}
if (
// @ts-expect-error
typeof response?.next === 'function' ||
response instanceof ReadableStream
)
return handleStream(response as any, set, request) as any
if (typeof (response as Promise<unknown>)?.then === 'function')
return (response as Promise<unknown>).then((x) =>
mapEarlyResponse(x, set)
) as any
// @ts-expect-error
if (typeof response?.toResponse === 'function')
return mapEarlyResponse((response as any).toResponse(), set)
// custom class with an array-like value
// eg. Bun.sql`` result
if (Array.isArray(response))
return Response.json(response) as any
if ('charCodeAt' in (response as any)) {
const code = (response as any).charCodeAt(0)
if (code === 123 || code === 91)
return Response.json(response, set as any) as any
}
return new Response(response as any, set as any)
}
} else
switch (response?.constructor?.name) {
case 'String':
return new Response(response as string)
case 'Array':
case 'Object':
return Response.json(response, set as any)
case 'ElysiaFile':
return handleFile((response as ElysiaFile).value as File, set, request)
case 'File':
return handleFile(response as File, set, request)
case 'Blob':
return handleFile(response as File | Blob, set, request)
case 'ElysiaCustomStatusResponse':
set.status = (response as ElysiaCustomStatusResponse<200>).code
return mapEarlyResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
case undefined:
if (!response) return new Response('')
return Response.json(response)
case 'Response':
return response as Response
case 'Promise':
return (response as Promise<unknown>).then((x) => {
const r = mapEarlyResponse(x, set)
if (r !== undefined) return r
}) as any
case 'Error':
return errorToResponse(response as Error, set)
case 'Function':
return mapCompactResponse((response as Function)(), request)
case 'Number':
case 'Boolean':
return new Response((response as number | boolean).toString())
case 'Cookie':
if (response instanceof Cookie)
return new Response(response.value, set as any)
return new Response(response?.toString(), set as any)
case 'FormData':
return new Response(response as FormData)
default:
if (response instanceof Response) return response
if (response instanceof Promise)
return response.then((x) => mapEarlyResponse(x, set)) as any
if (response instanceof Error)
return errorToResponse(response as Error, set)
if (response instanceof ElysiaCustomStatusResponse) {
set.status = (
response as ElysiaCustomStatusResponse<200>
).code
return mapEarlyResponse(
(response as ElysiaCustomStatusResponse<200>).response,
set,
request
)
}
if (
// @ts-expect-error
typeof response?.next === 'function' ||
response instanceof ReadableStream
)
return handleStream(response as any, set, request) as any
if (typeof (response as Promise<unknown>)?.then === 'function')
return (response as Promise<unknown>).then((x) =>
mapEarlyResponse(x, set)
) as any
// @ts-expect-error
if (typeof response?.toResponse === 'function')
return mapEarlyResponse((response as any).toResponse(), set)
// custom class with an array-like value
// eg. Bun.sql`` result
if (Array.isArray(response))
return Response.json(response) as any
if ('charCodeAt' in (response as any)) {
const code = (response as any).charCodeAt(0)
if (code === 123 || code === 91)
return Response.json(response, set as any) as any
}
return new Response(response as any)
}
}
export const mapCompactResponse = (
response: unknown,
request?: Request
): Response => {
switch (response?.constructor?.name) {
case 'String':
return new Response(response as string)
case 'Object':
case 'Array':
return Response.json(response)
case 'ElysiaFile':
return handleFile((response as ElysiaFile).value as File, undefined, request)
case 'File':
return handleFile(response as File, undefined, request)
case 'Blob':
return handleFile(response as File | Blob, undefined, request)
case 'ElysiaCustomStatusResponse':
return mapResponse(
(response as ElysiaCustomStatusResponse<200>).response,
{
status: (response as ElysiaCustomStatusResponse<200>).code,
headers: {}
}
)
case undefined:
if (!response) return new Response('')
return Response.json(response)
case 'Response':
return response as Response
case 'Error':
return errorToResponse(response as Error)
case 'Promise':
return (response as Promise<unknown>).then((x) =>
mapCompactResponse(x, request)
) as any
// ? Maybe response or Blob
case 'Function':
return mapCompactResponse((response as Function)(), request)
case 'Number':
case 'Boolean':
return new Response((response as number | boolean).toString())
case 'FormData':
return new Response(response as FormData)
default:
if (response instanceof Response) return response
if (response instanceof Promise)
return response.then((x) =>
mapCompactResponse(x, request)
) as any
if (response instanceof Error)
return errorToResponse(response as Error)
if (response instanceof ElysiaCustomStatusResponse)
return mapResponse(
(response as ElysiaCustomStatusResponse<200>).response,
{
status: (response as ElysiaCustomStatusResponse<200>)
.code,
headers: {}
}
)
if (
// @ts-expect-error
typeof response?.next === 'function' ||
response instanceof ReadableStream
)
return handleStream(response as any, undefined, request) as any
if (typeof (response as Promise<unknown>)?.then === 'function')
return (response as Promise<unknown>).then((x) =>
mapCompactResponse(x, request)
) as any
// @ts-expect-errors
if (typeof response?.toResponse === 'function')
return mapCompactResponse((response as any).toResponse())
// custom class with an array-like value
// eg. Bun.sql`` result
if (Array.isArray(response)) return Response.json(response) as any
if ('charCodeAt' in (response as any)) {
const code = (response as any).charCodeAt(0)
if (code === 123 || code === 91)
return Response.json(response) as any
}
return new Response(response as any)
}
}
export const errorToResponse = (error: Error, set?: Context['set']) => {
// @ts-expect-error
if (typeof error?.toResponse === 'function') {
// @ts-expect-error
const raw = error.toResponse()
const targetSet =
set ??
({ headers: {}, status: 200, redirect: '' } as Context['set'])
const apply = (resolved: unknown) => {
if (resolved instanceof Response) targetSet.status = resolved.status
return mapResponse(resolved, targetSet)
}
return typeof raw?.then === 'function' ? raw.then(apply) : apply(raw)
}
return Response.json(
{
name: error?.name,
message: error?.message,
cause: error?.cause
},
{
status:
set?.status !== 200 ? ((set?.status as number) ?? 500) : 500,
headers: set?.headers as any
}
)
}
export const createStaticHandler = (
handle: unknown,
hooks: Partial<AnyLocalHook>,
setHeaders: Context['set']['headers'] = {}
): (() => Response) | undefined => {
if (typeof handle === 'function') return
const response = mapResponse(handle, {
headers: setHeaders
})
if (
!hooks.parse?.length &&
!hooks.transform?.length &&
!hooks.beforeHandle?.length &&
!hooks.afterHandle?.length
)
return () => response.clone() as Response
}
const handleResponse = createResponseHandler({
mapResponse,
mapCompactResponse
})
const handleStream = createStreamHandler({
mapResponse,
mapCompactResponse
})
================================================
FILE: src/adapter/bun/index.ts
================================================
/* eslint-disable sonarjs/no-duplicate-string */
import type { TSchema } from '@sinclair/typebox'
import { WebStandardAdapter } from '../web-standard/index'
import { parseSetCookies } from '../utils'
import type { ElysiaAdapter } from '../types'
import type { Serve } from '../../universal/server'
import { createBunRouteHandler } from './compose'
import { createNativeStaticHandler } from './handler-native'
import { serializeCookie } from '../../cookies'
import { isProduction, status, ValidationError } from '../../error'
import { getSchemaValidator } from '../../schema'
import {
hasHeaderShorthand,
isNotEmpty,
isNumericString,
randomId,
supportPerMethodInlineHandler
} from '../../utils'
import {
mapResponse,
mapEarlyResponse,
mapCompactResponse,
createStaticHandler
} from './handler'
import {
createHandleWSResponse,
createWSMessageParser,
ElysiaWS,
websocket
} from '../../ws/index'
import type { ServerWebSocket } from '../../ws/bun'
import type { AnyElysia } from '../..'
const optionalParam = /:.+?\?(?=\/|$)/
const getPossibleParams = (path: string) => {
const match = optionalParam.exec(path)
if (!match) return [path]
const routes: string[] = []
const head = path.slice(0, match.index)
const param = match[0].slice(0, -1)
const tail = path.slice(match.index + match[0].length)
routes.push(head.slice(0, -1))
routes.push(head + param)
for (const fragment of getPossibleParams(tail)) {
if (!fragment) continue
if (!fragment.startsWith('/:'))
routes.push(head.slice(0, -1) + fragment)
routes.push(head + param + fragment)
}
return routes
}
export const isHTMLBundle = (handle: any) =>
typeof handle === 'object' &&
handle !== null &&
(handle.toString() === '[object HTMLBundle]' ||
typeof handle.index === 'string')
const supportedMethods = {
GET: true,
HEAD: true,
OPTIONS: true,
DELETE: true,
PATCH: true,
POST: true,
PUT: true
} as const
const mapRoutes = (app: AnyElysia) => {
if (!app.config.aot || app.config.systemRouter === false) return undefined
const routes = <Record<string, Function | Record<string, unknown>>>{}
const add = (
route: {
path: string
method: string
},
handler: Function
) => {
const path = encodeURI(route.path)
if (routes[path]) {
// @ts-ignore
if (!routes[path][route.method])
// @ts-ignore
routes[path][route.method] = handler
} else
routes[path] = {
[route.method]: handler
}
}
// @ts-expect-error
const tree = app.routeTree
for (const route of app.router.history) {
if (typeof route.handler !== 'function') continue
const method = route.method
if (
(method === 'GET' && `WS_${route.path}` in tree) ||
method === 'WS' ||
route.path.charCodeAt(route.path.length - 1) === 42 ||
!(method in supportedMethods)
)
continue
if (method === 'ALL') {
if (!(`WS_${route.path}` in tree))
routes[route.path] = route.hooks?.config?.mount
? route.hooks.trace ||
app.event.trace ||
// @ts-expect-error private property
app.extender.higherOrderFunctions
? createBunRouteHandler(app, route)
: route.hooks.mount || route.handler
: route.handler
continue
}
let compiled: Function
const handler = app.config.precompile
? createBunRouteHandler(app, route)
: (request: Request) => {
if (compiled) return compiled(request)
return (compiled = createBunRouteHandler(app, route))(
request
)
}
for (const path of getPossibleParams(route.path))
add(
{
method,
path
},
handler
)
}
return routes
}
type Routes = Record<string, Function | Response | Record<string, unknown>>
const mergeRoutes = (r1: Routes, r2?: Routes) => {
if (!r2) return r1
for (const key of Object.keys(r2)) {
if (r1[key] === r2[key]) continue
if (!r1[key]) {
r1[key] = r2[key]
continue
}
if (r1[key] && r2[key]) {
if (typeof r1[key] === 'function' || r1[key] instanceof Response) {
r1[key] = r2[key]
continue
}
r1[key] = {
...r1[key],
...r2[key]
}
}
}
return r1
}
// // https://github.com/elysiajs/elysia/issues/1752
// inconsistent behavior between trailing slash and non-trailing slash
export const removeTrailingPath = (routes: Routes) => {
for (const key of Object.keys(routes))
if (key.length > 1 && key.charCodeAt(key.length - 1) === 47) {
routes[key.slice(0, -1)] = routes[key]
delete routes[key]
}
return routes
}
export const BunAdapter: ElysiaAdapter = {
...WebStandardAdapter,
name: 'bun',
handler: {
mapResponse,
mapEarlyResponse,
mapCompactResponse,
createStaticHandler,
creat
gitextract_5rm6upbg/ ├── .eslintrc.json ├── .github/ │ ├── FUNDING.yaml │ ├── ISSUE_TEMPLATE/ │ │ ├── 2-bug-report.yml │ │ ├── 3-feature-request.yml │ │ └── config.yml │ ├── dependabot.yml │ └── workflows/ │ ├── ci.yml │ └── publish.yml ├── .gitignore ├── .npmignore ├── .npmrc ├── .prettierrc ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.ts ├── example/ │ ├── a.ts │ ├── async-recursive.ts │ ├── body.ts │ ├── cookie.ts │ ├── counter.ts │ ├── custom-response.ts │ ├── derive.ts │ ├── error.ts │ ├── extension.ts │ ├── file.ts │ ├── guard.ts │ ├── headers.ts │ ├── hook.ts │ ├── html-import.ts │ ├── http.ts │ ├── index.html │ ├── lazy/ │ │ └── index.ts │ ├── lazy-module.ts │ ├── native.ts │ ├── nested-multipart-files.ts │ ├── nested-schema.ts │ ├── newFile.ts │ ├── openapi.ts │ ├── params.ts │ ├── proxy.ts │ ├── redirect.ts │ ├── rename.ts │ ├── response.ts │ ├── router.ts │ ├── schema.ts │ ├── simple.ts │ ├── sleep.ts │ ├── spawn.ts │ ├── store.ts │ ├── stress/ │ │ ├── a.ts │ │ ├── decorate.ts │ │ ├── instance.ts │ │ ├── memoir.ts │ │ ├── multiple-routes.ts │ │ └── sucrose.ts │ ├── type-inference.ts │ ├── uint8array.ts │ ├── upload.ts │ ├── video.ts │ └── websocket.ts ├── knip.json ├── package.json ├── src/ │ ├── adapter/ │ │ ├── bun/ │ │ │ ├── compose.ts │ │ │ ├── handler-native.ts │ │ │ ├── handler.ts │ │ │ └── index.ts │ │ ├── cloudflare-worker/ │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── types.ts │ │ ├── utils.ts │ │ └── web-standard/ │ │ ├── handler.ts │ │ └── index.ts │ ├── compose.ts │ ├── context.ts │ ├── cookies.ts │ ├── dynamic-handle.ts │ ├── error.ts │ ├── formats.ts │ ├── index.ts │ ├── manifest.ts │ ├── parse-query.ts │ ├── replace-schema.ts │ ├── schema.ts │ ├── sucrose.ts │ ├── trace.ts │ ├── type-system/ │ │ ├── format.ts │ │ ├── index.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── types.ts │ ├── universal/ │ │ ├── env.ts │ │ ├── file.ts │ │ ├── index.ts │ │ ├── request.ts │ │ ├── server.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── utils.ts │ └── ws/ │ ├── bun.ts │ ├── index.ts │ └── types.ts ├── test/ │ ├── adapter/ │ │ ├── bun/ │ │ │ └── index.test.ts │ │ └── web-standard/ │ │ ├── cookie-to-header.test.ts │ │ ├── map-compact-response.test.ts │ │ ├── map-early-response.test.ts │ │ ├── map-response.test.ts │ │ ├── set-cookie.test.ts │ │ └── utils.ts │ ├── aot/ │ │ ├── analysis.test.ts │ │ ├── generation.test.ts │ │ ├── has-transform.test.ts │ │ ├── has-type.test.ts │ │ └── response.test.ts │ ├── bun/ │ │ ├── router.test.ts │ │ └── sql.test.ts │ ├── cloudflare/ │ │ ├── .gitignore │ │ ├── package.json │ │ ├── script/ │ │ │ └── test.ts │ │ ├── src/ │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ ├── worker-configuration.d.ts │ │ └── wrangler.jsonc │ ├── cookie/ │ │ ├── explicit.test.ts │ │ ├── implicit.test.ts │ │ ├── response.test.ts │ │ ├── signature.test.ts │ │ └── unchanged.test.ts │ ├── core/ │ │ ├── aot-strictpath.test.ts │ │ ├── as.test.ts │ │ ├── before-handle-arrow.test.ts │ │ ├── compose.test.ts │ │ ├── config.test.ts │ │ ├── context.test.ts │ │ ├── dynamic.test.ts │ │ ├── elysia.test.ts │ │ ├── formdata.test.ts │ │ ├── handle-error.test.ts │ │ ├── macro-lifecycle.test.ts │ │ ├── modules.test.ts │ │ ├── mount.test.ts │ │ ├── native-static.test.ts │ │ ├── normalize.test.ts │ │ ├── path.test.ts │ │ ├── redirect.test.ts │ │ ├── sanitize.test.ts │ │ ├── status.test.ts │ │ └── stop.test.ts │ ├── extends/ │ │ ├── decorators.test.ts │ │ ├── error.test.ts │ │ ├── models.test.ts │ │ └── store.test.ts │ ├── hoc/ │ │ └── index.test.ts │ ├── lifecycle/ │ │ ├── after-handle.test.ts │ │ ├── after-response.test.ts │ │ ├── before-handle.test.ts │ │ ├── derive.test.ts │ │ ├── error.test.ts │ │ ├── hook-types.test.ts │ │ ├── map-derive.test.ts │ │ ├── map-resolve.test.ts │ │ ├── map-response.test.ts │ │ ├── parser.test.ts │ │ ├── request.test.ts │ │ ├── resolve.test.ts │ │ ├── response.test.ts │ │ └── transform.test.ts │ ├── macro/ │ │ └── macro.test.ts │ ├── modules.ts │ ├── node/ │ │ ├── .gitignore │ │ ├── cjs/ │ │ │ ├── bun.lockb │ │ │ ├── index.js │ │ │ └── package.json │ │ └── esm/ │ │ ├── bun.lockb │ │ ├── index.js │ │ └── package.json │ ├── path/ │ │ ├── group.test.ts │ │ ├── guard.test.ts │ │ └── path.test.ts │ ├── plugins/ │ │ ├── affix.test.ts │ │ ├── checksum.test.ts │ │ ├── error-propagation.test.ts │ │ └── plugin.test.ts │ ├── production/ │ │ └── index.test.ts │ ├── response/ │ │ ├── custom-response.test.ts │ │ ├── headers.test.ts │ │ ├── range.test.ts │ │ ├── redirect.test.ts │ │ ├── sse-double-wrap.test.ts │ │ ├── static.test.ts │ │ └── stream.test.ts │ ├── schema/ │ │ └── schema-utils.test.ts │ ├── standard-schema/ │ │ ├── reference.test.ts │ │ ├── standalone.test.ts │ │ └── validate.test.ts │ ├── sucrose/ │ │ ├── bracket-pair-range-reverse.test.ts │ │ ├── bracket-pair-range.test.ts │ │ ├── extract-main-parameter.test.ts │ │ ├── find-alias.test.ts │ │ ├── infer-body-reference.test.ts │ │ ├── integration.test.ts │ │ ├── query.test.ts │ │ ├── remove-colon-alias.test.ts │ │ ├── remove-default-parameter.test.ts │ │ ├── retrieve-root-parameters.test.ts │ │ ├── separate-function.test.ts │ │ └── sucrose.test.ts │ ├── timeout.ts │ ├── tracer/ │ │ ├── aot.test.ts │ │ ├── detail.test.ts │ │ ├── timing.test.ts │ │ └── trace.test.ts │ ├── type-system/ │ │ ├── array-buffer.test.ts │ │ ├── array-string.test.ts │ │ ├── boolean-string.test.ts │ │ ├── coercion-number.test.ts │ │ ├── date.test.ts │ │ ├── files.test.ts │ │ ├── form.test.ts │ │ ├── formdata.test.ts │ │ ├── import.ts │ │ ├── object-string.test.ts │ │ ├── string-format.test.ts │ │ ├── uint8array.test.ts │ │ └── union-enum.test.ts │ ├── types/ │ │ ├── async-modules.ts │ │ ├── documentation.ts │ │ ├── index.ts │ │ ├── lifecycle/ │ │ │ ├── derive.ts │ │ │ ├── resolve.ts │ │ │ └── soundness.ts │ │ ├── macro.ts │ │ ├── plugins.ts │ │ ├── schema-standalone.ts │ │ ├── standard-schema/ │ │ │ └── index.ts │ │ ├── type-system.ts │ │ └── utils.ts │ ├── units/ │ │ ├── class-to-object.test.ts │ │ ├── deduplicate-checksum.test.ts │ │ ├── get-schema-validator.test.ts │ │ ├── has-ref.test.ts │ │ ├── has-transform.test.ts │ │ ├── merge-deep.test.ts │ │ ├── merge-object-schemas.test.ts │ │ ├── numeric.test.ts │ │ └── replace-schema-type.test.ts │ ├── utils.d.ts │ ├── utils.ts │ ├── validator/ │ │ ├── body.test.ts │ │ ├── cookie.test.ts │ │ ├── encode.test.ts │ │ ├── exact-mirror.test.ts │ │ ├── header.test.ts │ │ ├── novalidate.test.ts │ │ ├── params.test.ts │ │ ├── query.test.ts │ │ ├── response-validation-nested.test.ts │ │ ├── response.test.ts │ │ ├── standalone.test.ts │ │ └── validator.test.ts │ └── ws/ │ ├── aot.test.ts │ ├── connection.test.ts │ ├── destructuring.test.ts │ ├── message.test.ts │ └── utils.ts ├── tsconfig.dts.json ├── tsconfig.json └── tsconfig.test.json
SYMBOL INDEX (1448 symbols across 92 files)
FILE: example/a.ts
method start (line 11) | async start(controller) {
FILE: example/derive.ts
method increase (line 6) | increase() {
FILE: example/error.ts
method error (line 14) | error({ error }) {
FILE: example/http.ts
method transform (line 60) | transform({ params }) {
FILE: example/native.ts
method error (line 6) | error(request) {
FILE: example/openapi.ts
method beforeHandle (line 27) | beforeHandle({ status }) {
method afterHandle (line 56) | afterHandle({ status }) {
method error (line 59) | error({ status }) {
FILE: example/schema.ts
method transform (line 56) | transform({ params }) {
FILE: example/websocket.ts
method open (line 6) | open(ws) {
method close (line 10) | close(ws) {
method message (line 13) | message(ws, message) {
FILE: src/adapter/bun/index.ts
type Routes (line 163) | type Routes = Record<string, Function | Response | Record<string, unknown>>
method listen (line 222) | listen(app) {
method stop (line 426) | async stop(app, closeActiveConnections) {
method ws (line 440) | ws(app, path, options) {
FILE: src/adapter/cloudflare-worker/index.ts
method error404 (line 28) | error404(hasEventHook, hasErrorHook, afterHandle) {
method beforeCompile (line 45) | beforeCompile(app) {
method listen (line 50) | listen() {
FILE: src/adapter/types.ts
type ElysiaAdapter (line 10) | interface ElysiaAdapter {
FILE: src/adapter/utils.ts
type CreateHandlerParameter (line 207) | interface CreateHandlerParameter {
method start (line 322) | start(controller) {
method pull (line 361) | async pull(controller) {
method cancel (line 407) | cancel() {
function mergeHeaders (line 458) | function mergeHeaders(
function mergeStatus (line 486) | function mergeStatus(
function tee (line 522) | async function tee<T>(
FILE: src/adapter/web-standard/index.ts
method json (line 28) | json(isOptional) {
method text (line 33) | text() {
method urlencoded (line 36) | urlencoded() {
method arrayBuffer (line 39) | arrayBuffer() {
method formData (line 42) | formData(isOptional) {
method stop (line 129) | async stop(app, closeActiveConnections) {
method createContext (line 146) | createContext(app) {
method error404 (line 193) | error404(hasEventHook, hasErrorHook, afterHandle = '') {
method listen (line 230) | listen() {
FILE: src/compose.ts
method resolveChild (line 101) | resolveChild() {
method resolve (line 104) | resolve() {}
method resolve (line 170) | resolve() {
method resolveChild (line 174) | resolveChild(name: string) {
function reportHandler (line 1806) | function reportHandler(name: string | undefined) {
type ComposerGeneralHandlerOptions (line 2270) | interface ComposerGeneralHandlerOptions {
FILE: src/context.ts
type InvertedStatusMapKey (line 19) | type InvertedStatusMapKey = keyof InvertedStatusMap
type CheckExcessProps (line 21) | type CheckExcessProps<T, U> = 0 extends 1 & T
type ErrorContext (line 29) | type ErrorContext<
type PrettifyIfObject (line 130) | type PrettifyIfObject<T> = T extends object ? Prettify<T> : T
type Context (line 132) | type Context<
type PreContext (line 232) | type PreContext<
FILE: src/cookies.ts
type CookieOptions (line 27) | interface CookieOptions {
type ElysiaCookie (line 139) | type ElysiaCookie = Prettify<
type Updater (line 145) | type Updater<T> = T | ((value: T) => T)
class Cookie (line 147) | class Cookie<T> implements ElysiaCookie {
method constructor (line 150) | constructor(
method cookie (line 156) | get cookie() {
method cookie (line 160) | set cookie(jar: ElysiaCookie) {
method setCookie (line 168) | protected get setCookie() {
method setCookie (line 174) | protected set setCookie(jar: ElysiaCookie) {
method value (line 178) | get value(): T {
method value (line 182) | set value(value: T) {
method expires (line 226) | get expires() {
method expires (line 230) | set expires(expires: Date | undefined) {
method maxAge (line 234) | get maxAge() {
method maxAge (line 238) | set maxAge(maxAge: number | undefined) {
method domain (line 242) | get domain() {
method domain (line 246) | set domain(domain: string | undefined) {
method path (line 250) | get path() {
method path (line 254) | set path(path: string | undefined) {
method secure (line 258) | get secure() {
method secure (line 262) | set secure(secure: boolean | undefined) {
method httpOnly (line 266) | get httpOnly() {
method httpOnly (line 270) | set httpOnly(httpOnly: boolean | undefined) {
method sameSite (line 274) | get sameSite() {
method sameSite (line 278) | set sameSite(
method priority (line 284) | get priority() {
method priority (line 288) | set priority(priority: 'low' | 'medium' | 'high' | undefined) {
method partitioned (line 292) | get partitioned() {
method partitioned (line 296) | set partitioned(partitioned: boolean | undefined) {
method secrets (line 300) | get secrets() {
method secrets (line 304) | set secrets(secrets: ElysiaCookie['secrets']) {
method update (line 308) | update(config: Updater<Partial<ElysiaCookie>>) {
method set (line 317) | set(config: Updater<Partial<ElysiaCookie>>) {
method remove (line 329) | remove() {
method toString (line 341) | toString() {
method get (line 356) | get(_, key: string) {
FILE: src/dynamic-handle.ts
type DynamicHandler (line 19) | type DynamicHandler = {
constant ARRAY_INDEX_REGEX (line 39) | const ARRAY_INDEX_REGEX = /^(.+)\[(\d+)\]$/
constant DANGEROUS_KEYS (line 40) | const DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])
FILE: src/error.ts
constant ERROR_CODE (line 21) | const ERROR_CODE = Symbol('ElysiaErrorCode')
type ERROR_CODE (line 22) | type ERROR_CODE = typeof ERROR_CODE
type ElysiaErrors (line 26) | type ElysiaErrors =
type CheckExcessProps (line 42) | type CheckExcessProps<T, U> = 0 extends 1 & T
type SelectiveStatus (line 52) | type SelectiveStatus<in out Res> = <
class ElysiaCustomStatusResponse (line 79) | class ElysiaCustomStatusResponse<
method constructor (line 90) | constructor(code: Code, response: T) {
class InternalServerError (line 120) | class InternalServerError extends Error {
method constructor (line 124) | constructor(message?: string) {
class NotFoundError (line 129) | class NotFoundError extends Error {
method constructor (line 133) | constructor(message?: string) {
class ParseError (line 138) | class ParseError extends Error {
method constructor (line 142) | constructor(cause?: Error) {
class InvalidCookieSignature (line 149) | class InvalidCookieSignature extends Error {
method constructor (line 153) | constructor(
type ValueErrorWithSummary (line 161) | interface ValueErrorWithSummary extends ValueError {
class InvalidFileType (line 239) | class InvalidFileType extends Error {
method constructor (line 243) | constructor(
method toResponse (line 253) | toResponse(headers?: Record<string, any>) {
class ValidationError (line 289) | class ValidationError extends Error {
method messageValue (line 304) | get messageValue() {
method constructor (line 318) | constructor(
method all (line 490) | get all(): ValueErrorWithSummary[] {
method simplifyModel (line 533) | static simplifyModel(
method model (line 546) | get model() {
method toResponse (line 552) | toResponse(headers?: Record<string, any>) {
method detail (line 582) | detail(
FILE: src/formats.ts
type FormatName (line 8) | type FormatName =
function isLeapYear (line 89) | function isLeapYear(year: number): boolean {
constant DATE (line 94) | const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/
constant DAYS (line 95) | const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
function date (line 97) | function date(str: string): boolean {
constant TIME (line 112) | const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))...
function getTime (line 114) | function getTime(strictTimeZone?: boolean): (str: string) => boolean {
constant DATE_TIME_SEPARATOR (line 138) | const DATE_TIME_SEPARATOR = /t|\s/i
function getDateTime (line 139) | function getDateTime(strictTimeZone?: boolean): (str: string) => boolean {
constant NOT_URI_FRAGMENT (line 149) | const NOT_URI_FRAGMENT = /\/|:/
constant URI (line 150) | const URI =
function uri (line 153) | function uri(str: string): boolean {
constant BYTE (line 158) | const BYTE =
function byte (line 161) | function byte(str: string): boolean {
constant MIN_INT32 (line 166) | const MIN_INT32 = -(2 ** 31)
constant MAX_INT32 (line 167) | const MAX_INT32 = 2 ** 31 - 1
function validateInt32 (line 169) | function validateInt32(value: number): boolean {
function validateInt64 (line 173) | function validateInt64(value: number): boolean {
function validateNumber (line 178) | function validateNumber(): boolean {
constant Z_ANCHOR (line 182) | const Z_ANCHOR = /[^\\]\\Z/
function regex (line 183) | function regex(str: string): boolean {
FILE: src/index.ts
type AnyElysia (line 174) | type AnyElysia = Elysia<any, any, any, any, any, any, any>
class Elysia (line 190) | class Elysia<
method store (line 248) | get store(): Singleton['store'] {
method decorator (line 252) | get decorator(): Singleton['decorator'] {
method getCandidate (line 271) | getCandidate() {
method http (line 305) | get http() {
method dynamic (line 316) | get dynamic() {
method routes (line 333) | get routes(): InternalRoute[] {
method getGlobalRoutes (line 337) | protected getGlobalRoutes(): InternalRoute[] {
method getGlobalDefinitions (line 341) | protected getGlobalDefinitions() {
method getServer (line 357) | private getServer() {
method getParent (line 361) | private getParent(): Elysia | null {
method promisedModules (line 368) | private get promisedModules() {
method constructor (line 377) | constructor(config: ElysiaConfig<BasePath> = {}) {
method env (line 417) | env(model: TObject, _env = env) {
method wrap (line 442) | wrap(fn: HigherOrderFunction) {
method models (line 457) | get models(): {
method add (line 482) | private add(
method headers (line 1102) | headers(header: Context['set']['headers'] | undefined) {
method onStart (line 1126) | onStart(handler: MaybeArray<GracefulHandler<this>>) {
method onRequest (line 1240) | onRequest(handler: MaybeArray<Handler>): any {
method onParse (line 1365) | onParse(
method parser (line 1402) | parser<
method onTransform (line 1539) | onTransform(
method resolve (line 1737) | resolve(
method mapResolve (line 1900) | mapResolve(
method onBeforeHandle (line 2283) | onBeforeHandle(
method onAfterHandle (line 2648) | onAfterHandle(
method mapResponse (line 2762) | mapResponse(
method onAfterResponse (line 2875) | onAfterResponse(
method trace (line 2945) | trace(
method error (line 3092) | error(
method onError (line 3514) | onError(
method onStop (line 3540) | onStop(handler: MaybeArray<GracefulHandler<this>>) {
method on (line 3591) | on(
method as (line 3802) | as(type: 'global' | 'scoped') {
method group (line 3998) | group(
method guard (line 4519) | guard(
method use (line 4978) | use(
method propagatePromiseModules (line 5050) | private propagatePromiseModules(plugin: Elysia) {
method _use (line 5072) | private _use(
method macro (line 5501) | macro(macroOrName: string | Macro, macro?: Macro) {
method applyMacro (line 5516) | private applyMacro(
method mount (line 5628) | mount(
method get (line 5747) | get<
method post (line 5857) | post<
method put (line 5966) | put<
method patch (line 6075) | patch<
method delete (line 6182) | delete<
method options (line 6289) | options<
method all (line 6396) | all<
method head (line 6503) | head<
method connect (line 6610) | connect<
method route (line 6717) | route<
method ws (line 6832) | ws<
method state (line 7091) | state(
method decorate (line 7347) | decorate(
method derive (line 7625) | derive(
method model (line 7710) | model(
method Ref (line 7797) | Ref<K extends keyof Extract<Definitions['typebox'], TAnySchema> & stri...
method mapDerive (line 7939) | mapDerive(
method affix (line 7956) | affix<
method prefix (line 8080) | prefix<
method suffix (line 8087) | suffix<
method compile (line 8094) | compile() {
method fetch (line 8132) | get fetch(): (request: Request) => MaybePromise<Response> {
method modules (line 8240) | get modules() {
FILE: src/parse-query.ts
constant KEY_HAS_PLUS (line 4) | const KEY_HAS_PLUS = 1
constant KEY_NEEDS_DECODE (line 5) | const KEY_NEEDS_DECODE = 2
constant VALUE_HAS_PLUS (line 6) | const VALUE_HAS_PLUS = 4
constant VALUE_NEEDS_DECODE (line 7) | const VALUE_NEEDS_DECODE = 8
function parseQueryFromURL (line 10) | function parseQueryFromURL(
function parseQueryStandardSchema (line 121) | function parseQueryStandardSchema(
function parseQuery (line 245) | function parseQuery(input: string) {
FILE: src/replace-schema.ts
type ReplaceSchemaTypeOptions (line 5) | interface ReplaceSchemaTypeOptions {
type WalkProps (line 66) | type WalkProps = { s: TSchema; isRoot: boolean; treeLvl: number };
FILE: src/schema.ts
type MapValueError (line 43) | type MapValueError = ReturnType<typeof mapValueError>
type ElysiaTypeCheck (line 45) | interface ElysiaTypeCheck<T extends AnySchema>
function Check (line 609) | function Check(
function runCheckers (line 626) | function runCheckers(
function mergeValues (line 657) | function mergeValues(
method to (line 771) | to(schema) {
method hasAdditionalProperties (line 798) | get hasAdditionalProperties() {
method hasDefault (line 805) | get hasDefault() {
method isOptional (line 813) | get isOptional() {
method hasTransform (line 818) | get hasTransform() {
method hasRef (line 824) | get hasRef() {
method Errors (line 895) | Errors(value: unknown) {
method Decode (line 908) | Decode(value) {
method checkFunc (line 1000) | checkFunc(value: unknown) {
method Errors (line 1015) | Errors(value: unknown) {
method Decode (line 1028) | Decode(value) {
method hasAdditionalProperties (line 1078) | get hasAdditionalProperties() {
method hasDefault (line 1085) | get hasDefault() {
method isOptional (line 1090) | get isOptional() {
method hasTransform (line 1095) | get hasTransform() {
method hasRef (line 1100) | get hasRef() {
FILE: src/sucrose.ts
type Inference (line 9) | interface Inference {
type LifeCycle (line 21) | interface LifeCycle extends Partial<LifeCycleStore> {
type Settings (line 25) | interface Settings {
FILE: src/trace.ts
type TraceEvent (line 6) | type TraceEvent =
type TraceStream (line 17) | type TraceStream = {
type TraceEndDetail (line 26) | type TraceEndDetail = {
type TraceProcess (line 41) | type TraceProcess<
type TraceListener (line 107) | type TraceListener = (
type TraceHandler (line 111) | type TraceHandler<
constant ELYSIA_TRACE (line 136) | const ELYSIA_TRACE = Symbol('ElysiaTrace')
method onStop (line 183) | onStop(callback?: Function) {
method elapsed (line 203) | get elapsed() {
method onEvent (line 221) | onEvent(callback?: Function) {
method onStop (line 225) | onStop(callback?: Function) {
method resolve (line 237) | resolve(error: Error | null = null) {
FILE: src/type-system/format.ts
type FormatName (line 10) | type FormatName =
function isLeapYear (line 91) | function isLeapYear(year: number): boolean {
constant DATE (line 96) | const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/
constant DAYS (line 97) | const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
function date (line 99) | function date(str: string): boolean {
constant TIME (line 114) | const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))...
function getTime (line 116) | function getTime(strictTimeZone?: boolean): (str: string) => boolean {
constant DATE_TIME_SEPARATOR (line 147) | const DATE_TIME_SEPARATOR = /t|\s/i
function getDateTime (line 148) | function getDateTime(strictTimeZone?: boolean): (str: string) => boolean {
constant NOT_URI_FRAGMENT (line 159) | const NOT_URI_FRAGMENT = /\/|:/
constant URI (line 160) | const URI =
function uri (line 163) | function uri(str: string): boolean {
constant BYTE (line 168) | const BYTE =
function byte (line 171) | function byte(str: string): boolean {
constant MIN_INT32 (line 176) | const MIN_INT32 = -(2 ** 31)
constant MAX_INT32 (line 177) | const MAX_INT32 = 2 ** 31 - 1
function validateInt32 (line 179) | function validateInt32(value: number): boolean {
function validateInt64 (line 183) | function validateInt64(value: number): boolean {
function validateNumber (line 188) | function validateNumber(): boolean {
constant Z_ANCHOR (line 192) | const Z_ANCHOR = /[^\\]\\Z/
function regex (line 193) | function regex(str: string): boolean {
FILE: src/type-system/index.ts
type ElysiaStringOptions (line 111) | interface ElysiaStringOptions extends StringOptions {
method NumericEnum (line 156) | NumericEnum<T extends AssertNumericEnum<T>>(
method ArrayBuffer (line 601) | ArrayBuffer(options: TArrayBuffer = {}) {
FILE: src/type-system/types.ts
type FileUnit (line 20) | type FileUnit = number | `${number}${'k' | 'm'}`
type StrictFileType (line 22) | type StrictFileType =
type FileType (line 78) | type FileType = (string & {}) | StrictFileType
type FileOptions (line 80) | interface FileOptions extends SchemaOptions {
type FilesOptions (line 96) | interface FilesOptions extends FileOptions {
type CookieValidatorOptions (line 101) | interface CookieValidatorOptions<T extends Object = {}>
type TFile (line 119) | type TFile = (
type TFiles (line 123) | type TFiles = (
type NonEmptyArray (line 127) | type NonEmptyArray<T> = [T, ...T[]]
type TEnumValue (line 129) | type TEnumValue = number | string | null
type TUnionEnum (line 131) | interface TUnionEnum<
type TArrayBuffer (line 142) | interface TArrayBuffer extends Uint8ArrayOptions {}
type TForm (line 144) | type TForm<T extends TProperties = TProperties> = TUnsafe<
type ElysiaTypeCustomErrors (line 167) | interface ElysiaTypeCustomErrors {
type ElysiaTypeCustomError (line 176) | type ElysiaTypeCustomError = ElysiaTypeCustomErrors[keyof ElysiaTypeCust...
type ElysiaTypeCustomErrorCallback (line 178) | type ElysiaTypeCustomErrorCallback = (
type SchemaOptions (line 223) | interface SchemaOptions {
class ElysiaTransformDecodeBuilder (line 228) | class ElysiaTransformDecodeBuilder<T extends TSchema> {
class ElysiaTransformEncodeBuilder (line 235) | class ElysiaTransformEncodeBuilder<
type TransformFunction (line 248) | type TransformFunction<T = any, U = any> = (value: T) => U
type TransformOptions (line 249) | interface TransformOptions<
type TTransform (line 256) | interface TTransform<
type AssertNumericEnum (line 265) | type AssertNumericEnum<T extends Record<string, string | number>> = {
FILE: src/type-system/utils.ts
function createType (line 29) | function createType<TSchema = unknown, TReturn = unknown>(
FILE: src/types.ts
type Equal (line 43) | type Equal<X, Y> =
type IsNever (line 48) | type IsNever<T> = [T] extends [never] ? true : false
type PickIfExists (line 50) | type PickIfExists<T, K extends string> = {} extends T
type StandardSchemaV1Like (line 58) | interface StandardSchemaV1Like<
type FastStandardSchemaV1Like (line 73) | interface FastStandardSchemaV1Like {
type StandardSchemaV1LikeValidate (line 77) | type StandardSchemaV1LikeValidate = <T>(
type AnySchema (line 83) | type AnySchema = TSchema | StandardSchemaV1Like
type FastAnySchema (line 84) | type FastAnySchema = TAnySchema | FastStandardSchemaV1Like
type ElysiaConfig (line 86) | interface ElysiaConfig<in out Prefix extends string | undefined> {
type ValidatorLayer (line 260) | interface ValidatorLayer {
type StandaloneInputSchema (line 267) | interface StandaloneInputSchema<Name extends string = string> {
type StandaloneValidator (line 278) | interface StandaloneValidator {
type MaybeArray (line 284) | type MaybeArray<T> = T | T[]
type MaybeReadonlyArray (line 285) | type MaybeReadonlyArray<T> = T | readonly T[]
type MaybePromise (line 286) | type MaybePromise<T> = T | Promise<T>
type ObjectValues (line 288) | type ObjectValues<T extends object> = T[keyof T]
type IsPathParameter (line 290) | type IsPathParameter<Part extends string> = Part extends `:${infer Param...
type GetPathParameter (line 296) | type GetPathParameter<Path extends string> =
type _ResolvePath (line 301) | type _ResolvePath<Path extends string> = {
type ResolvePath (line 311) | type ResolvePath<Path extends string> = Path extends ''
type Or (line 317) | type Or<T1 extends boolean, T2 extends boolean> = T1 extends true
type Prettify (line 324) | type Prettify<in out T> = {
type NeverKey (line 328) | type NeverKey<in out T> = {
type IsBothObject (line 332) | type IsBothObject<A, B> =
type IsClass (line 343) | type IsClass<V> = V extends abstract new (...args: any) => any ? true : ...
type And (line 344) | type And<A, B> = A extends true ? (B extends true ? true : false) : false
type Reconcile (line 346) | type Reconcile<
type SingletonBase (line 409) | interface SingletonBase {
type PossibleResponse (line 416) | interface PossibleResponse {
type EphemeralType (line 420) | interface EphemeralType {
type DefinitionBase (line 428) | interface DefinitionBase {
type RouteBase (line 433) | type RouteBase = Record<string, unknown>
type MetadataBase (line 435) | interface MetadataBase {
type RouteSchema (line 444) | interface RouteSchema {
type OptionalField (line 453) | interface OptionalField {
type UnwrapSchema (line 457) | type UnwrapSchema<
type UnwrapBodySchema (line 497) | type UnwrapBodySchema<
type UnwrapRoute (line 538) | interface UnwrapRoute<
type UnwrapGroupGuardRoute (line 579) | interface UnwrapGroupGuardRoute<
type HookContainer (line 617) | type HookContainer<T extends Function = Function> = {
type LifeCycleStore (line 626) | interface LifeCycleStore {
type LifeCycleEvent (line 641) | type LifeCycleEvent =
type ContentType (line 652) | type ContentType = MaybeArray<
type HTTPMethod (line 666) | type HTTPMethod =
type InputSchema (line 704) | interface InputSchema<in out Name extends string = string> {
type PathParameterLike (line 719) | type PathParameterLike = `${string}/${':' | '*'}${string}`
type IntersectIfObject (line 721) | type IntersectIfObject<A, B> =
type IntersectIfObjectSchema (line 730) | interface IntersectIfObjectSchema<
type MergeSchema (line 742) | type MergeSchema<
type MergeStandaloneSchema (line 783) | interface MergeStandaloneSchema<
type Handler (line 832) | type Handler<
type IsAny (line 849) | type IsAny<T> = 0 extends 1 & T ? true : false
type Replace (line 851) | type Replace<Original, Target, With> =
type CoExist (line 864) | type CoExist<Original, Target, With> =
type MacroContextBlacklistKey (line 878) | type MacroContextBlacklistKey =
type ReturnTypeIfPossible (line 892) | type ReturnTypeIfPossible<T, Enabled = true> = false extends Enabled
type AnyElysiaCustomStatusResponse (line 898) | type AnyElysiaCustomStatusResponse = ElysiaCustomStatusResponse<any, any...
type FunctionArrayReturnType (line 900) | type FunctionArrayReturnType<T> =
type _FunctionArrayReturnType (line 909) | type _FunctionArrayReturnType<T, Carry = undefined> = T extends [
type FunctionArrayReturnTypeNonNullable (line 926) | type FunctionArrayReturnTypeNonNullable<T> =
type _FunctionArrayReturnTypeNonNullable (line 935) | type _FunctionArrayReturnTypeNonNullable<T, Carry = undefined> = T exten...
type ExtractResolveFromMacro (line 954) | type ExtractResolveFromMacro<A> =
type ExtractOnlyResponseFromMacro (line 965) | type ExtractOnlyResponseFromMacro<A> =
type MergeResponseStatus (line 976) | type MergeResponseStatus<A> = {
type MergeAllStatus (line 991) | type MergeAllStatus<T> = {
type ExtractAllResponseFromMacro (line 997) | type ExtractAllResponseFromMacro<A> =
type FlattenMacroResponse (line 1019) | type FlattenMacroResponse<T> = T extends object
type MergeFlattenMacroResponse (line 1028) | type MergeFlattenMacroResponse<A, B> = {
type UnionMacroContext (line 1037) | type UnionMacroContext<A> = UnionToIntersect<{
type MacroToContext (line 1044) | type MacroToContext<
type InnerMacroToContext (line 1066) | type InnerMacroToContext<
type UnwrapMacroSchema (line 1135) | type UnwrapMacroSchema<
type SimplifyToSchema (line 1150) | type SimplifyToSchema<T extends InputSchema<any>> =
type _SimplifyToSchema (line 1165) | type _SimplifyToSchema<T extends InputSchema<any>> = Omit<
type InlineHandlerResponse (line 1182) | type InlineHandlerResponse<Route extends RouteSchema['response']> = {
type InlineResponse (line 1191) | type InlineResponse =
type LastOf (line 1202) | type LastOf<T> =
type Push (line 1207) | type Push<T extends any[], V> = [...T, V]
type TuplifyUnion (line 1209) | type TuplifyUnion<
type Tuple (line 1215) | type Tuple<
type InlineHandler (line 1220) | type InlineHandler<
type InlineHandlerNonMacro (line 1275) | type InlineHandlerNonMacro<
type OptionalHandler (line 1313) | type OptionalHandler<
type AfterHandler (line 1333) | type AfterHandler<
type MapResponse (line 1363) | type MapResponse<
type VoidHandler (line 1396) | type VoidHandler<
type TransformHandler (line 1406) | type TransformHandler<
type BodyHandler (line 1425) | type BodyHandler<
type PreHandler (line 1461) | type PreHandler<
type AfterResponseHandler (line 1475) | type AfterResponseHandler<
type GracefulHandler (line 1499) | type GracefulHandler<in Instance extends AnyElysia> = (
type ErrorHandler (line 1503) | type ErrorHandler<
type DocumentDecoration (line 1680) | interface DocumentDecoration extends Partial<OpenAPIV3.OperationObject> {
type ResolveHandler (line 1687) | type ResolveHandler<
type ResolveReturnType (line 1696) | type ResolveReturnType<T extends MaybeArray<unknown>> =
type _ResolveReturnTypeArray (line 1712) | type _ResolveReturnTypeArray<T, Carry = {}> = T extends [
type AnyLocalHook (line 1725) | type AnyLocalHook = LocalHook<any, any, any, any, any>
type BaseHookLifeCycle (line 1727) | interface BaseHookLifeCycle<
type CreateDecorator (line 1773) | type CreateDecorator<
type AnyBaseHookLifeCycle (line 1785) | type AnyBaseHookLifeCycle = BaseHookLifeCycle<any, any, any, any>
type NonResolvableMacroKey (line 1787) | type NonResolvableMacroKey =
type RouteSchemaWithResolvedMacro (line 1792) | interface RouteSchemaWithResolvedMacro extends RouteSchema {
type LocalHook (line 1798) | type LocalHook<
type GuardLocalHook (line 1861) | type GuardLocalHook<
type ComposedHandler (line 1922) | type ComposedHandler = (context: Context) => MaybePromise<Response>
type InternalRoute (line 1924) | interface InternalRoute {
type SchemaValidator (line 1934) | interface SchemaValidator {
type AddPrefix (line 1949) | type AddPrefix<in out Prefix extends string, in out T> = {
type AddPrefixCapitalize (line 1953) | type AddPrefixCapitalize<in out Prefix extends string, in out T> = {
type AddSuffix (line 1957) | type AddSuffix<in out Suffix extends string, in out T> = {
type AddSuffixCapitalize (line 1961) | type AddSuffixCapitalize<in out Suffix extends string, in out T> = {
type Checksum (line 1965) | interface Checksum {
type BaseMacro (line 1985) | type BaseMacro = Record<
type MaybeValueOrVoidFunction (line 1990) | type MaybeValueOrVoidFunction<T> = T | ((...a: any) => void | T)
type MacroProperty (line 1992) | interface MacroProperty<
type Macro (line 2024) | interface Macro<
type MaybeFunction (line 2041) | type MaybeFunction<T> = T | ((...args: any[]) => T)
type MacroToProperty (line 2043) | type MacroToProperty<in out T extends Macro<any, any, any, any>> =
type MacroOptions (line 2052) | interface MacroOptions {
type MacroManager (line 2057) | interface MacroManager<
type _CreateEden (line 2130) | type _CreateEden<
type RemoveStartingSlash (line 2143) | type RemoveStartingSlash<T> = T extends `/${infer Rest}` ? Rest : T
type CreateEden (line 2145) | type CreateEden<
type EmptyRouteSchema (line 2154) | interface EmptyRouteSchema {
type UnknownRouteSchema (line 2163) | interface UnknownRouteSchema<
type Extract200 (line 2174) | type Extract200<T> = T extends AnyElysiaCustomStatusResponse
type IsUnknown (line 2180) | type IsUnknown<T> = [unknown] extends [T]
type ValueToResponseSchema (line 2186) | type ValueToResponseSchema<Value> = ExtractErrorFromHandle<Value> &
type ValueOrFunctionToResponseSchema (line 2195) | type ValueOrFunctionToResponseSchema<T> = T extends (
type ElysiaHandlerToResponseSchema (line 2201) | type ElysiaHandlerToResponseSchema<in out Handle extends Function> =
type ElysiaHandlerToResponseSchemas (line 2208) | type ElysiaHandlerToResponseSchemas<
type ElysiaHandlerToResponseSchemaAmbiguous (line 2220) | type ElysiaHandlerToResponseSchemaAmbiguous<
type ReconcileStatus (line 2231) | type ReconcileStatus<
type ComposeElysiaResponse (line 2239) | type ComposeElysiaResponse<
type ExtractErrorFromHandle (line 2265) | type ExtractErrorFromHandle<in out Handle> = {
type MergeElysiaInstances (line 2274) | type MergeElysiaInstances<
type LifeCycleType (line 2342) | type LifeCycleType = 'global' | 'local' | 'scoped'
type GuardSchemaType (line 2343) | type GuardSchemaType = 'override' | 'standalone'
type PartialIf (line 2345) | type PartialIf<T, Condition extends boolean> = Condition extends true
type ExcludeElysiaResponse (line 2350) | type ExcludeElysiaResponse<T> = PartialIf<
type InferContext (line 2363) | type InferContext<
type InferHandler (line 2379) | type InferHandler<
type ModelValidatorError (line 2391) | interface ModelValidatorError extends ValueError {
type ModelValidator (line 2396) | interface ModelValidator<T> extends TypeCheck<T> {
type UnionToIntersect (line 2409) | type UnionToIntersect<U> = (
type ContextAppendType (line 2415) | type ContextAppendType = 'append' | 'override'
type HigherOrderFunction (line 2421) | type HigherOrderFunction<
type SetContentType (line 2425) | type SetContentType =
type HTTPHeaders (line 2485) | type HTTPHeaders = Record<string, string | number> & {
type JoinPath (line 2622) | type JoinPath<
type UnwrapTypeModule (line 2627) | type UnwrapTypeModule<Module extends TModule<any, any>> =
type MergeTypeModule (line 2630) | type MergeTypeModule<
type SSEPayload (line 2635) | type SSEPayload<
type UnionResponseStatus (line 2649) | type UnionResponseStatus<A, B> = {} extends A
type CreateEdenResponse (line 2663) | type CreateEdenResponse<
type Router (line 2691) | interface Router {
type ModelsToTypes (line 2715) | type ModelsToTypes<T extends Record<keyof any, AnySchema>> = {
FILE: src/universal/file.ts
class ElysiaFile (line 99) | class ElysiaFile {
method constructor (line 103) | constructor(public path: string) {
method type (line 156) | get type() {
method length (line 163) | get length() {
FILE: src/universal/request.ts
class ElysiaRequest (line 14) | class ElysiaRequest implements WebStandardRequest {
method constructor (line 15) | constructor(
method headers (line 48) | get headers() {
method signal (line 73) | get signal() {
method body (line 81) | get body(): ReadableStream | null {
method arrayBuffer (line 146) | async arrayBuffer() {
method blob (line 157) | async blob() {
method formData (line 164) | async formData() {
method json (line 170) | async json() {
method text (line 183) | async text() {
method clone (line 197) | clone(): ElysiaRequest {
function readableStreamToString (line 202) | async function readableStreamToString(stream: ReadableStream) {
FILE: src/universal/server.ts
type ErrorLike (line 4) | interface ErrorLike extends Error {
type GenericServeOptions (line 10) | interface GenericServeOptions {
type ServeOptions (line 66) | interface ServeOptions extends GenericServeOptions {
type Serve (line 125) | type Serve =
type Server (line 129) | type Server =
type ServerWebSocketSendStatus (line 134) | type ServerWebSocketSendStatus = number
type SocketAddress (line 136) | interface SocketAddress {
type ServerOptions (line 151) | interface ServerOptions extends Disposable {
type ListenCallback (line 376) | type ListenCallback = (server: Server) => MaybePromise<void>
FILE: src/universal/types.ts
type RequestInfo (line 4) | type RequestInfo = string | URL | Request
type BodyInit (line 11) | type BodyInit =
type BodyMixin (line 22) | interface BodyMixin {
type SpecIterator (line 33) | interface SpecIterator<T, TReturn = any, TNext = undefined> {
type SpecIterableIterator (line 37) | interface SpecIterableIterator<T> extends SpecIterator<T> {
type SpecIterable (line 41) | interface SpecIterable<T> {
type HeadersInit (line 45) | type HeadersInit =
class Headers (line 50) | class Headers implements SpecIterable<[string, string]> {
type RequestCache (line 69) | type RequestCache =
type RequestCredentials (line 77) | type RequestCredentials = 'omit' | 'include' | 'same-origin'
type RequestDestination (line 79) | type RequestDestination =
type RequestInit (line 99) | interface RequestInit {
type ReferrerPolicy (line 116) | type ReferrerPolicy =
type RequestMode (line 127) | type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
type RequestRedirect (line 129) | type RequestRedirect = 'error' | 'follow' | 'manual'
type RequestDuplex (line 131) | type RequestDuplex = 'half'
type ResponseInit (line 161) | interface ResponseInit {
type ResponseType (line 167) | type ResponseType =
type ResponseRedirectStatus (line 175) | type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
method constructor (line 178) | constructor(body?: BodyInit, init?: ResponseInit) {}
method error (line 199) | static error() {
method json (line 202) | static json(data: any, init?: ResponseInit) {
method redirect (line 205) | static redirect(url: string, status: ResponseRedirectStatus) {
type BunHTMLBundlelike (line 210) | interface BunHTMLBundlelike {
FILE: src/universal/utils.ts
function isCloudflareWorker (line 6) | function isCloudflareWorker() {
FILE: src/utils.ts
type RecordNumber (line 188) | type RecordNumber = Record<number, any>
type StatusMap (line 642) | type StatusMap = typeof StatusMap
type InvertedStatusMap (line 643) | type InvertedStatusMap = typeof InvertedStatusMap
function removeTrailingEquals (line 645) | function removeTrailingEquals(digest: string): string {
class PromiseGroup (line 773) | class PromiseGroup implements PromiseLike<void> {
method constructor (line 777) | constructor(
method size (line 785) | get size() {
method add (line 793) | add<T>(promise: Promise<T>) {
method drain (line 801) | private async drain() {
method then (line 814) | then<TResult1 = void, TResult2 = never>(
type redirect (line 916) | type redirect = typeof redirect
constant ELYSIA_FORM_DATA (line 918) | const ELYSIA_FORM_DATA = Symbol('ElysiaFormData')
type ELYSIA_FORM_DATA (line 919) | type ELYSIA_FORM_DATA = typeof ELYSIA_FORM_DATA
type IsTuple (line 921) | type IsTuple<T> = T extends readonly any[]
type ElysiaFormData (line 927) | type ElysiaFormData<T extends Record<keyof any, unknown>> = FormData & {
constant ELYSIA_REQUEST_ID (line 940) | const ELYSIA_REQUEST_ID = Symbol('ElysiaRequestId')
type ELYSIA_REQUEST_ID (line 941) | type ELYSIA_REQUEST_ID = typeof ELYSIA_REQUEST_ID
type FormatSSEPayload (line 1141) | type FormatSSEPayload<T = unknown> = T extends string
function getResponseLength (line 1221) | async function getResponseLength(response: Response) {
function deepClone (line 1245) | function deepClone<T>(source: T, weak = new WeakMap<object, any>()): T {
FILE: src/ws/bun.ts
type TypedArray (line 3) | type TypedArray =
type BufferSource (line 16) | type BufferSource = TypedArray | DataView | ArrayBufferLike
type ServerWebSocketSendStatus (line 37) | type ServerWebSocketSendStatus = number
type WebSocketReadyState (line 49) | type WebSocketReadyState = 0 | 1 | 2 | 3
type ServerWebSocket (line 82) | interface ServerWebSocket<T = undefined> {
type WebSocketCompressor (line 332) | type WebSocketCompressor =
type WebSocketHandler (line 384) | interface WebSocketHandler<in out T = undefined> {
FILE: src/ws/index.ts
method open (line 19) | open(ws) {
method message (line 22) | message(ws, message) {
method drain (line 25) | drain(ws) {
method close (line 28) | close(ws, code, reason) {
method ping (line 31) | ping(ws) {
method pong (line 34) | pong(ws) {
type ElysiaServerWebSocket (line 39) | type ElysiaServerWebSocket = Omit<
class ElysiaWS (line 44) | class ElysiaWS<Context = unknown, Route extends RouteSchema = {}>
method constructor (line 47) | constructor(
method send (line 90) | send(
method ping (line 112) | ping(
method pong (line 133) | pong(
method publish (line 160) | publish(
method readyState (line 196) | get readyState() {
method id (line 205) | get id(): string {
FILE: src/ws/types.ts
type TypedWebSocketMethod (line 26) | type TypedWebSocketMethod =
type FlattenResponse (line 34) | type FlattenResponse<Response extends RouteSchema['response']> =
type TypedWebSocketHandler (line 37) | interface TypedWebSocketHandler<
type WSParseHandler (line 121) | type WSParseHandler<Route extends RouteSchema, Context = {}> = (
type AnyWSLocalHook (line 126) | type AnyWSLocalHook = WSLocalHook<any, any, any>
type WSLocalHook (line 128) | type WSLocalHook<
FILE: test/adapter/web-standard/map-compact-response.test.ts
class Student (line 7) | class Student {
method constructor (line 8) | constructor(public name: string) {}
method toString (line 10) | toString() {
class CustomResponse (line 17) | class CustomResponse extends Response {}
class CustomThenable (line 210) | class CustomThenable {
method then (line 211) | then(onFulfilled: (value: any) => any) {
FILE: test/adapter/web-standard/map-early-response.test.ts
class Student (line 22) | class Student {
method constructor (line 23) | constructor(public name: string) {}
method toString (line 25) | toString() {
class CustomResponse (line 32) | class CustomResponse extends Response {}
FILE: test/adapter/web-standard/map-response.test.ts
class Student (line 15) | class Student {
method constructor (line 16) | constructor(public name: string) {}
method toString (line 18) | toString() {
class CustomResponse (line 25) | class CustomResponse extends Response {}
method beforeHandle (line 419) | beforeHandle() {
method beforeHandle (line 435) | beforeHandle() {
FILE: test/adapter/web-standard/utils.ts
class Passthrough (line 1) | class Passthrough {
method toResponse (line 2) | toResponse() {
method custom (line 6) | get custom() {
FILE: test/aot/generation.test.ts
method transform (line 44) | transform({ body }) {
method beforeHandle (line 49) | beforeHandle({ body }) {
method afterHandle (line 54) | afterHandle({ body }) {
method beforeHandle (line 94) | beforeHandle(context) {
method afterHandle (line 99) | afterHandle(context) {
FILE: test/cloudflare/worker-configuration.d.ts
type GlobalProps (line 5) | interface GlobalProps {
type Env (line 8) | interface Env {
type Env (line 11) | interface Env extends Cloudflare.Env {}
class DOMException (line 36) | class DOMException extends Error {
type WorkerGlobalScopeEventMap (line 76) | type WorkerGlobalScopeEventMap = {
type Console (line 87) | interface Console {
type BufferSource (line 128) | type BufferSource = ArrayBufferView | ArrayBuffer;
type TypedArray (line 129) | type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Arra...
class CompileError (line 131) | class CompileError extends Error {
class RuntimeError (line 134) | class RuntimeError extends Error {
type ValueType (line 137) | type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"...
type GlobalDescriptor (line 138) | interface GlobalDescriptor {
class Global (line 142) | class Global {
type ImportValue (line 147) | type ImportValue = ExportValue | number;
type ModuleImports (line 148) | type ModuleImports = Record<string, ImportValue>;
type Imports (line 149) | type Imports = Record<string, ModuleImports>;
type ExportValue (line 150) | type ExportValue = Function | Global | Memory | Table;
type Exports (line 151) | type Exports = Record<string, ExportValue>;
class Instance (line 152) | class Instance {
type MemoryDescriptor (line 156) | interface MemoryDescriptor {
class Memory (line 161) | class Memory {
type ImportExportKind (line 166) | type ImportExportKind = "function" | "global" | "memory" | "table";
type ModuleExportDescriptor (line 167) | interface ModuleExportDescriptor {
type ModuleImportDescriptor (line 171) | interface ModuleImportDescriptor {
type TableKind (line 181) | type TableKind = "anyfunc" | "externref";
type TableDescriptor (line 182) | interface TableDescriptor {
class Table (line 187) | class Table {
type ServiceWorkerGlobalScope (line 203) | interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
type TestController (line 343) | interface TestController {
type ExecutionContext (line 345) | interface ExecutionContext<Props = unknown> {
type ExportedHandlerFetchHandler (line 350) | type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown...
type ExportedHandlerTailHandler (line 351) | type ExportedHandlerTailHandler<Env = unknown> = (events: TraceItem[], e...
type ExportedHandlerTraceHandler (line 352) | type ExportedHandlerTraceHandler<Env = unknown> = (traces: TraceItem[], ...
type ExportedHandlerTailStreamHandler (line 353) | type ExportedHandlerTailStreamHandler<Env = unknown> = (event: TailStrea...
type ExportedHandlerScheduledHandler (line 354) | type ExportedHandlerScheduledHandler<Env = unknown> = (controller: Sched...
type ExportedHandlerQueueHandler (line 355) | type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (ba...
type ExportedHandlerTestHandler (line 356) | type ExportedHandlerTestHandler<Env = unknown> = (controller: TestContro...
type ExportedHandler (line 357) | interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, ...
type StructuredSerializeOptions (line 367) | interface StructuredSerializeOptions {
type AlarmInvocationInfo (line 384) | interface AlarmInvocationInfo {
type Cloudflare (line 388) | interface Cloudflare {
type DurableObject (line 391) | interface DurableObject {
type DurableObjectStub (line 398) | type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = ...
type DurableObjectId (line 402) | interface DurableObjectId {
type DurableObjectJurisdiction (line 415) | type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectNamespaceNewUniqueIdOptions (line 416) | interface DurableObjectNamespaceNewUniqueIdOptions {
type DurableObjectLocationHint (line 419) | type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeu...
type DurableObjectNamespaceGetDurableObjectOptions (line 420) | interface DurableObjectNamespaceGetDurableObjectOptions {
type DurableObjectClass (line 423) | interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undef...
type DurableObjectState (line 425) | interface DurableObjectState<Props = unknown> {
type DurableObjectTransaction (line 442) | interface DurableObjectTransaction {
type DurableObjectStorage (line 455) | interface DurableObjectStorage {
type DurableObjectListOptions (line 476) | interface DurableObjectListOptions {
type DurableObjectGetOptions (line 486) | interface DurableObjectGetOptions {
type DurableObjectGetAlarmOptions (line 490) | interface DurableObjectGetAlarmOptions {
type DurableObjectPutOptions (line 493) | interface DurableObjectPutOptions {
type DurableObjectSetAlarmOptions (line 498) | interface DurableObjectSetAlarmOptions {
class WebSocketRequestResponsePair (line 502) | class WebSocketRequestResponsePair {
type AnalyticsEngineDataset (line 507) | interface AnalyticsEngineDataset {
type AnalyticsEngineDataPoint (line 510) | interface AnalyticsEngineDataPoint {
class Event (line 520) | class Event {
type EventInit (line 635) | interface EventInit {
type EventListener (line 640) | type EventListener<EventType extends Event = Event> = (event: EventType)...
type EventListenerObject (line 641) | interface EventListenerObject<EventType extends Event = Event> {
type EventListenerOrEventListenerObject (line 644) | type EventListenerOrEventListenerObject<EventType extends Event = Event>...
class EventTarget (line 650) | class EventTarget<EventMap extends Record<string, Event> = Record<string...
type EventTargetEventListenerOptions (line 683) | interface EventTargetEventListenerOptions {
type EventTargetAddEventListenerOptions (line 686) | interface EventTargetAddEventListenerOptions {
type EventTargetHandlerObject (line 692) | interface EventTargetHandlerObject {
class AbortController (line 700) | class AbortController {
type Scheduler (line 742) | interface Scheduler {
type SchedulerWaitOptions (line 745) | interface SchedulerWaitOptions {
class CustomEvent (line 758) | class CustomEvent<T = any> extends Event {
type CustomEventCustomEventInit (line 767) | interface CustomEventCustomEventInit {
class Blob (line 778) | class Blob {
type BlobOptions (line 795) | interface BlobOptions {
class File (line 803) | class File extends Blob {
type FileOptions (line 810) | interface FileOptions {
type CacheQueryOptions (line 837) | interface CacheQueryOptions {
type CryptoKeyPair (line 914) | interface CryptoKeyPair {
type JsonWebKey (line 918) | interface JsonWebKey {
type RsaOtherPrimesInfo (line 938) | interface RsaOtherPrimesInfo {
type SubtleCryptoDeriveKeyAlgorithm (line 943) | interface SubtleCryptoDeriveKeyAlgorithm {
type SubtleCryptoEncryptAlgorithm (line 951) | interface SubtleCryptoEncryptAlgorithm {
type SubtleCryptoGenerateKeyAlgorithm (line 960) | interface SubtleCryptoGenerateKeyAlgorithm {
type SubtleCryptoHashAlgorithm (line 968) | interface SubtleCryptoHashAlgorithm {
type SubtleCryptoImportKeyAlgorithm (line 971) | interface SubtleCryptoImportKeyAlgorithm {
type SubtleCryptoSignAlgorithm (line 978) | interface SubtleCryptoSignAlgorithm {
type CryptoKeyKeyAlgorithm (line 984) | interface CryptoKeyKeyAlgorithm {
type CryptoKeyAesKeyAlgorithm (line 987) | interface CryptoKeyAesKeyAlgorithm {
type CryptoKeyHmacKeyAlgorithm (line 991) | interface CryptoKeyHmacKeyAlgorithm {
type CryptoKeyRsaKeyAlgorithm (line 996) | interface CryptoKeyRsaKeyAlgorithm {
type CryptoKeyEllipticKeyAlgorithm (line 1002) | interface CryptoKeyEllipticKeyAlgorithm {
type CryptoKeyArbitraryKeyAlgorithm (line 1006) | interface CryptoKeyArbitraryKeyAlgorithm {
class DigestStream (line 1012) | class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
class TextDecoder (line 1022) | class TextDecoder {
class TextEncoder (line 1049) | class TextEncoder {
type TextDecoderConstructorOptions (line 1065) | interface TextDecoderConstructorOptions {
type TextDecoderDecodeOptions (line 1069) | interface TextDecoderDecodeOptions {
type TextEncoderEncodeIntoResult (line 1072) | interface TextEncoderEncodeIntoResult {
class ErrorEvent (line 1081) | class ErrorEvent extends Event {
type ErrorEventErrorEventInit (line 1094) | interface ErrorEventErrorEventInit {
class MessageEvent (line 1106) | class MessageEvent extends Event {
type MessageEventInit (line 1139) | interface MessageEventInit {
class FormData (line 1147) | class FormData {
type ContentOptions (line 1180) | interface ContentOptions {
class HTMLRewriter (line 1183) | class HTMLRewriter {
type HTMLRewriterElementContentHandlers (line 1189) | interface HTMLRewriterElementContentHandlers {
type HTMLRewriterDocumentContentHandlers (line 1194) | interface HTMLRewriterDocumentContentHandlers {
type Doctype (line 1200) | interface Doctype {
type Element (line 1205) | interface Element {
type EndTag (line 1224) | interface EndTag {
type Comment (line 1230) | interface Comment {
type Text (line 1238) | interface Text {
type DocumentEnd (line 1247) | interface DocumentEnd {
type HeadersInit (line 1262) | type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string,...
class Headers (line 1268) | class Headers {
type BodyInit (line 1298) | type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | Arra...
type Response (line 1334) | interface Response extends Body {
type ResponseInit (line 1354) | interface ResponseInit {
type RequestInfo (line 1362) | type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetad...
type Request (line 1377) | interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMeta...
type RequestInit (line 1431) | interface RequestInit<Cf = CfProperties> {
type Service (line 1450) | type Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBran...
type Fetcher (line 1451) | type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Re...
type KVNamespaceListKey (line 1455) | interface KVNamespaceListKey<Metadata, Key extends string = string> {
type KVNamespaceListResult (line 1460) | type KVNamespaceListResult<Metadata, Key extends string = string> = {
type KVNamespace (line 1470) | interface KVNamespace<Key extends string = string> {
type KVNamespaceListOptions (line 1503) | interface KVNamespaceListOptions {
type KVNamespaceGetOptions (line 1508) | interface KVNamespaceGetOptions<Type> {
type KVNamespacePutOptions (line 1512) | interface KVNamespacePutOptions {
type KVNamespaceGetWithMetadataResult (line 1517) | interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
type QueueContentType (line 1522) | type QueueContentType = "text" | "bytes" | "json" | "v8";
type Queue (line 1523) | interface Queue<Body = unknown> {
type QueueSendOptions (line 1527) | interface QueueSendOptions {
type QueueSendBatchOptions (line 1531) | interface QueueSendBatchOptions {
type MessageSendRequest (line 1534) | interface MessageSendRequest<Body = unknown> {
type QueueRetryOptions (line 1539) | interface QueueRetryOptions {
type Message (line 1542) | interface Message<Body = unknown> {
type QueueEvent (line 1550) | interface QueueEvent<Body = unknown> extends ExtendableEvent {
type MessageBatch (line 1556) | interface MessageBatch<Body = unknown> {
type R2Error (line 1562) | interface R2Error extends Error {
type R2ListOptions (line 1569) | interface R2ListOptions {
type R2MultipartUpload (line 1592) | interface R2MultipartUpload {
type R2UploadedPart (line 1599) | interface R2UploadedPart {
type R2ObjectBody (line 1618) | interface R2ObjectBody extends R2Object {
type R2Range (line 1627) | type R2Range = {
type R2Conditional (line 1636) | interface R2Conditional {
type R2GetOptions (line 1643) | interface R2GetOptions {
type R2PutOptions (line 1648) | interface R2PutOptions {
type R2MultipartOptions (line 1660) | interface R2MultipartOptions {
type R2Checksums (line 1666) | interface R2Checksums {
type R2StringChecksums (line 1674) | interface R2StringChecksums {
type R2HTTPMetadata (line 1681) | interface R2HTTPMetadata {
type R2Objects (line 1689) | type R2Objects = {
type R2UploadPartOptions (line 1698) | interface R2UploadPartOptions {
type ScheduledController (line 1706) | interface ScheduledController {
type QueuingStrategy (line 1711) | interface QueuingStrategy<T = any> {
type UnderlyingSink (line 1715) | interface UnderlyingSink<W = any> {
type UnderlyingByteSource (line 1722) | interface UnderlyingByteSource {
type UnderlyingSource (line 1729) | interface UnderlyingSource<R = any> {
type Transformer (line 1736) | interface Transformer<I = any, O = any> {
type StreamPipeOptions (line 1745) | interface StreamPipeOptions {
type ReadableStreamReadResult (line 1768) | type ReadableStreamReadResult<R = any> = {
type ReadableStream (line 1780) | interface ReadableStream<R = any> {
class ReadableStreamDefaultReader (line 1812) | class ReadableStreamDefaultReader<R = any> {
class ReadableStreamBYOBReader (line 1822) | class ReadableStreamBYOBReader {
type ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions (line 1832) | interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
type ReadableStreamGetReaderOptions (line 1835) | interface ReadableStreamGetReaderOptions {
type ReadableWritablePair (line 1899) | interface ReadableWritablePair<R = any, W = any> {
class WritableStream (line 1913) | class WritableStream<W = any> {
class WritableStreamDefaultWriter (line 1929) | class WritableStreamDefaultWriter<W = any> {
class TransformStream (line 1947) | class TransformStream<I = any, O = any> {
class FixedLengthStream (line 1954) | class FixedLengthStream extends IdentityTransformStream {
class IdentityTransformStream (line 1957) | class IdentityTransformStream extends TransformStream<ArrayBuffer | Arra...
type IdentityTransformStreamQueuingStrategy (line 1960) | interface IdentityTransformStreamQueuingStrategy {
type ReadableStreamValuesOptions (line 1963) | interface ReadableStreamValuesOptions {
class CompressionStream (line 1967) | class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe...
class DecompressionStream (line 1971) | class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf...
class TextEncoderStream (line 1975) | class TextEncoderStream extends TransformStream<string, Uint8Array> {
class TextDecoderStream (line 1980) | class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBuffe...
type TextDecoderStreamTextDecoderStreamInit (line 1986) | interface TextDecoderStreamTextDecoderStreamInit {
class ByteLengthQueuingStrategy (line 1995) | class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferVi...
class CountQueuingStrategy (line 2007) | class CountQueuingStrategy implements QueuingStrategy {
type QueuingStrategyInit (line 2014) | interface QueuingStrategyInit {
type ScriptVersion (line 2022) | interface ScriptVersion {
type TraceItem (line 2031) | interface TraceItem {
type TraceItemAlarmEventInfo (line 2049) | interface TraceItemAlarmEventInfo {
type TraceItemCustomEventInfo (line 2052) | interface TraceItemCustomEventInfo {
type TraceItemScheduledEventInfo (line 2054) | interface TraceItemScheduledEventInfo {
type TraceItemQueueEventInfo (line 2058) | interface TraceItemQueueEventInfo {
type TraceItemEmailEventInfo (line 2062) | interface TraceItemEmailEventInfo {
type TraceItemTailEventInfo (line 2067) | interface TraceItemTailEventInfo {
type TraceItemTailEventInfoTailItem (line 2070) | interface TraceItemTailEventInfoTailItem {
type TraceItemFetchEventInfo (line 2073) | interface TraceItemFetchEventInfo {
type TraceItemFetchEventInfoRequest (line 2077) | interface TraceItemFetchEventInfoRequest {
type TraceItemFetchEventInfoResponse (line 2084) | interface TraceItemFetchEventInfoResponse {
type TraceItemJsRpcEventInfo (line 2087) | interface TraceItemJsRpcEventInfo {
type TraceItemHibernatableWebSocketEventInfo (line 2090) | interface TraceItemHibernatableWebSocketEventInfo {
type TraceItemHibernatableWebSocketEventInfoMessage (line 2093) | interface TraceItemHibernatableWebSocketEventInfoMessage {
type TraceItemHibernatableWebSocketEventInfoClose (line 2096) | interface TraceItemHibernatableWebSocketEventInfoClose {
type TraceItemHibernatableWebSocketEventInfoError (line 2101) | interface TraceItemHibernatableWebSocketEventInfoError {
type TraceLog (line 2104) | interface TraceLog {
type TraceException (line 2109) | interface TraceException {
type TraceDiagnosticChannelEvent (line 2115) | interface TraceDiagnosticChannelEvent {
type TraceMetrics (line 2120) | interface TraceMetrics {
type UnsafeTraceMetrics (line 2124) | interface UnsafeTraceMetrics {
class URL (line 2132) | class URL {
class URLSearchParams (line 2192) | class URLSearchParams {
class URLPattern (line 2251) | class URLPattern {
type URLPatternInit (line 2265) | interface URLPatternInit {
type URLPatternComponentResult (line 2276) | interface URLPatternComponentResult {
type URLPatternResult (line 2280) | interface URLPatternResult {
type URLPatternOptions (line 2291) | interface URLPatternOptions {
class CloseEvent (line 2299) | class CloseEvent extends Event {
type CloseEventInit (line 2320) | interface CloseEventInit {
type WebSocketEventMap (line 2325) | type WebSocketEventMap = {
type WebSocket (line 2353) | interface WebSocket extends EventTarget<WebSocketEventMap> {
type SqlStorage (line 2400) | interface SqlStorage {
type SqlStorageValue (line 2408) | type SqlStorageValue = ArrayBuffer | string | number | null;
type Socket (line 2425) | interface Socket {
type SocketOptions (line 2435) | interface SocketOptions {
type SocketAddress (line 2440) | interface SocketAddress {
type TlsOptions (line 2444) | interface TlsOptions {
type SocketInfo (line 2447) | interface SocketInfo {
class EventSource (line 2452) | class EventSource extends EventTarget {
type EventSourceEventSourceInit (line 2495) | interface EventSourceEventSourceInit {
type Container (line 2499) | interface Container {
type ContainerStartupOptions (line 2507) | interface ContainerStartupOptions {
class MessageChannel (line 2546) | class MessageChannel {
type MessagePortPostMessageOptions (line 2561) | interface MessagePortPostMessageOptions {
type LoopbackForExport (line 2564) | type LoopbackForExport<T extends (new (...args: any[]) => Rpc.Entrypoint...
type LoopbackServiceStub (line 2565) | type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefin...
type LoopbackDurableObjectClass (line 2570) | type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | und...
type SyncKvStorage (line 2575) | interface SyncKvStorage {
type SyncKvListOptions (line 2584) | interface SyncKvListOptions {
type WorkerStub (line 2592) | interface WorkerStub {
type WorkerStubEntrypointOptions (line 2595) | interface WorkerStubEntrypointOptions {
type WorkerLoader (line 2598) | interface WorkerLoader {
type WorkerLoaderModule (line 2601) | interface WorkerLoaderModule {
type WorkerLoaderWorkerCode (line 2609) | interface WorkerLoaderWorkerCode {
type AiImageClassificationInput (line 2632) | type AiImageClassificationInput = {
type AiImageClassificationOutput (line 2635) | type AiImageClassificationOutput = {
type AiImageToTextInput (line 2643) | type AiImageToTextInput = {
type AiImageToTextOutput (line 2657) | type AiImageToTextOutput = {
type AiImageTextToTextInput (line 2664) | type AiImageTextToTextInput = {
type AiImageTextToTextOutput (line 2679) | type AiImageTextToTextOutput = {
type AiMultimodalEmbeddingsInput (line 2686) | type AiMultimodalEmbeddingsInput = {
type AiIMultimodalEmbeddingsOutput (line 2690) | type AiIMultimodalEmbeddingsOutput = {
type AiObjectDetectionInput (line 2698) | type AiObjectDetectionInput = {
type AiObjectDetectionOutput (line 2701) | type AiObjectDetectionOutput = {
type AiSentenceSimilarityInput (line 2709) | type AiSentenceSimilarityInput = {
type AiSentenceSimilarityOutput (line 2713) | type AiSentenceSimilarityOutput = number[];
type AiAutomaticSpeechRecognitionInput (line 2718) | type AiAutomaticSpeechRecognitionInput = {
type AiAutomaticSpeechRecognitionOutput (line 2721) | type AiAutomaticSpeechRecognitionOutput = {
type AiSummarizationInput (line 2734) | type AiSummarizationInput = {
type AiSummarizationOutput (line 2738) | type AiSummarizationOutput = {
type AiTextClassificationInput (line 2745) | type AiTextClassificationInput = {
type AiTextClassificationOutput (line 2748) | type AiTextClassificationOutput = {
type AiTextEmbeddingsInput (line 2756) | type AiTextEmbeddingsInput = {
type AiTextEmbeddingsOutput (line 2759) | type AiTextEmbeddingsOutput = {
type RoleScopedChatInput (line 2767) | type RoleScopedChatInput = {
type AiTextGenerationToolLegacyInput (line 2772) | type AiTextGenerationToolLegacyInput = {
type AiTextGenerationToolInput (line 2786) | type AiTextGenerationToolInput = {
type AiTextGenerationFunctionsInput (line 2803) | type AiTextGenerationFunctionsInput = {
type AiTextGenerationResponseFormat (line 2807) | type AiTextGenerationResponseFormat = {
type AiTextGenerationInput (line 2811) | type AiTextGenerationInput = {
type AiTextGenerationToolLegacyOutput (line 2828) | type AiTextGenerationToolLegacyOutput = {
type AiTextGenerationToolOutput (line 2832) | type AiTextGenerationToolOutput = {
type UsageTags (line 2840) | type UsageTags = {
type AiTextGenerationOutput (line 2845) | type AiTextGenerationOutput = {
type AiTextToSpeechInput (line 2854) | type AiTextToSpeechInput = {
type AiTextToSpeechOutput (line 2858) | type AiTextToSpeechOutput = Uint8Array | {
type AiTextToImageInput (line 2865) | type AiTextToImageInput = {
type AiTextToImageOutput (line 2878) | type AiTextToImageOutput = ReadableStream<Uint8Array>;
type AiTranslationInput (line 2883) | type AiTranslationInput = {
type AiTranslationOutput (line 2888) | type AiTranslationOutput = {
type Ai_Cf_Baai_Bge_Base_En_V1_5_Input (line 2895) | type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {
type Ai_Cf_Baai_Bge_Base_En_V1_5_Output (line 2913) | type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {
type AsyncResponse (line 2924) | interface AsyncResponse {
type Ai_Cf_Openai_Whisper_Input (line 2934) | type Ai_Cf_Openai_Whisper_Input = string | {
type Ai_Cf_Openai_Whisper_Output (line 2940) | interface Ai_Cf_Openai_Whisper_Output {
type Ai_Cf_Meta_M2M100_1_2B_Input (line 2963) | type Ai_Cf_Meta_M2M100_1_2B_Input = {
type Ai_Cf_Meta_M2M100_1_2B_Output (line 2995) | type Ai_Cf_Meta_M2M100_1_2B_Output = {
type Ai_Cf_Baai_Bge_Small_En_V1_5_Input (line 3005) | type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {
type Ai_Cf_Baai_Bge_Small_En_V1_5_Output (line 3023) | type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {
type Ai_Cf_Baai_Bge_Large_En_V1_5_Input (line 3038) | type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {
type Ai_Cf_Baai_Bge_Large_En_V1_5_Output (line 3056) | type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {
type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input (line 3071) | type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {
type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output (line 3110) | interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {
type Ai_Cf_Openai_Whisper_Tiny_En_Input (line 3117) | type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {
type Ai_Cf_Openai_Whisper_Tiny_En_Output (line 3123) | interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
type Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input (line 3146) | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
type Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output (line 3172) | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
type Ai_Cf_Baai_Bge_M3_Input (line 3252) | type Ai_Cf_Baai_Bge_M3_Input = BGEM3InputQueryAndContexts | BGEM3InputEm...
type BGEM3InputQueryAndContexts (line 3258) | interface BGEM3InputQueryAndContexts {
type BGEM3InputEmbedding (line 3277) | interface BGEM3InputEmbedding {
type BGEM3InputQueryAndContexts1 (line 3284) | interface BGEM3InputQueryAndContexts1 {
type BGEM3InputEmbedding1 (line 3303) | interface BGEM3InputEmbedding1 {
type Ai_Cf_Baai_Bge_M3_Output (line 3310) | type Ai_Cf_Baai_Bge_M3_Output = BGEM3OuputQuery | BGEM3OutputEmbeddingFo...
type BGEM3OuputQuery (line 3311) | interface BGEM3OuputQuery {
type BGEM3OutputEmbeddingForContexts (line 3323) | interface BGEM3OutputEmbeddingForContexts {
type BGEM3OuputEmbedding (line 3331) | interface BGEM3OuputEmbedding {
type Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input (line 3346) | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
type Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output (line 3356) | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input (line 3366) | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
type Prompt (line 3367) | interface Prompt {
type Messages (line 3418) | interface Messages {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output (line 3586) | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input (line 3609) | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Meta_Llama_3_3_7...
type Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt (line 3610) | interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
type JSONMode (line 3661) | interface JSONMode {
type Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages (line 3665) | interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
type AsyncBatch (line 3812) | interface AsyncBatch {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output (line 3857) | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {
type Ai_Cf_Meta_Llama_Guard_3_8B_Input (line 3897) | interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
type Ai_Cf_Meta_Llama_Guard_3_8B_Output (line 3929) | interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {
type Ai_Cf_Baai_Bge_Reranker_Base_Input (line 3962) | interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
type Ai_Cf_Baai_Bge_Reranker_Base_Output (line 3980) | interface Ai_Cf_Baai_Bge_Reranker_Base_Output {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input (line 3996) | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Qwen2_5_Coder_32B_Ins...
type Qwen2_5_Coder_32B_Instruct_Prompt (line 3997) | interface Qwen2_5_Coder_32B_Instruct_Prompt {
type Qwen2_5_Coder_32B_Instruct_Messages (line 4048) | interface Qwen2_5_Coder_32B_Instruct_Messages {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output (line 4195) | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {
type Ai_Cf_Qwen_Qwq_32B_Input (line 4235) | type Ai_Cf_Qwen_Qwq_32B_Input = Qwen_Qwq_32B_Prompt | Qwen_Qwq_32B_Messa...
type Qwen_Qwq_32B_Prompt (line 4236) | interface Qwen_Qwq_32B_Prompt {
type Qwen_Qwq_32B_Messages (line 4286) | interface Qwen_Qwq_32B_Messages {
type Ai_Cf_Qwen_Qwq_32B_Output (line 4461) | type Ai_Cf_Qwen_Qwq_32B_Output = {
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input (line 4501) | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Mistral_Smal...
type Mistral_Small_3_1_24B_Instruct_Prompt (line 4502) | interface Mistral_Small_3_1_24B_Instruct_Prompt {
type Mistral_Small_3_1_24B_Instruct_Messages (line 4552) | interface Mistral_Small_3_1_24B_Instruct_Messages {
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output (line 4727) | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {
type Ai_Cf_Google_Gemma_3_12B_It_Input (line 4767) | type Ai_Cf_Google_Gemma_3_12B_It_Input = Google_Gemma_3_12B_It_Prompt | ...
type Google_Gemma_3_12B_It_Prompt (line 4768) | interface Google_Gemma_3_12B_It_Prompt {
type Google_Gemma_3_12B_It_Messages (line 4818) | interface Google_Gemma_3_12B_It_Messages {
type Ai_Cf_Google_Gemma_3_12B_It_Output (line 4989) | type Ai_Cf_Google_Gemma_3_12B_It_Output = {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input (line 5029) | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_...
type Ai_Cf_Meta_Llama_4_Prompt (line 5030) | interface Ai_Cf_Meta_Llama_4_Prompt {
type Ai_Cf_Meta_Llama_4_Messages (line 5081) | interface Ai_Cf_Meta_Llama_4_Messages {
type Ai_Cf_Meta_Llama_4_Async_Batch (line 5257) | interface Ai_Cf_Meta_Llama_4_Async_Batch {
type Ai_Cf_Meta_Llama_4_Prompt_Inner (line 5260) | interface Ai_Cf_Meta_Llama_4_Prompt_Inner {
type Ai_Cf_Meta_Llama_4_Messages_Inner (line 5311) | interface Ai_Cf_Meta_Llama_4_Messages_Inner {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output (line 5487) | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
type Ai_Cf_Deepgram_Nova_3_Input (line 5540) | interface Ai_Cf_Deepgram_Nova_3_Input {
type Ai_Cf_Deepgram_Nova_3_Output (line 5686) | interface Ai_Cf_Deepgram_Nova_3_Output {
type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input (line 5723) | type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {
type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output (line 5745) | interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
type Ai_Cf_Openai_Gpt_Oss_120B_Input (line 5759) | type Ai_Cf_Openai_Gpt_Oss_120B_Input = GPT_OSS_120B_Responses | GPT_OSS_...
type GPT_OSS_120B_Responses (line 5760) | interface GPT_OSS_120B_Responses {
type GPT_OSS_120B_Responses_Async (line 5776) | interface GPT_OSS_120B_Responses_Async {
type Ai_Cf_Openai_Gpt_Oss_120B_Output (line 5794) | type Ai_Cf_Openai_Gpt_Oss_120B_Output = {} | (string & NonNullable<unkno...
type Ai_Cf_Openai_Gpt_Oss_20B_Input (line 5799) | type Ai_Cf_Openai_Gpt_Oss_20B_Input = GPT_OSS_20B_Responses | GPT_OSS_20...
type GPT_OSS_20B_Responses (line 5800) | interface GPT_OSS_20B_Responses {
type GPT_OSS_20B_Responses_Async (line 5816) | interface GPT_OSS_20B_Responses_Async {
type Ai_Cf_Openai_Gpt_Oss_20B_Output (line 5834) | type Ai_Cf_Openai_Gpt_Oss_20B_Output = {} | (string & NonNullable<unknow...
type Ai_Cf_Leonardo_Phoenix_1_0_Input (line 5839) | interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
type Ai_Cf_Leonardo_Phoenix_1_0_Output (line 5872) | type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
type Ai_Cf_Leonardo_Lucid_Origin_Input (line 5877) | interface Ai_Cf_Leonardo_Lucid_Origin_Input {
type Ai_Cf_Leonardo_Lucid_Origin_Output (line 5907) | interface Ai_Cf_Leonardo_Lucid_Origin_Output {
type Ai_Cf_Deepgram_Aura_1_Input (line 5917) | interface Ai_Cf_Deepgram_Aura_1_Input {
type Ai_Cf_Deepgram_Aura_1_Output (line 5946) | type Ai_Cf_Deepgram_Aura_1_Output = string;
type AiModels (line 5951) | interface AiModels {
type AiOptions (line 6029) | type AiOptions = {
type ConversionResponse (line 6044) | type ConversionResponse = {
type AiModelsSearchParams (line 6051) | type AiModelsSearchParams = {
type AiModelsSearchObject (line 6060) | type AiModelsSearchObject = {
type InferenceUpstreamError (line 6076) | interface InferenceUpstreamError extends Error {
type AiInternalError (line 6078) | interface AiInternalError extends Error {
type AiModelListType (line 6080) | type AiModelListType = Record<string, any>;
type GatewayRetries (line 6108) | type GatewayRetries = {
type GatewayOptions (line 6113) | type GatewayOptions = {
type UniversalGatewayOptions (line 6124) | type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {
type AiGatewayPatchLog (line 6130) | type AiGatewayPatchLog = {
type AiGatewayLog (line 6135) | type AiGatewayLog = {
type AIGatewayProviders (line 6162) | type AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | '...
type AIGatewayHeaders (line 6163) | type AIGatewayHeaders = {
type AIGatewayUniversalRequest (line 6184) | type AIGatewayUniversalRequest = {
type AiGatewayInternalError (line 6190) | interface AiGatewayInternalError extends Error {
type AiGatewayLogNotFound (line 6192) | interface AiGatewayLogNotFound extends Error {
type AutoRAGInternalError (line 6203) | interface AutoRAGInternalError extends Error {
type AutoRAGNotFoundError (line 6205) | interface AutoRAGNotFoundError extends Error {
type AutoRAGUnauthorizedError (line 6207) | interface AutoRAGUnauthorizedError extends Error {
type AutoRAGNameNotSetError (line 6209) | interface AutoRAGNameNotSetError extends Error {
type ComparisonFilter (line 6211) | type ComparisonFilter = {
type CompoundFilter (line 6216) | type CompoundFilter = {
type AutoRagSearchRequest (line 6220) | type AutoRagSearchRequest = {
type AutoRagAiSearchRequest (line 6230) | type AutoRagAiSearchRequest = AutoRagSearchRequest & {
type AutoRagAiSearchRequestStreaming (line 6234) | type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'str...
type AutoRagSearchResponse (line 6237) | type AutoRagSearchResponse = {
type AutoRagListResponse (line 6253) | type AutoRagListResponse = {
type AutoRagAiSearchResponse (line 6262) | type AutoRagAiSearchResponse = AutoRagSearchResponse & {
type BasicImageTransformations (line 6272) | interface BasicImageTransformations {
type BasicImageTransformationsGravityCoordinates (line 6339) | interface BasicImageTransformationsGravityCoordinates {
type RequestInitCfProperties (line 6353) | interface RequestInitCfProperties extends Record<string, unknown> {
type RequestInitCfPropertiesImageDraw (line 6404) | interface RequestInitCfPropertiesImageDraw extends BasicImageTransformat...
type RequestInitCfPropertiesImage (line 6441) | interface RequestInitCfPropertiesImage extends BasicImageTransformations {
type RequestInitCfPropertiesImageMinify (line 6592) | interface RequestInitCfPropertiesImageMinify {
type RequestInitCfPropertiesR2 (line 6597) | interface RequestInitCfPropertiesR2 {
type IncomingRequestCfProperties (line 6606) | type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingReque...
type IncomingRequestCfPropertiesBase (line 6607) | interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
type IncomingRequestCfPropertiesBotManagementBase (line 6685) | interface IncomingRequestCfPropertiesBotManagementBase {
type IncomingRequestCfPropertiesBotManagement (line 6712) | interface IncomingRequestCfPropertiesBotManagement {
type IncomingRequestCfPropertiesBotManagementEnterprise (line 6724) | interface IncomingRequestCfPropertiesBotManagementEnterprise extends Inc...
type IncomingRequestCfPropertiesCloudflareForSaaSEnterprise (line 6736) | interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMet...
type IncomingRequestCfPropertiesCloudflareAccessOrApiShield (line 6745) | interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
type IncomingRequestCfPropertiesExportedAuthenticatorMetadata (line 6765) | interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
type IncomingRequestCfPropertiesGeographicInformation (line 6794) | interface IncomingRequestCfPropertiesGeographicInformation {
type IncomingRequestCfPropertiesTLSClientAuth (line 6871) | interface IncomingRequestCfPropertiesTLSClientAuth {
type IncomingRequestCfPropertiesTLSClientAuthPlaceholder (line 6964) | interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
type CertVerificationStatus (line 6984) | type CertVerificationStatus =
type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus (line 7002) | type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unkno...
type Iso3166Alpha2Code (line 7004) | type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" ...
type ContinentCode (line 7006) | type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
type CfProperties (line 7007) | type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<...
type D1Meta (line 7008) | interface D1Meta {
type D1Response (line 7036) | interface D1Response {
type D1Result (line 7041) | type D1Result<T = unknown> = D1Response & {
type D1ExecResult (line 7044) | interface D1ExecResult {
type D1SessionConstraint (line 7048) | type D1SessionConstraint =
type D1SessionBookmark (line 7057) | type D1SessionBookmark = string;
type Disposable (line 7106) | interface Disposable {
type EmailMessage (line 7111) | interface EmailMessage {
type ForwardableEmailMessage (line 7124) | interface ForwardableEmailMessage extends EmailMessage {
type SendEmail (line 7160) | interface SendEmail {
type EmailExportedHandler (line 7166) | type EmailExportedHandler<Env = unknown> = (message: ForwardableEmailMes...
type HelloWorldBinding (line 7177) | interface HelloWorldBinding {
type Hyperdrive (line 7190) | interface Hyperdrive {
type ImageInfoResponse (line 7240) | type ImageInfoResponse = {
type ImageTransform (line 7248) | type ImageTransform = {
type ImageDrawOptions (line 7290) | type ImageDrawOptions = {
type ImageInputOptions (line 7298) | type ImageInputOptions = {
type ImageOutputOptions (line 7301) | type ImageOutputOptions = {
type ImagesBinding (line 7307) | interface ImagesBinding {
type ImageTransformer (line 7321) | interface ImageTransformer {
type ImageTransformationOutputOptions (line 7342) | type ImageTransformationOutputOptions = {
type ImageTransformationResult (line 7345) | interface ImageTransformationResult {
type ImagesError (line 7359) | interface ImagesError extends Error {
type MediaBinding (line 7368) | interface MediaBinding {
type MediaTransformer (line 7380) | interface MediaTransformer {
type MediaTransformationGenerator (line 7392) | interface MediaTransformationGenerator {
type MediaTransformationResult (line 7404) | interface MediaTransformationResult {
type MediaTransformationInputOptions (line 7425) | type MediaTransformationInputOptions = {
type MediaTransformationOutputOptions (line 7437) | type MediaTransformationOutputOptions = {
type MediaError (line 7461) | interface MediaError extends Error {
type Params (line 7466) | type Params<P extends string = any> = Record<P, string | string[]>;
type EventContext (line 7467) | type EventContext<Env, P extends string, Data> = {
type PagesFunction (line 7481) | type PagesFunction<Env = unknown, Params extends string = any, Data exte...
type EventPluginContext (line 7482) | type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
type PagesPluginFunction (line 7497) | type PagesPluginFunction<Env = unknown, Params extends string = any, Dat...
type PipelineRecord (line 7518) | type PipelineRecord = Record<string, unknown>;
type PipelineBatchMetadata (line 7519) | type PipelineBatchMetadata = {
type Pipeline (line 7523) | interface Pipeline<T extends PipelineRecord = PipelineRecord> {
type PubSubMessage (line 7536) | interface PubSubMessage {
type JsonWebKeyWithKid (line 7562) | interface JsonWebKeyWithKid extends JsonWebKey {
type RateLimitOptions (line 7566) | interface RateLimitOptions {
type RateLimitOutcome (line 7569) | interface RateLimitOutcome {
type RateLimit (line 7572) | interface RateLimit {
type RpcTargetBranded (line 7593) | interface RpcTargetBranded {
type WorkerEntrypointBranded (line 7596) | interface WorkerEntrypointBranded {
type DurableObjectBranded (line 7599) | interface DurableObjectBranded {
type WorkflowEntrypointBranded (line 7602) | interface WorkflowEntrypointBranded {
type EntrypointBranded (line 7605) | type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded ...
type Stubable (line 7607) | type Stubable = RpcTargetBranded | ((...args: any[]) => any);
type Serializable (line 7612) | type Serializable<T> =
type StubBase (line 7625) | interface StubBase<T extends Stubable> extends Disposable {
type Stub (line 7629) | type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
type BaseType (line 7631) | type BaseType = void | undefined | null | boolean | number | bigint | st...
type Stubify (line 7634) | type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, ...
type Unstubify (line 7643) | type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infe...
type UnstubifyAll (line 7648) | type UnstubifyAll<A extends any[]> = {
type MaybeProvider (line 7653) | type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
type MaybeDisposable (line 7654) | type MaybeDisposable<T> = T extends object ? Disposable : unknown;
type Result (line 7663) | type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R...
type MethodOrProperty (line 7669) | type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (.....
type MaybeCallableProvider (line 7672) | type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? Meth...
type Provider (line 7676) | type Provider<T extends object, Reserved extends string = never> = Maybe...
type Env (line 7687) | interface Env {
type GlobalProps (line 7707) | interface GlobalProps {
type GlobalProp (line 7711) | type GlobalProp<K extends string, Default> = K extends keyof GlobalProps...
type MainModule (line 7714) | type MainModule = GlobalProp<"mainModule", {}>;
type Exports (line 7716) | type Exports = {
type DefaultHandler (line 7724) | interface DefaultHandler {
type RpcStub (line 7737) | type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
type WorkflowDurationLabel (line 7768) | type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'wee...
type WorkflowSleepDuration (line 7769) | type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ...
type WorkflowDelayDuration (line 7770) | type WorkflowDelayDuration = WorkflowSleepDuration;
type WorkflowTimeoutDuration (line 7771) | type WorkflowTimeoutDuration = WorkflowSleepDuration;
type WorkflowRetentionDuration (line 7772) | type WorkflowRetentionDuration = WorkflowSleepDuration;
type WorkflowBackoff (line 7773) | type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
type WorkflowStepConfig (line 7774) | type WorkflowStepConfig = {
type WorkflowEvent (line 7782) | type WorkflowEvent<T> = {
type WorkflowStepEvent (line 7787) | type WorkflowStepEvent<T> = {
type SecretsStoreSecret (line 7815) | interface SecretsStoreSecret {
type Header (line 7827) | interface Header {
type FetchEventInfo (line 7831) | interface FetchEventInfo {
type JsRpcEventInfo (line 7838) | interface JsRpcEventInfo {
type ScheduledEventInfo (line 7841) | interface ScheduledEventInfo {
type AlarmEventInfo (line 7846) | interface AlarmEventInfo {
type QueueEventInfo (line 7850) | interface QueueEventInfo {
type EmailEventInfo (line 7855) | interface EmailEventInfo {
type TraceEventInfo (line 7861) | interface TraceEventInfo {
type HibernatableWebSocketEventInfoMessage (line 7865) | interface HibernatableWebSocketEventInfoMessage {
type HibernatableWebSocketEventInfoError (line 7868) | interface HibernatableWebSocketEventInfoError {
type HibernatableWebSocketEventInfoClose (line 7871) | interface HibernatableWebSocketEventInfoClose {
type HibernatableWebSocketEventInfo (line 7876) | interface HibernatableWebSocketEventInfo {
type CustomEventInfo (line 7880) | interface CustomEventInfo {
type FetchResponseInfo (line 7883) | interface FetchResponseInfo {
type EventOutcome (line 7887) | type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killS...
type ScriptVersion (line 7888) | interface ScriptVersion {
type Onset (line 7893) | interface Onset {
type Outcome (line 7906) | interface Outcome {
type SpanOpen (line 7912) | interface SpanOpen {
type SpanClose (line 7919) | interface SpanClose {
type DiagnosticChannelEvent (line 7923) | interface DiagnosticChannelEvent {
type Exception (line 7928) | interface Exception {
type Log (line 7934) | interface Log {
type Return (line 7943) | interface Return {
type Attribute (line 7947) | interface Attribute {
type Attributes (line 7951) | interface Attributes {
type EventType (line 7955) | type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChan...
type SpanContext (line 7957) | interface SpanContext {
type TailEvent (line 7972) | interface TailEvent<Event extends EventType> {
type TailEventHandler (line 7982) | type TailEventHandler<Event extends EventType = EventType> = (event: Tai...
type TailEventHandlerObject (line 7983) | type TailEventHandlerObject = {
type TailEventHandlerType (line 7993) | type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
type VectorizeVectorMetadataValue (line 8001) | type VectorizeVectorMetadataValue = string | number | boolean | string[];
type VectorizeVectorMetadata (line 8005) | type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<str...
type VectorFloatArray (line 8006) | type VectorFloatArray = Float32Array | Float64Array;
type VectorizeError (line 8007) | interface VectorizeError {
type VectorizeVectorMetadataFilterOp (line 8016) | type VectorizeVectorMetadataFilterOp = "$eq" | "$ne";
type VectorizeVectorMetadataFilter (line 8020) | type VectorizeVectorMetadataFilter = {
type VectorizeDistanceMetric (line 8029) | type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
type VectorizeMetadataRetrievalLevel (line 8039) | type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
type VectorizeQueryOptions (line 8040) | interface VectorizeQueryOptions {
type VectorizeIndexConfig (line 8050) | type VectorizeIndexConfig = {
type VectorizeIndexDetails (line 8062) | interface VectorizeIndexDetails {
type VectorizeIndexInfo (line 8077) | interface VectorizeIndexInfo {
type VectorizeVector (line 8090) | interface VectorizeVector {
type VectorizeMatch (line 8103) | type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<Ve...
type VectorizeMatches (line 8110) | interface VectorizeMatches {
type VectorizeVectorMutation (line 8121) | interface VectorizeVectorMutation {
type VectorizeAsyncMutation (line 8131) | interface VectorizeAsyncMutation {
type WorkerVersionMetadata (line 8233) | type WorkerVersionMetadata = {
type DynamicDispatchLimits (line 8241) | interface DynamicDispatchLimits {
type DynamicDispatchOptions (line 8251) | interface DynamicDispatchOptions {
type DispatchNamespace (line 8263) | interface DispatchNamespace {
class NonRetryableError (line 8280) | class NonRetryableError extends Error {
type WorkflowDurationLabel (line 8305) | type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'wee...
type WorkflowSleepDuration (line 8306) | type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ...
type WorkflowRetentionDuration (line 8307) | type WorkflowRetentionDuration = WorkflowSleepDuration;
type WorkflowInstanceCreateOptions (line 8308) | interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
type InstanceStatus (line 8326) | type InstanceStatus = {
type WorkflowError (line 8335) | interface WorkflowError {
FILE: test/core/context.test.ts
method beforeHandle (line 28) | beforeHandle({ route }) {
method beforeHandle (line 44) | beforeHandle({ route }) {
FILE: test/core/elysia.test.ts
method transform (line 204) | transform({ params }) {
method resolve (line 304) | resolve() {
FILE: test/core/handle-error.test.ts
class APIError (line 167) | class APIError extends Error {
method constructor (line 171) | constructor(
method beforeHandle (line 256) | beforeHandle({ status }) {
method beforeHandle (line 291) | beforeHandle({ status }) {
class ErrorA (line 342) | class ErrorA extends Error {
method toResponse (line 343) | toResponse() {
method toResponse (line 360) | toResponse() {
class ErrorA (line 359) | class ErrorA extends Error {
method toResponse (line 343) | toResponse() {
method toResponse (line 360) | toResponse() {
class ErrorB (line 376) | class ErrorB {
method toResponse (line 377) | toResponse() {
method toResponse (line 394) | toResponse() {
class ErrorB (line 393) | class ErrorB {
method toResponse (line 377) | toResponse() {
method toResponse (line 394) | toResponse() {
class ErrorWithHeaders (line 410) | class ErrorWithHeaders extends Error {
method toResponse (line 411) | toResponse() {
class AsyncError (line 437) | class AsyncError extends Error {
method toResponse (line 438) | async toResponse() {
method toResponse (line 457) | async toResponse() {
class AsyncError (line 456) | class AsyncError extends Error {
method toResponse (line 438) | async toResponse() {
method toResponse (line 457) | async toResponse() {
class AsyncErrorWithHeaders (line 475) | class AsyncErrorWithHeaders extends Error {
method toResponse (line 476) | async toResponse() {
class AsyncNonError (line 502) | class AsyncNonError {
method toResponse (line 503) | async toResponse() {
class BrokenError (line 520) | class BrokenError extends Error {
method toResponse (line 521) | toResponse() {
class BrokenAsyncError (line 537) | class BrokenAsyncError extends Error {
method toResponse (line 538) | async toResponse() {
FILE: test/core/macro-lifecycle.test.ts
method beforeHandle (line 16) | beforeHandle({ userId }) {
method beforeHandle (line 106) | beforeHandle({ userId }) {
method beforeHandle (line 156) | beforeHandle() {
FILE: test/extends/decorators.test.ts
class A (line 102) | class A {
method constructor (line 105) | constructor() {
method constructor (line 172) | constructor() {
class A (line 169) | class A {
method constructor (line 105) | constructor() {
method constructor (line 172) | constructor() {
FILE: test/extends/error.test.ts
class CustomError (line 8) | class CustomError extends Error {
method constructor (line 9) | constructor() {
FILE: test/extends/store.test.ts
class A (line 102) | class A {
method constructor (line 105) | constructor() {
method constructor (line 172) | constructor() {
class A (line 169) | class A {
method constructor (line 105) | constructor() {
method constructor (line 172) | constructor() {
FILE: test/lifecycle/after-handle.test.ts
method afterHandle (line 17) | afterHandle() {
method afterHandle (line 89) | afterHandle({ response }) {
method mapResponse (line 92) | mapResponse() {
method afterHandle (line 104) | afterHandle({ responseValue }) {
method mapResponse (line 107) | mapResponse() {
FILE: test/lifecycle/error.test.ts
class SomeCustomError (line 268) | class SomeCustomError extends Error {
method asJSON (line 269) | asJSON() {
FILE: test/lifecycle/map-derive.test.ts
method transform (line 114) | transform() {
FILE: test/lifecycle/map-resolve.test.ts
method beforeHandle (line 137) | beforeHandle() {
FILE: test/lifecycle/map-response.test.ts
method mapResponse (line 19) | mapResponse() {
method mapResponse (line 38) | mapResponse() {
method mapResponse (line 95) | mapResponse({ response }) {
method mapResponse (line 108) | mapResponse({ responseValue }) {
method mapResponse (line 121) | mapResponse({ response, set }) {
method mapResponse (line 141) | mapResponse({ responseValue, set }) {
class CustomClass (line 254) | class CustomClass {
method constructor (line 255) | constructor(public name: string) {}
method constructor (line 276) | constructor(public name: string) {}
class CustomClass (line 275) | class CustomClass {
method constructor (line 255) | constructor(public name: string) {}
method constructor (line 276) | constructor(public name: string) {}
FILE: test/lifecycle/parser.test.ts
method parse (line 123) | parse({ request }) {
FILE: test/lifecycle/resolve.test.ts
method beforeHandle (line 92) | beforeHandle() {
FILE: test/lifecycle/response.test.ts
class CustomError (line 187) | class CustomError extends Error {}
FILE: test/macro/macro.test.ts
method hi (line 12) | hi(config: string) {
method hi (line 28) | hi(beforeHandle: () => any) {
method hi (line 46) | hi(fn: () => any) {
method hi (line 62) | hi(fn: () => any) {
method hi (line 78) | hi(fn: () => any) {
method hi (line 94) | hi(fn: () => any) {
method hi (line 110) | hi(fn: () => any) {
method hi (line 126) | hi(fn: () => any) {
method hi (line 142) | hi(fn: () => any) {
method hi (line 158) | hi(fn: () => any) {
method hi (line 174) | hi(fn: () => any) {
method hi (line 190) | hi(fn: () => any) {
method hi (line 206) | hi(fn: () => any) {
method hi (line 222) | hi(fn: () => any) {
method beforeHandle (line 240) | beforeHandle() {
method auth (line 266) | auth(role: 'teacher' | 'student' | 'admin' | 'noLogin') {
method hi (line 300) | hi(_: string) {
method requiredUser (line 320) | requiredUser(value: boolean) {
method count (line 358) | count(_: boolean) {
method isAuth (line 379) | isAuth(shouldAuth: boolean) {
method isAuth (line 402) | isAuth(shouldAuth: boolean) {
method isAuth (line 425) | isAuth(shouldAuth: boolean) {
method hello (line 456) | hello(a: string) {
method isSignIn (line 473) | isSignIn() {
method resolve (line 766) | resolve() {
method sartre (line 1165) | sartre(enabled: boolean) {
method sartre (line 1198) | sartre(enabled: boolean) {
method sartre (line 1230) | sartre(tag: string) {
FILE: test/path/group.test.ts
method transform (line 62) | transform({ params }) {
FILE: test/path/guard.test.ts
method transform (line 81) | transform({ params }) {
method transform (line 219) | transform() {
method transform (line 251) | transform() {
method transform (line 262) | transform() {
method transform (line 288) | transform() {
method transform (line 300) | transform() {
method transform (line 325) | transform() {
method transform (line 356) | transform() {
method transform (line 384) | transform() {
FILE: test/plugins/checksum.test.ts
method transform (line 101) | transform() {}
method transform (line 146) | transform({ params }) {
FILE: test/response/custom-response.test.ts
class CustomResponse (line 6) | class CustomResponse extends Response { }
FILE: test/response/static.test.ts
method beforeHandle (line 27) | beforeHandle() {
method beforeHandle (line 39) | beforeHandle({ set }) {
method beforeHandle (line 63) | beforeHandle() {
method error (line 66) | error() {
method beforeHandle (line 91) | beforeHandle({ set }) {
FILE: test/response/stream.test.ts
method start (line 468) | async start(controller) {
method start (line 492) | async start(controller) {
method start (line 516) | async start(controller) {
method start (line 541) | async start(controller) {
method start (line 720) | start(controller) {
method start (line 745) | start(controller) {
FILE: test/sucrose/query.test.ts
method yay (line 52) | yay() {
method yay (line 67) | yay() {
FILE: test/sucrose/separate-function.test.ts
function fnParam (line 45) | function fnParam({ sucrose, amber }: any) {
function fnNoParam (line 59) | function fnNoParam() {
function fnAsync (line 73) | async function fnAsync(sucrose: any) {
FILE: test/sucrose/sucrose.test.ts
method auth (line 106) | get auth() {
FILE: test/tracer/aot.test.ts
class Controller (line 15) | class Controller {
method handle (line 16) | static async handle(ctx: Context) {
FILE: test/tracer/timing.test.ts
method parse (line 171) | async parse() {
method transform (line 191) | async transform() {
method beforeHandle (line 211) | async beforeHandle() {
method afterHandle (line 231) | async afterHandle() {
method mapResponse (line 251) | async mapResponse() {
method afterResponse (line 271) | async afterResponse() {
FILE: test/tracer/trace.test.ts
method beforeHandle (line 292) | beforeHandle() {
method beforeHandle (line 317) | beforeHandle() {
method beforeHandle (line 340) | beforeHandle() {
method beforeHandle (line 362) | beforeHandle() {
method beforeHandle (line 385) | beforeHandle() {
FILE: test/type-system/coercion-number.test.ts
function expectValidResponse (line 45) | async function expectValidResponse(response: Response) {
FILE: test/type-system/formdata.test.ts
type postProductModel (line 22) | type postProductModel = typeof postProductModel.static
type patchProductModel (line 30) | type patchProductModel = typeof patchProductModel.static
type postProductModelComplex (line 38) | type postProductModelComplex = typeof postProductModelComplex.static
type patchProductModelComplex (line 46) | type patchProductModelComplex = typeof patchProductModelComplex.static
FILE: test/types/documentation.ts
method error (line 11) | error({ code, error }) {
FILE: test/types/index.ts
method transform (line 443) | transform() {}
type App (line 651) | type App = (typeof server)['~Routes']
type Route (line 652) | type Route = App['v1']['a']['get']
type App (line 691) | type App = (typeof server)['~Routes']
type Route (line 692) | type Route = App['get']
method message (line 723) | message(ws, message) {
type App (line 732) | type App = (typeof server)['~Routes']
type Route (line 733) | type Route = App['v1']['a']['subscribe']
type App (line 761) | type App = (typeof server)['~Routes']
type Route (line 762) | type Route = App['get']
method beforeHandle (line 796) | beforeHandle({ params, params: { a } }) {
method beforeHandle (line 826) | beforeHandle({ params, params: { a, c } }) {
method beforeHandle (line 867) | beforeHandle({ body, query }) {
type App (line 969) | type App = (typeof server)['~Routes']
type Route (line 970) | type Route = App['get']
type App (line 1024) | type App = (typeof app)['~Routes']
type Routes (line 1025) | type Routes = keyof App['app']['test']['get']
method beforeHandle (line 1058) | beforeHandle({ params }) {
type App (line 1098) | type App = (typeof main)['~Routes']
method open (line 1121) | open(ws) {
method open (line 1131) | open(ws) {
method a (line 1179) | a(a: string) {}
method b (line 1191) | b(a: number) {}
method message (line 1221) | message() {}
type app (line 1291) | type app = (typeof app)['~Routes']
type a (line 1438) | type a = keyof {}
method pluginMethod (line 1956) | pluginMethod() {
method afterResponse (line 1989) | afterResponse({ response }) {
method isSignIn (line 2274) | isSignIn(enabled: boolean) {
method message (line 2454) | message({ data: { a } }) {
method afterResponse (line 2463) | afterResponse({ responseValue }) {
type AppResponse (line 2890) | type AppResponse = (typeof app)['~Routes']['get']['response']
type App2Response (line 2920) | type App2Response = (typeof app2)['~Routes']['test']['post']['response']
type Routes (line 2938) | type Routes = keyof (typeof app)['~Routes']
function handler (line 2979) | async function handler() {
FILE: test/types/lifecycle/soundness.ts
type Resolve (line 15) | type Resolve = (typeof app)['~Volatile']['resolve']
type Resolve (line 27) | type Resolve = (typeof app)['~Volatile']['resolve']
method afterHandle (line 57) | afterHandle({ status }) {
method error (line 60) | error({ status }) {
type Lifecycle (line 68) | type Lifecycle = Prettify<(typeof app)['~Volatile']['response']>
type Route (line 81) | type Route = Prettify<(typeof app)['~Routes']['get']['response']>
method afterHandle (line 123) | afterHandle({ status }) {
method error (line 126) | error({ status }) {
type Lifecycle (line 135) | type Lifecycle = Prettify<(typeof app)['~Ephemeral']['response']>
type Route (line 148) | type Route = Prettify<(typeof app)['~Routes']['get']['response']>
method afterHandle (line 190) | afterHandle({ status }) {
method error (line 193) | error({ status }) {
type Lifecycle (line 202) | type Lifecycle = Prettify<(typeof app)['~Metadata']['response']>
type Route (line 215) | type Route = Prettify<(typeof app)['~Routes']['get']['response']>
method beforeHandle (line 239) | beforeHandle({ status }) {
method afterHandle (line 272) | afterHandle({ status }) {
method error (line 275) | error({ status }) {
type Lifecycle (line 297) | type Lifecycle = (typeof app)['~Routes']['post']['response']
method beforeHandle (line 329) | beforeHandle({ status }) {
type Route (line 338) | type Route = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 354) | beforeHandle({ status }) {
type Route (line 363) | type Route = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 404) | beforeHandle({ status }) {
type Route (line 447) | type Route = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 488) | beforeHandle({ status }) {
type Route (line 529) | type Route = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 550) | beforeHandle({ status }) {
method afterHandle (line 563) | afterHandle({ status }) {
method beforeHandle (line 595) | beforeHandle({ status }) {
method resolve (line 622) | resolve() {
method beforeHandle (line 625) | beforeHandle({ status }) {
method beforeHandle (line 632) | beforeHandle({ status }) {
method beforeHandle (line 660) | beforeHandle({ status }) {
method afterHandle (line 679) | afterHandle({ status }) {
method error (line 698) | error({ status }) {
method beforeHandle (line 717) | beforeHandle({ status }) {
method afterHandle (line 720) | afterHandle({ status }) {
method error (line 725) | error({ status }) {
method beforeHandle (line 749) | beforeHandle({ status }) {
method afterHandle (line 752) | afterHandle({ status }) {
method error (line 757) | error({ status }) {
method beforeHandle (line 782) | beforeHandle({ status }) {
method afterHandle (line 785) | afterHandle({ status }) {
method error (line 790) | error({ status }) {
method resolve (line 815) | resolve({ status }) {
method beforeHandle (line 837) | beforeHandle({ status }) {
method afterHandle (line 1444) | afterHandle({ status }) {
method error (line 1447) | error({ status }) {
method afterHandle (line 1462) | afterHandle({ status }) {
method error (line 1465) | error({ status }) {
method afterHandle (line 1512) | afterHandle({ status }) {
method error (line 1515) | error({ status }) {
method afterHandle (line 1531) | afterHandle({ status }) {
method error (line 1534) | error({ status }) {
type A (line 1553) | type A = keyof (typeof app)['~Routes']['get']['response']
method afterHandle (line 1583) | afterHandle({ status }) {
method error (line 1586) | error({ status }) {
method afterHandle (line 1602) | afterHandle({ status }) {
method error (line 1605) | error({ status }) {
type A (line 1624) | type A = keyof (typeof app)['~Routes']['get']['response']
method afterHandle (line 1652) | afterHandle({ status }) {
method error (line 1655) | error({ status }) {
method error (line 1671) | error({ status }) {
type A (line 1696) | type A = keyof (typeof app)['~Routes']['get']['response']
method beforeHandle (line 1761) | beforeHandle({ body }) {
method beforeHandle (line 1827) | beforeHandle({ body }) {
method resolve (line 1884) | resolve({ status, headers: { authorization } }) {
method beforeHandle (line 1933) | beforeHandle({ status }) {
method beforeHandle (line 1943) | beforeHandle({ status }) {
method beforeHandle (line 1976) | beforeHandle({ status }) {
method beforeHandle (line 1986) | beforeHandle({ status }) {
method beforeHandle (line 2037) | beforeHandle({ status }) {
method beforeHandle (line 2047) | beforeHandle({ status }) {
method resolve (line 2204) | resolve({ status }) {
method resolve (line 2225) | resolve({ status }) {
method resolve (line 2245) | resolve({ status }) {
method beforeHandle (line 2275) | beforeHandle({ status }) {
type Route (line 2287) | type Route = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 2301) | beforeHandle({ status }) {
method beforeHandle (line 2309) | beforeHandle({ status }) {
type Routes (line 2319) | type Routes = (typeof app)['~Routes']['get']['response']
method resolve (line 2333) | resolve({ status }) {
method resolve (line 2342) | resolve({ status }) {
type Routes (line 2356) | type Routes = (typeof app)['~Routes']['get']['response']
method beforeHandle (line 2370) | beforeHandle({ status }) {
type Route (line 2388) | type Route = (typeof app)['~Routes']['get']['response']
FILE: test/types/macro.ts
method resolve (line 257) | resolve() {
method beforeHandle (line 283) | beforeHandle({ body }) {
method beforeHandle (line 290) | beforeHandle({ body }) {
FILE: test/types/type-system.ts
function addTwo (line 73) | function addTwo(num: number) {
FILE: test/units/merge-deep.test.ts
class Test (line 39) | class Test {
method foo (line 42) | public foo() {
class DbConnection (line 55) | class DbConnection {
method health (line 56) | health() {
method getUsers (line 60) | getUsers() {
FILE: test/utils.d.ts
type MaybeArray (line 2) | type MaybeArray<T> = T | T[];
FILE: test/utils.ts
type MaybeArray (line 4) | type MaybeArray<T> = T | T[]
FILE: test/validator/body.test.ts
method error (line 1142) | error({ code, error }) {
FILE: test/validator/header.test.ts
method error (line 389) | error({ code, error }) {
FILE: test/validator/params.test.ts
method error (line 275) | error({ code, error }) {
FILE: test/validator/query.test.ts
type Gender (line 146) | enum Gender {
method check (line 344) | check(ctx: Context, name: string, state?: string) {
method check (line 354) | check() {
method error (line 998) | error({ code, error }) {
FILE: test/validator/validator.test.ts
method beforeHandle (line 14) | beforeHandle() {
method beforeHandle (line 52) | beforeHandle() {}
method afterHandle (line 53) | afterHandle() {
method afterHandle (line 59) | afterHandle() {
FILE: test/ws/aot.test.ts
method message (line 9) | message() {}
FILE: test/ws/connection.test.ts
method message (line 10) | message() {}
method message (line 24) | message(ws) {
method message (line 46) | message(ws) {
method message (line 68) | message() {}
method message (line 88) | message() {}
method message (line 106) | message() {}
method message (line 126) | message() {}
method getUser (line 150) | getUser() {
method open (line 158) | open(ws) {
method ping (line 183) | ping() {
method pong (line 186) | pong() {
method message (line 189) | async message(ws) {
FILE: test/ws/destructuring.test.ts
method open (line 9) | async open(ws) {
FILE: test/ws/message.test.ts
method message (line 10) | message(ws, message) {
method message (line 36) | message(ws) {
method open (line 94) | open(ws) {
method message (line 97) | message(ws, message) {
method message (line 139) | message(ws, { message }) {
method message (line 168) | message(ws, { message }) {
method message (line 197) | message(ws, { message }) {
method message (line 226) | message(ws, { message }) {
method message (line 252) | message(ws, raw) {
method message (line 277) | message(ws, raw) {
method message (line 302) | message(ws, raw) {
method message (line 327) | message(ws, raw) {
method message (line 352) | message(ws, raw) {
method message (line 377) | message(ws, raw) {
method message (line 402) | message(ws, raw) {
method message (line 427) | message(ws, raw) {
method message (line 451) | message(ws, message) {
method message (line 477) | message(ws, message) {
method message (line 505) | message(ws, message) {
method error (line 524) | error() {
method message (line 527) | message(ws, message) {
method message (line 556) | message(ws, message) {
method message (line 588) | message(ws, message) {
Condensed preview — 270 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,391K chars).
[
{
"path": ".eslintrc.json",
"chars": 854,
"preview": "{\n\t\"env\": {\n\t\t\"browser\": true,\n\t\t\"es2021\": true\n\t},\n\t\"extends\": [\n\t\t\"eslint:recommended\",\n\t\t\"plugin:@typescript-eslint/r"
},
{
"path": ".github/FUNDING.yaml",
"chars": 16,
"preview": "github: SaltyAom"
},
{
"path": ".github/ISSUE_TEMPLATE/2-bug-report.yml",
"chars": 2687,
"preview": "name: 🐛 Bug Report\ndescription: Report an issue that should be fixed\nlabels: [bug]\nbody:\n - type: markdown\n attr"
},
{
"path": ".github/ISSUE_TEMPLATE/3-feature-request.yml",
"chars": 863,
"preview": "name: 🚀 Feature Request\ndescription: Suggest an idea, feature, or enhancement\nlabels: [enhancement]\nbody:\n - type: ma"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 312,
"preview": "blank_issues_enabled: true\ncontact_links:\n - name: 📗 Documentation Issue\n url: https://github.com/elysiajs/docum"
},
{
"path": ".github/dependabot.yml",
"chars": 206,
"preview": "version: 2\nupdates:\n - package-ecosystem: 'npm'\n directory: './'\n schedule:\n interval: 'daily'\n\n - package-"
},
{
"path": ".github/workflows/ci.yml",
"chars": 739,
"preview": "name: Build and Test\n\non:\n push:\n pull_request:\n\njobs:\n build:\n name: Build and test code\n runs-o"
},
{
"path": ".github/workflows/publish.yml",
"chars": 953,
"preview": "name: Publish\n\non:\n release:\n types: [published]\n\ndefaults:\n run:\n shell: bash\n\npermissions:\n id-token: write\n\n"
},
{
"path": ".gitignore",
"chars": 112,
"preview": ".DS_Store\n\nnode_modules\nbuild\ndump.rdb\ndist\ntrace\n.scannerwork\n*.tsbuildinfo\n.wrangler\n.elysia\nheap.json\nserver\n"
},
{
"path": ".npmignore",
"chars": 410,
"preview": ".git\n.gitignore\n.github\n.prettierrc\n.eslintrc.js\n.eslint.json\n.swc.cjs.swcrc\n.swc.esm.swcrc\n.swcrc\n.husky\n.eslintrc.json"
},
{
"path": ".npmrc",
"chars": 82,
"preview": "enable-pre-post-scripts=true\nregistry=https://registry.npmjs.org\nalways-auth=true\n"
},
{
"path": ".prettierrc",
"chars": 101,
"preview": "{\n\t\"useTabs\": true,\n\t\"tabWidth\": 4,\n\t\"semi\": false,\n\t\"singleQuote\": true,\n\t\"trailingComma\": \"none\"\n}\n"
},
{
"path": "CHANGELOG.md",
"chars": 110412,
"preview": "# 1.4.28 - 17 Mar 2025\nFeature:\n- [#1803](https://github.com/elysiajs/elysia/pull/1803) stream response with pull based "
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5279,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": "CONTRIBUTING.md",
"chars": 2472,
"preview": "# Welcome to Elysia contributing guide\n\nThank you for investing your time in contributing to Elysia! Any contribution yo"
},
{
"path": "LICENSE",
"chars": 1048,
"preview": "Copyright 2022 saltyAom\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software a"
},
{
"path": "README.md",
"chars": 1636,
"preview": "<p align=center>\n <img src=https://github.com/user-attachments/assets/8168188b-ffaf-444f-8d09-c516ce140824 alt=\"Elysia B"
},
{
"path": "build.ts",
"chars": 675,
"preview": "import { $ } from 'bun'\nimport { build } from 'tsup'\nimport { fixImportsPlugin } from 'esbuild-fix-imports-plugin'\n\nimpo"
},
{
"path": "example/a.ts",
"chars": 873,
"preview": "import { Elysia, t } from '../src'\nimport { req } from '../test/utils'\n\nconst app = new Elysia()\n\t.get('/', async () => "
},
{
"path": "example/async-recursive.ts",
"chars": 596,
"preview": "import { Elysia } from '../src'\nimport { req } from '../test/utils'\n\nconst delay = <T extends (...args: any) => any>(\n\tc"
},
{
"path": "example/body.ts",
"chars": 711,
"preview": "import { Elysia, t } from '../src'\n\nconst app = new Elysia()\n\t// Add custom body parser\n\t.onParse(async ({ request, cont"
},
{
"path": "example/cookie.ts",
"chars": 749,
"preview": "import { Elysia, t } from '../src'\n\nconst app = new Elysia({\n\tcookie: {\n\t\tsecrets: 'Fischl von Luftschloss Narfidort',\n\t"
},
{
"path": "example/counter.ts",
"chars": 126,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t.state('counter', 0)\n\t.get('/', ({ store }) => store.counter++)\n\t.listen("
},
{
"path": "example/custom-response.ts",
"chars": 299,
"preview": "import { Elysia } from '../src'\n\nconst prettyJson = new Elysia()\n\t.mapResponse(({ response }) => {\n\t\tif (response instan"
},
{
"path": "example/derive.ts",
"chars": 500,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t.state('counter', 0)\n\t.derive(({ store }) => ({\n\t\tincrease() {\n\t\t\tstore.c"
},
{
"path": "example/error.ts",
"chars": 294,
"preview": "import { Elysia, t } from '../src'\n\nnew Elysia()\n\t.post('/', ({ body }) => body, {\n\t\tbody: t.Object({\n\t\t\tusername: t.Str"
},
{
"path": "example/extension.ts",
"chars": 6044,
"preview": "import { Elysia, t } from '../src'\n\nconst a0 = new Elysia().get('/a0', () => 'a')\nconst a1 = new Elysia().get('/a1', () "
},
{
"path": "example/file.ts",
"chars": 431,
"preview": "import { Elysia, file } from '../src'\nimport Page from './index.html'\n\n/**\n * Example of handle single static file\n *\n *"
},
{
"path": "example/guard.ts",
"chars": 682,
"preview": "import { Elysia, t } from '../src'\n\nnew Elysia()\n\t.state('name', 'salt')\n\t.get('/', ({ store: { name } }) => `Hi ${name}"
},
{
"path": "example/headers.ts",
"chars": 196,
"preview": "import { Elysia } from '../src'\n\nimport cookie from '../src/index'\n\nnew Elysia()\n\t.get('/', ({ set }) => {\n\t\tset.headers"
},
{
"path": "example/hook.ts",
"chars": 445,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t// Create global mutable state\n\t.state('counter', 0)\n\t// Increase counter"
},
{
"path": "example/html-import.ts",
"chars": 166,
"preview": "import { Elysia, t } from '../src'\nimport Page from './index.html'\n\nnew Elysia()\n\t.get('/', Page)\n\t.get('/mika.mp4', Bun"
},
{
"path": "example/http.ts",
"chars": 2774,
"preview": "import { Elysia, t } from '../src'\n\nconst t1 = performance.now()\n\nconst loggerPlugin = new Elysia()\n\t.get('/hi', () => '"
},
{
"path": "example/index.html",
"chars": 199,
"preview": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>Bun HTML Import</title>\n\t</head>\n\t<body>\n\t\t<h1>Hi</h1>\n\t\t<video>\n\t\t\t<!"
},
{
"path": "example/lazy/index.ts",
"chars": 154,
"preview": "import Elysia from '../../src'\n\nexport const lazy = (app: Elysia) =>\n\tapp.state('a', 'b').get('/lazy', 'Hi from lazy loa"
},
{
"path": "example/lazy-module.ts",
"chars": 481,
"preview": "import { Elysia } from '../src'\n\nconst plugin = (app: Elysia) => app.get('/plugin', () => 'Plugin')\nconst asyncPlugin = "
},
{
"path": "example/native.ts",
"chars": 130,
"preview": "Bun.serve({\n\tport: 3000,\n\tfetch: (request) => {\n\t\tthrow new Error('A')\n\t},\n\terror(request) {\n\t\treturn new Response('erro"
},
{
"path": "example/nested-multipart-files.ts",
"chars": 2015,
"preview": "import { Elysia, t } from '../src'\n\n/**\n * Example: Nested File Uploads with Multipart Forms\n *\n * Elysia supports neste"
},
{
"path": "example/nested-schema.ts",
"chars": 565,
"preview": "import { Elysia, t } from '../src'\n\nnew Elysia()\n\t.guard(\n\t\t{\n\t\t\tquery: t.Object({\n\t\t\t\tname: t.String()\n\t\t\t})\n\t\t},\n\t\t(ap"
},
{
"path": "example/newFile.ts",
"chars": 0,
"preview": ""
},
{
"path": "example/openapi.ts",
"chars": 1521,
"preview": "import { Elysia, t } from '../src'\nimport { openapi as OpenAPI } from '@elysiajs/openapi'\nimport { fromTypes } from '@el"
},
{
"path": "example/params.ts",
"chars": 208,
"preview": "import { Elysia } from '../src'\n\nconst app = new Elysia()\n\t.get('/', () => 'Elysia')\n\t// Retrieve params, automatically "
},
{
"path": "example/proxy.ts",
"chars": 215,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t.all('/*', ({ request, params, query }) =>\n\t\tfetch({\n\t\t\t...request,\n\t\t\tur"
},
{
"path": "example/redirect.ts",
"chars": 136,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t.get('/', () => 'Hi')\n\t.get('/redirect', ({ redirect }) => redirect('/'))"
},
{
"path": "example/rename.ts",
"chars": 818,
"preview": "import { Elysia, t } from '../src'\n\n// ? Elysia#83 | Proposal: Standardized way of renaming third party plugin-scoped st"
},
{
"path": "example/response.ts",
"chars": 263,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t.get('/', ({ set }) => {\n\t\tset.headers['X-POWERED-BY'] = 'Elysia'\n\n\t\t// R"
},
{
"path": "example/router.ts",
"chars": 435,
"preview": "import { Elysia } from '../src'\n\nconst prefix = <Prefix extends string = string>(prefix: Prefix) =>\n\tnew Elysia({ prefix"
},
{
"path": "example/schema.ts",
"chars": 1159,
"preview": "import { Elysia, t } from '../src'\n\nconst app = new Elysia()\n\t.model({\n\t\tname: t.Object({\n\t\t\tname: t.String()\n\t\t}),\n\t\tb:"
},
{
"path": "example/simple.ts",
"chars": 262,
"preview": "import { Elysia } from '../src'\n\n// Simple Hello World\nconst t1 = performance.now()\nnew Elysia()\n\t.get('/', () => 'Hi')\n"
},
{
"path": "example/sleep.ts",
"chars": 185,
"preview": "const sleep = (time: number) => new Promise(resolve => setTimeout(resolve, time))\n\nBun.serve({\n\tport: 3000,\n\tfetch: asyn"
},
{
"path": "example/spawn.ts",
"chars": 206,
"preview": "import { $ } from 'bun'\nimport { cpus } from 'os'\n\nconst total = cpus().length - 1\nconst ops = []\n\nfor (let i = 0; i < t"
},
{
"path": "example/store.ts",
"chars": 181,
"preview": "import { Elysia } from '../src'\n\nnew Elysia()\n\t// Create globally mutable store\n\t.state('name', 'Fubuki')\n\t.get('/id/:id"
},
{
"path": "example/stress/a.ts",
"chars": 838,
"preview": "import { getHeapSpaceStatistics } from 'v8'\nimport { Elysia, t } from '../../src'\nimport { generateHeapSnapshot } from '"
},
{
"path": "example/stress/decorate.ts",
"chars": 735,
"preview": "import { Elysia, t } from '../../src'\n\nconst total = 1000\nconst sub = 50\n\nconst app = new Elysia()\n\nconst memory = proce"
},
{
"path": "example/stress/instance.ts",
"chars": 682,
"preview": "import { Elysia, t } from '../../src'\n\nconst total = 100\nconst sub = 5\n\nconst app = new Elysia({ precompile: true })\n\nco"
},
{
"path": "example/stress/memoir.ts",
"chars": 782,
"preview": "import { t } from '../../src'\nimport { Memoirist } from 'memoirist'\n\nconst total = 1000\nconst stack: Memoirist<any>[] = "
},
{
"path": "example/stress/multiple-routes.ts",
"chars": 747,
"preview": "import { Elysia, t } from '../../src'\nimport v8 from 'v8'\n\nconst total = 500\n\n{\n\tconst app = new Elysia({ precompile: tr"
},
{
"path": "example/stress/sucrose.ts",
"chars": 785,
"preview": "// @ts-nocheck\n\nimport { sucrose } from '../../src/sucrose'\n\nconst total = 100_000\nconst t = performance.now()\n\nfor (let"
},
{
"path": "example/type-inference.ts",
"chars": 212,
"preview": "import { Elysia } from '../src'\n\nconst counter = (app: Elysia) => app.state('counter', 0)\n\nnew Elysia()\n\t.use(counter)\n\t"
},
{
"path": "example/uint8array.ts",
"chars": 461,
"preview": "import { Elysia, t } from '../src'\n\nnew Elysia()\n\t.post('/', ({ body }) => body, {\n\t\tbody: t.Uint8Array()\n\t})\n\t.listen(3"
},
{
"path": "example/upload.ts",
"chars": 490,
"preview": "import { Elysia, t } from '../src'\nimport { upload } from '../test/utils'\n\nconst app = new Elysia()\n\t.post('/single', ({"
},
{
"path": "example/video.ts",
"chars": 106,
"preview": "import { Elysia } from 'elysia'\n\nnew Elysia()\n\t.get('/', Bun.file('test/kyuukurarin.mp4'))\n\t.listen(3000)\n"
},
{
"path": "example/websocket.ts",
"chars": 538,
"preview": "import { Elysia } from '../src'\n\nconst app = new Elysia()\n\t.state('start', 'here')\n\t.ws('/ws', {\n\t\topen(ws) {\n\t\t\tws.subs"
},
{
"path": "knip.json",
"chars": 397,
"preview": "{\n \"entry\": [\n \"src/index.ts\"\n ],\n \"project\": [\n \"src/**/*.{js,ts}\"\n ],\n \"ignoreDependencie"
},
{
"path": "package.json",
"chars": 6858,
"preview": "{\n\t\"name\": \"elysia\",\n\t\"description\": \"Ergonomic Framework for Human\",\n\t\"version\": \"1.4.28\",\n\t\"author\": {\n\t\t\"name\": \"salt"
},
{
"path": "src/adapter/bun/compose.ts",
"chars": 4499,
"preview": "import { mapEarlyResponse } from './handler'\nimport { sucrose, type Sucrose } from '../../sucrose'\nimport { createHoc, c"
},
{
"path": "src/adapter/bun/handler-native.ts",
"chars": 1110,
"preview": "import { isHTMLBundle } from './index'\nimport type { Context } from '../../context'\nimport type { AnyLocalHook, MaybePro"
},
{
"path": "src/adapter/bun/handler.ts",
"chars": 14535,
"preview": "// Similar to adapter/web-standard/handler but\n// string case is omitted header out\n// (this has a significant performan"
},
{
"path": "src/adapter/bun/index.ts",
"chars": 15521,
"preview": "/* eslint-disable sonarjs/no-duplicate-string */\nimport type { TSchema } from '@sinclair/typebox'\n\nimport { WebStandardA"
},
{
"path": "src/adapter/cloudflare-worker/index.ts",
"chars": 1492,
"preview": "import { ElysiaAdapter } from '../..'\nimport { WebStandardAdapter } from '../web-standard/index'\nimport { composeErrorHa"
},
{
"path": "src/adapter/index.ts",
"chars": 45,
"preview": "export type { ElysiaAdapter } from './types'\n"
},
{
"path": "src/adapter/types.ts",
"chars": 3777,
"preview": "import type { Serve, ListenCallback } from '../universal/server'\n\nimport type { AnyElysia } from '..'\nimport type { Cont"
},
{
"path": "src/adapter/utils.ts",
"chars": 13935,
"preview": "import { serializeCookie } from '../cookies'\nimport { hasHeaderShorthand, isNotEmpty, StatusMap } from '../utils'\n\nimpor"
},
{
"path": "src/adapter/web-standard/handler.ts",
"chars": 16871,
"preview": "/* eslint-disable sonarjs/no-nested-switch */\n/* eslint-disable sonarjs/no-duplicate-string */\nimport {\n\tcreateResponseH"
},
{
"path": "src/adapter/web-standard/index.ts",
"chars": 7194,
"preview": "import {\n\tmapResponse,\n\tmapEarlyResponse,\n\tmapCompactResponse,\n\tcreateStaticHandler\n} from './handler'\n\nimport type { El"
},
{
"path": "src/compose.ts",
"chars": 74580,
"preview": "import { AnyElysia, Cookie } from './index'\n\nimport { Value, TransformDecodeError } from '@sinclair/typebox/value'\nimpor"
},
{
"path": "src/context.ts",
"chars": 6143,
"preview": "import type { Server } from './universal/server'\nimport type { Cookie, ElysiaCookie } from './cookies'\nimport type {\n\tSt"
},
{
"path": "src/cookies.ts",
"chars": 13348,
"preview": "import { parse, serialize } from 'cookie'\n\nimport decode from 'fast-decode-uri-component'\n\nimport { isNotEmpty, unsignCo"
},
{
"path": "src/dynamic-handle.ts",
"chars": 24879,
"preview": "import { TransformDecodeError } from '@sinclair/typebox/value'\nimport type { Context } from './context'\nimport { parseCo"
},
{
"path": "src/error.ts",
"chars": 13090,
"preview": "import type { TSchema } from '@sinclair/typebox'\nimport { Value } from '@sinclair/typebox/value'\nimport type {\n\tTypeChec"
},
{
"path": "src/formats.ts",
"chars": 10942,
"preview": "/**\n * ? Fork of ajv-formats without ajv as dependencies\n *\n * @see https://github.com/ajv-validator/ajv-formats/blob/ma"
},
{
"path": "src/index.ts",
"chars": 189640,
"preview": "import { Memoirist } from 'memoirist'\nimport {\n\tKind,\n\ttype TObject,\n\ttype TSchema,\n\ttype TModule,\n\ttype TRef,\n\ttype TAn"
},
{
"path": "src/manifest.ts",
"chars": 1235,
"preview": "// import { stat, mkdir, writeFile } from 'fs/promises'\n// import type { AnyElysia } from '.'\n// import { checksum } fro"
},
{
"path": "src/parse-query.ts",
"chars": 8401,
"preview": "import decode from 'fast-decode-uri-component'\n\n// bit flags\nconst KEY_HAS_PLUS = 1\nconst KEY_NEEDS_DECODE = 2\nconst VAL"
},
{
"path": "src/replace-schema.ts",
"chars": 6893,
"preview": "import { Kind, type TAnySchema, type TSchema } from \"@sinclair/typebox\";\nimport { t } from \"./type-system\";\nimport type "
},
{
"path": "src/schema.ts",
"chars": 34632,
"preview": "/* eslint-disable sonarjs/no-duplicate-string */\nimport {\n\tKind,\n\tOptionalKind,\n\tTModule,\n\tTObject,\n\tTransformKind,\n\tTSc"
},
{
"path": "src/sucrose.ts",
"chars": 18501,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-constant-condition */\nimport { checksum } fr"
},
{
"path": "src/trace.ts",
"chars": 7361,
"preview": "import { ELYSIA_REQUEST_ID } from './utils'\n\nimport type { Context } from './context'\nimport type { Prettify, RouteSchem"
},
{
"path": "src/type-system/format.ts",
"chars": 14251,
"preview": "import { FormatRegistry } from '@sinclair/typebox'\n\n/**\n * ? Fork of ajv-formats without ajv as dependencies\n *\n * @see "
},
{
"path": "src/type-system/index.ts",
"chars": 14614,
"preview": "import { Type, Kind } from '@sinclair/typebox'\nimport type {\n\tArrayOptions,\n\tDateOptions,\n\tIntegerOptions,\n\tObjectOption"
},
{
"path": "src/type-system/types.ts",
"chars": 6256,
"preview": "import type {\n\tKind,\n\tObjectOptions,\n\tSchemaOptions,\n\tStaticDecode,\n\tTObject,\n\tTProperties,\n\tTransformKind,\n\tTSchema,\n\tT"
},
{
"path": "src/type-system/utils.ts",
"chars": 5172,
"preview": "import {\n\tKind,\n\tTUnsafe,\n\tTypeRegistry,\n\tUnsafe,\n\ttype TAnySchema\n} from '@sinclair/typebox'\nimport { Value } from '@si"
},
{
"path": "src/types.ts",
"chars": 66264,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { Elysia, AnyElysia, InvertedStatusMap } from './inde"
},
{
"path": "src/universal/env.ts",
"chars": 142,
"preview": "import { isBun } from './utils'\n\nexport const env = isBun\n\t? Bun.env\n\t: typeof process !== 'undefined' && process?.env\n\t"
},
{
"path": "src/universal/file.ts",
"chars": 4218,
"preview": "/* eslint-disable sonarjs/no-duplicate-string */\nimport { type createReadStream as CreateReadStream } from 'fs'\nimport {"
},
{
"path": "src/universal/index.ts",
"chars": 199,
"preview": "export { env } from './env'\nexport { file } from './file'\nexport type {\n\tErrorLike,\n\tGenericServeOptions,\n\tServe,\n\tServe"
},
{
"path": "src/universal/request.ts",
"chars": 5331,
"preview": "import type {\n\tHeadersInit,\n\tRequestCache,\n\tRequestCredentials,\n\tRequestDestination,\n\tRequestDuplex,\n\tRequestInfo,\n\tRequ"
},
{
"path": "src/universal/server.ts",
"chars": 9464,
"preview": "import { Serve as BunServe, type Server as BunServer } from 'bun'\nimport type { Equal, MaybePromise } from '../types'\n\ne"
},
{
"path": "src/universal/types.ts",
"chars": 5754,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\n// based on https://github.com/Ethan-Arrowood/undici-fetch/blob/2"
},
{
"path": "src/universal/utils.ts",
"chars": 505,
"preview": "// @ts-ignore\nexport const isBun = typeof Bun !== 'undefined'\n// @ts-ignore\nexport const isDeno = typeof Deno !== 'undef"
},
{
"path": "src/utils.ts",
"chars": 31530,
"preview": "import type { Sucrose } from './sucrose'\nimport type { TraceHandler } from './trace'\n\nimport type {\n\tLifeCycleStore,\n\tMa"
},
{
"path": "src/ws/bun.ts",
"chars": 13034,
"preview": "// ? Copy from bun.d.ts for universal runtime support\n\ntype TypedArray =\n\t| Uint8Array\n\t| Uint8ClampedArray\n\t| Uint16Arr"
},
{
"path": "src/ws/index.ts",
"chars": 8117,
"preview": "import { isNumericString } from '../utils'\n\nimport type {\n\tServerWebSocket,\n\tServerWebSocketSendStatus,\n\tBufferSource,\n\t"
},
{
"path": "src/ws/types.ts",
"chars": 4189,
"preview": "import { TSchema } from '@sinclair/typebox'\n\nimport type { ElysiaWS } from './index'\nimport { WebSocketHandler } from '."
},
{
"path": "test/adapter/bun/index.test.ts",
"chars": 2261,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../../src'\n\ndescribe('Bun adapter', () => "
},
{
"path": "test/adapter/web-standard/cookie-to-header.test.ts",
"chars": 3079,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { serializeCookie } from '../../../src/cookies'\n\ndescribe('Web St"
},
{
"path": "test/adapter/web-standard/map-compact-response.test.ts",
"chars": 5968,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { mapCompactResponse } from '../../../src/adapter/web-standard/h"
},
{
"path": "test/adapter/web-standard/map-early-response.test.ts",
"chars": 9861,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { mapEarlyResponse } from '../../../src/adapter/web-standard/han"
},
{
"path": "test/adapter/web-standard/map-response.test.ts",
"chars": 11627,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { Elysia, form, redirect } from '../../../src'\n\nimport { mapResp"
},
{
"path": "test/adapter/web-standard/set-cookie.test.ts",
"chars": 1869,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { parseSetCookies } from '../../../src/adapter/utils'\n\ndescribe('"
},
{
"path": "test/adapter/web-standard/utils.ts",
"chars": 126,
"preview": "export class Passthrough {\n toResponse() {\n return this.custom\n }\n\n get custom() {\n return 'hi'\n "
},
{
"path": "test/aot/analysis.test.ts",
"chars": 5629,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Elysia, t } from '../../src'\n\nimport { describe, expect,"
},
{
"path": "test/aot/generation.test.ts",
"chars": 2499,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { describe, it, expect } from 'bun:test'\nimport { Context,"
},
{
"path": "test/aot/has-transform.test.ts",
"chars": 2220,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { t } from '../../src'\nimport { hasTransform } from '../../src/s"
},
{
"path": "test/aot/has-type.test.ts",
"chars": 4011,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { t } from '../../src'\nimport { hasType } from '../../src/schema"
},
{
"path": "test/aot/response.test.ts",
"chars": 4615,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia, t } from '../../src'\nimport { req } from '../utils'\nimp"
},
{
"path": "test/bun/router.test.ts",
"chars": 7784,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, ELYSIA_REQUEST_ID, t } from '../../src'\nimport { req } "
},
{
"path": "test/bun/sql.test.ts",
"chars": 847,
"preview": "import { SQL } from 'bun'\nimport { describe, it, expect } from 'bun:test'\n\nimport Elysia from '../../src'\nimport { req }"
},
{
"path": "test/cloudflare/.gitignore",
"chars": 45,
"preview": "node_modules/\r\npackage-lock.json\r\n.wrangler\r\n"
},
{
"path": "test/cloudflare/package.json",
"chars": 361,
"preview": "{\n\t\"name\": \"elysia-cf\",\n\t\"version\": \"0.0.0\",\n\t\"private\": true,\n\t\"scripts\": {\n\t\t\"dev\": \"wrangler dev\",\n\t\t\"start\": \"wrangl"
},
{
"path": "test/cloudflare/script/test.ts",
"chars": 558,
"preview": "const server = Bun.spawn({\n\tcmd: ['bunx', 'wrangler', 'dev', '--port', '8787', '--local'],\n})\n\nBun.sleepSync(750)\n\nsetIn"
},
{
"path": "test/cloudflare/src/index.ts",
"chars": 289,
"preview": "import { Elysia, t } from 'elysia'\nimport { CloudflareAdapter } from 'elysia/adapter/cloudflare-worker'\n\nconst sub = new"
},
{
"path": "test/cloudflare/tsconfig.json",
"chars": 1563,
"preview": "{\n\t\"compilerOptions\": {\n\t\t/* Visit https://aka.ms/tsconfig.json to read more about this file */\n\n\t\t/* Set the JavaScript"
},
{
"path": "test/cloudflare/worker-configuration.d.ts",
"chars": 326980,
"preview": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b739a9c19cff1463949c4db47674ed86)\n// Ru"
},
{
"path": "test/cloudflare/wrangler.jsonc",
"chars": 280,
"preview": "/**\n * For more details on how to configure Wrangler, refer to:\n * https://developers.cloudflare.com/workers/wrangler/co"
},
{
"path": "test/cookie/explicit.test.ts",
"chars": 2335,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Cookie, createCookieJar } from '../../src/cookies'\nimport type "
},
{
"path": "test/cookie/implicit.test.ts",
"chars": 2643,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { createCookieJar } from '../../src/cookies'\nimport type { Contex"
},
{
"path": "test/cookie/response.test.ts",
"chars": 8105,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia, t } from '../../src'\nimport { req } from '../utils'\nimp"
},
{
"path": "test/cookie/signature.test.ts",
"chars": 3204,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { parseCookie, Cookie } from '../../src/cookies'\nimport { signCoo"
},
{
"path": "test/cookie/unchanged.test.ts",
"chars": 6705,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../src'\n\ndescribe('Cookie - Unchanged Valu"
},
{
"path": "test/core/aot-strictpath.test.ts",
"chars": 1856,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\n\nconst req = (path: string) => new Re"
},
{
"path": "test/core/as.test.ts",
"chars": 5369,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../src'\nimport { req } from '../utils'\n\nde"
},
{
"path": "test/core/before-handle-arrow.test.ts",
"chars": 4102,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\n\ndescribe('beforeHandle with arrow fu"
},
{
"path": "test/core/compose.test.ts",
"chars": 527,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Type } from '@sinclair/typebox'\nimport { hasAdditionalPropertie"
},
{
"path": "test/core/config.test.ts",
"chars": 664,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../src'\n\ndescribe('config', () => {\n\tit('s"
},
{
"path": "test/core/context.test.ts",
"chars": 1388,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\nimport { req } from '../utils'\n\ndescr"
},
{
"path": "test/core/dynamic.test.ts",
"chars": 16418,
"preview": "import { Elysia, NotFoundError, status, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { p"
},
{
"path": "test/core/elysia.test.ts",
"chars": 10926,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\nim"
},
{
"path": "test/core/formdata.test.ts",
"chars": 2077,
"preview": "import { Elysia, t, form, file } from '../../src'\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '."
},
{
"path": "test/core/handle-error.test.ts",
"chars": 16049,
"preview": "import { Elysia, InternalServerError, NotFoundError, status, t } from '../../src'\n\nimport { describe, expect, it } from "
},
{
"path": "test/core/macro-lifecycle.test.ts",
"chars": 5681,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\n\ndescribe('macro beforeHandle lifecyc"
},
{
"path": "test/core/modules.test.ts",
"chars": 7124,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Elysia } from '../../src'\n\nimport { describe, expect, it"
},
{
"path": "test/core/mount.test.ts",
"chars": 5426,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { Elysia } from '../../src'\n\ndescribe('Mount', () => {\n\tit('pres"
},
{
"path": "test/core/native-static.test.ts",
"chars": 2952,
"preview": "// @ts-nocheck\nimport { Elysia } from '../../src'\nimport { describe, expect, it } from 'bun:test'\n\ndescribe('Native Stat"
},
{
"path": "test/core/normalize.test.ts",
"chars": 18145,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../src'\nimport { post, req } from '../util"
},
{
"path": "test/core/path.test.ts",
"chars": 2842,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\n\ndescribe('handle path with space"
},
{
"path": "test/core/redirect.test.ts",
"chars": 704,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\nimport { req } from '../utils'\n\ndescr"
},
{
"path": "test/core/sanitize.test.ts",
"chars": 1977,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { Elysia, t } from '../../src'\nimport { post } from '../utils'\n\n"
},
{
"path": "test/core/status.test.ts",
"chars": 3449,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport Elysia, { t } from '../../src'\nimport { req } from '../utils'\n\nd"
},
{
"path": "test/core/stop.test.ts",
"chars": 1170,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { Elysia } from '../../src'\n\ndescribe('Stop', () => {\n\tit('shuts"
},
{
"path": "test/extends/decorators.test.ts",
"chars": 4305,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { describe, it, expect } from 'bun:test'\nimport { Elysia }"
},
{
"path": "test/extends/error.test.ts",
"chars": 3211,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Elysia, t } from '../../src'\n\nimport { describe, expect,"
},
{
"path": "test/extends/models.test.ts",
"chars": 8826,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Elysia, t } from '../../src'\n\nimport { describe, expect,"
},
{
"path": "test/extends/store.test.ts",
"chars": 4011,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { describe, it, expect } from 'bun:test'\nimport { Elysia }"
},
{
"path": "test/hoc/index.test.ts",
"chars": 775,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { describe, it, expect } from 'bun:test'\nimport { Elysia }"
},
{
"path": "test/lifecycle/after-handle.test.ts",
"chars": 3625,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/after-response.test.ts",
"chars": 867,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/before-handle.test.ts",
"chars": 6861,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { delay, req } from '../utils"
},
{
"path": "test/lifecycle/derive.test.ts",
"chars": 7684,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/error.test.ts",
"chars": 11890,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {\n\tElysia,\n\tInternalServerError,\n\tParseError,\n\tValidationE"
},
{
"path": "test/lifecycle/hook-types.test.ts",
"chars": 1108,
"preview": "import { Elysia } from '../../src'\nimport { req } from '../../test/utils'\nimport { describe, it, expect } from 'bun:test"
},
{
"path": "test/lifecycle/map-derive.test.ts",
"chars": 3858,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/map-resolve.test.ts",
"chars": 4012,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/map-response.test.ts",
"chars": 7821,
"preview": "import { Elysia, form } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'"
},
{
"path": "test/lifecycle/parser.test.ts",
"chars": 9954,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { post } from '../utils'\n\n"
},
{
"path": "test/lifecycle/request.test.ts",
"chars": 1941,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req, delay } from '../utils"
},
{
"path": "test/lifecycle/resolve.test.ts",
"chars": 8172,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/lifecycle/response.test.ts",
"chars": 6527,
"preview": "import { Elysia, InternalServerError, t } from '../../src'\n\nimport { beforeEach, describe, expect, it } from 'bun:test'\n"
},
{
"path": "test/lifecycle/transform.test.ts",
"chars": 6933,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\nd"
},
{
"path": "test/macro/macro.test.ts",
"chars": 28541,
"preview": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { describe, it, expect } from 'bun:test'\nimport { Elysia, "
},
{
"path": "test/modules.ts",
"chars": 215,
"preview": "import { Elysia } from '../src'\n\nexport const lazy = async (app: Elysia) => app.get('/lazy', () => 'lazy')\n\nexport const"
},
{
"path": "test/node/.gitignore",
"chars": 32,
"preview": "node_modules/\r\npackage-lock.json"
},
{
"path": "test/node/cjs/index.js",
"chars": 576,
"preview": "if ('Bun' in globalThis) {\r\n\tthrow new Error('❌ Use Node.js to run this test!')\r\n}\r\n\r\nsetTimeout(() => {\r\n\tconsole.log('"
},
{
"path": "test/node/cjs/package.json",
"chars": 89,
"preview": "{\r\n \"type\": \"commonjs\",\r\n \"dependencies\": {\r\n \"elysia\": \"../../..\"\r\n }\r\n}"
},
{
"path": "test/node/esm/index.js",
"chars": 516,
"preview": "import { Elysia, t } from 'elysia'\r\n\r\nif ('Bun' in globalThis) {\r\n\tthrow new Error('❌ Use Node.js to run this test!')\r\n}"
},
{
"path": "test/node/esm/package.json",
"chars": 89,
"preview": "{\r\n \"type\": \"module\",\r\n \"dependencies\": {\r\n \"elysia\": \"../../..\"\r\n }\r\n}\r\n"
},
{
"path": "test/path/group.test.ts",
"chars": 7293,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia, t } from '../../src'\nimport { post, req } from '../util"
},
{
"path": "test/path/guard.test.ts",
"chars": 10565,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { post, req } from '../uti"
},
{
"path": "test/path/path.test.ts",
"chars": 14354,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { post, req } from '../uti"
},
{
"path": "test/plugins/affix.test.ts",
"chars": 2445,
"preview": "// @ts-nocheck\nimport { Elysia, t } from '../../src'\nimport { describe, it, expect } from 'bun:test'\n\nconst setup = new "
},
{
"path": "test/plugins/checksum.test.ts",
"chars": 8488,
"preview": "import { Elysia, t } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\nd"
},
{
"path": "test/plugins/error-propagation.test.ts",
"chars": 1310,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { Elysia } from '../../src'\nimport { req } from '../utils'\n\ndescr"
},
{
"path": "test/plugins/plugin.test.ts",
"chars": 544,
"preview": "import { Elysia } from '../../src'\r\n\r\nimport { describe, expect, it } from 'bun:test'\r\nimport { req } from '../utils'\r\n\r"
},
{
"path": "test/production/index.test.ts",
"chars": 603,
"preview": "import { Elysia, t } from '../../src'\nimport { describe, it, expect, beforeEach } from 'bun:test'\n\ndescribe('NODE_ENV=pr"
},
{
"path": "test/response/custom-response.test.ts",
"chars": 2253,
"preview": "import { Elysia } from '../../src'\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\n\nclas"
},
{
"path": "test/response/headers.test.ts",
"chars": 2149,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/response/range.test.ts",
"chars": 2815,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { Elysia } from '../../src'\nimport { req } from '../utils'\n\n// R"
},
{
"path": "test/response/redirect.test.ts",
"chars": 1531,
"preview": "import { Elysia } from '../../src'\n\nimport { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/response/sse-double-wrap.test.ts",
"chars": 2614,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { Elysia } from '../../src'\n\ndescribe('SSE - Response Double Wrap"
},
{
"path": "test/response/static.test.ts",
"chars": 2402,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { Elysia } from '../../src'\nimport { req } from '../utils'\n\ndesc"
},
{
"path": "test/response/stream.test.ts",
"chars": 18725,
"preview": "import { describe, expect, it } from 'bun:test'\nimport { req } from '../utils'\n\nimport { Elysia, sse } from '../../src'\n"
},
{
"path": "test/schema/schema-utils.test.ts",
"chars": 4655,
"preview": "import { describe, it, expect } from 'bun:test'\n\nimport { t } from '../../src'\nimport { hasProperty, getSchemaProperties"
},
{
"path": "test/standard-schema/reference.test.ts",
"chars": 7040,
"preview": "import { Elysia } from '../../src'\nimport { describe, it, expect } from 'bun:test'\nimport { z } from 'zod'\nimport { post"
},
{
"path": "test/standard-schema/standalone.test.ts",
"chars": 11594,
"preview": "import { Elysia, t } from '../../src'\nimport { describe, it, expect } from 'bun:test'\nimport { z } from 'zod'\nimport * a"
},
{
"path": "test/standard-schema/validate.test.ts",
"chars": 6552,
"preview": "import { Elysia } from '../../src'\nimport { describe, it, expect } from 'bun:test'\nimport { z } from 'zod'\nimport { post"
},
{
"path": "test/sucrose/bracket-pair-range-reverse.test.ts",
"chars": 2653,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { bracketPairRangeReverse } from '../../src/sucrose'\n\ndescribe('"
},
{
"path": "test/sucrose/bracket-pair-range.test.ts",
"chars": 2574,
"preview": "import { describe, expect, it } from 'bun:test'\n\nimport { bracketPairRange } from '../../src/sucrose'\n\ndescribe('bracket"
},
{
"path": "test/sucrose/extract-main-parameter.test.ts",
"chars": 1372,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { extractMainParameter } from '../../src/sucrose'\n\ndescribe('extr"
},
{
"path": "test/sucrose/find-alias.test.ts",
"chars": 4607,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { findAlias } from '../../src/sucrose'\n\ndescribe('find alias', ()"
},
{
"path": "test/sucrose/infer-body-reference.test.ts",
"chars": 3812,
"preview": "import { describe, it, expect } from 'bun:test'\nimport { inferBodyReference, Sucrose } from '../../src/sucrose'\n\ndescrib"
}
]
// ... and 70 more files (download for full content)
About this extraction
This page contains the full source code of the elysiajs/elysia GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 270 files (2.0 MB), approximately 540.8k tokens, and a symbol index with 1448 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.