Showing preview only (559K chars total). Download the full file or copy to clipboard to get everything.
Repository: QuarticCat/detypify
Branch: main
Commit: 039ed03ce769
Files: 55
Total size: 536.3 KB
Directory structure:
gitextract_b8obspm7/
├── .gitattributes
├── .github/
│ └── workflows/
│ ├── frontend.yml
│ ├── prek.yml
│ ├── py-code-check.yml
│ └── py-weekly-update.yml
├── .gitignore
├── .prettierignore
├── LICENSE
├── README.md
├── frontend/
│ ├── service/
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── index.ts
│ ├── ui/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public/
│ │ │ ├── CNAME
│ │ │ └── robots.txt
│ │ ├── scripts/
│ │ │ └── subset-font.ts
│ │ ├── src/
│ │ │ ├── App.svelte
│ │ │ ├── app.css
│ │ │ ├── lib/
│ │ │ │ ├── Candidate.svelte
│ │ │ │ ├── Canvas.svelte
│ │ │ │ ├── Card.svelte
│ │ │ │ ├── ContribPanel.svelte
│ │ │ │ ├── CopyButton.svelte
│ │ │ │ └── Preview.svelte
│ │ │ ├── main.ts
│ │ │ └── routes/
│ │ │ ├── Contrib.svelte
│ │ │ ├── FAQ.svelte
│ │ │ └── Home.svelte
│ │ ├── svelte.config.js
│ │ ├── tsconfig.app.json
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ └── worker/
│ ├── README.md
│ ├── package.json
│ ├── schema.sql
│ ├── src/
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── worker-configuration.d.ts
│ └── wrangler.toml
├── package.json
├── pnpm-workspace.yaml
├── prek.toml
├── pyproject.toml
└── python/
├── README.md
├── __init__.py
├── callbacks.py
├── dataset.py
├── model.py
├── proc_data.py
├── review_contrib.py
├── tex_to_typ.yaml
└── train.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
pnpm-lock.yaml linguist-generated
================================================
FILE: .github/workflows/frontend.yml
================================================
name: Frontend code quality check
on:
push:
branches: [main, "*dev"]
pull_request:
branches: [main, "*dev"]
types: [opened, synchronize]
workflow_dispatch:
jobs:
checks:
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: latest
cache: pnpm
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Cache postinstall artifacts
uses: actions/cache@v5
with:
path: frontend/ui/.cache
key: ${{ runner.os }}-frontend-postinstall-cache
- name: Prepare train folder
run: |
mkdir -p train
echo '[]' > train/infer.json
echo '{}' > train/contrib.json
echo '??' > train/model.onnx
working-directory: frontend/service
- name: Install dependencies
run: pnpm install
- name: Prettier check
run: pnpm exec prettier --check .
- name: Type check
run: pnpm run check
working-directory: frontend/ui
================================================
FILE: .github/workflows/prek.yml
================================================
name: Prek check
on:
push:
branches: [main, "*dev"]
pull_request:
branches: [main, "*dev"]
types: [opened, synchronize]
workflow_dispatch:
jobs:
prek:
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Prek check
uses: j178/prek-action@v1
================================================
FILE: .github/workflows/py-code-check.yml
================================================
name: Python code quality check
on:
push:
branches: [main, "*dev"]
pull_request:
branches: [main, "*dev"]
types: [opened, synchronize]
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Ruff check
uses: astral-sh/ruff-action@v3
with:
args: "format --check --diff ./python"
version: "latest"
================================================
FILE: .github/workflows/py-weekly-update.yml
================================================
name: Weekly updates for symbols
on:
workflow_dispatch:
schedule:
# weekly, Monday
- cron: "0 0 * * 1"
push:
paths:
# on new manual mapping added
- "python/tex_to_typ.yaml"
jobs:
check-typst-symbol-page:
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-slim
outputs:
should_run: ${{ steps.check.outputs.changed }}
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }} # Required for 'gh variable set'
TARGET_URL: "https://typst.app/docs/reference/symbols/sym/"
GH_REPO: ${{ github.repository }}
VAR_NAME: "TYPST_ETAG"
steps:
- name: Check ETag and Update
id: check
shell: bash
run: |
CURRENT_ETAG=$(curl -I -s "$TARGET_URL" | grep -i "^etag:" | sed 's/etag: //I' | tr -d '\r')
if [ -z "$CURRENT_ETAG" ]; then
echo "::error::Could not fetch ETag. Exiting."
exit 1
fi
STORED_ETAG=$(gh variable get "$VAR_NAME" --json value -q .value 2>/dev/null || echo "")
echo "Stored: '$STORED_ETAG'"
echo "Current: '$CURRENT_ETAG'"
if [ "$CURRENT_ETAG" != "$STORED_ETAG" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "⚡ ETag changed from '$STORED_ETAG' to '$CURRENT_ETAG'"
gh variable set "$VAR_NAME" --body "$CURRENT_ETAG"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "😴 No change detected."
fi
gen-info:
needs: check-typst-symbol-page
if: ${{ !failure() && (needs.check-typst-symbol-page.outputs.should_run == 'true' || github.event_name == 'push') }}
name: dataset-update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Run Generation
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
echo "ETag changed. Generating data."
uv run --no-project --with 'typer' --with 'msgspec' --with 'datasets' --with 'polars' --with 'beautifulsoup4' --with 'lxml' --python 3.13 python/proc_data.py --convert-data
- name: Cache Hugging Face datasets
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: huggingface-datasets-${{ hashFiles('python/tex_to_typ.yaml') }}
restore-keys: |
huggingface-datasets-
- name: Upload Data Artifacts
uses: actions/upload-artifact@v4
with:
name: generated-data
path: |
build/data/infer.json
build/data/contrib.json
trigger-training:
needs: gen-info
runs-on: ubuntu-latest
env:
TITLE: "Detypify Auto Training"
KAGGLE_API_TOKEN: ${{ secrets.KAGGLE_KEY }}
steps:
- uses: actions/checkout@v5
- name: Download Data Artifacts
uses: actions/download-artifact@v4
with:
name: generated-data
path: build/data
- name: Set up Notebook Kernel
shell: bash
env:
REPO_URL: "https://github.com/${{ github.repository }}"
BRANCH_NAME: ${{ github.ref_name }}
run: |
python -m pip install --upgrade kaggle --user
OUTPUT_NOTEBOOK="script.ipynb"
# Notice the escaped variables (\$) in the third block so GitHub Actions doesn't pre-evaluate them
cat <<EOM > "$OUTPUT_NOTEBOOK"
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!git clone --branch $BRANCH_NAME $REPO_URL.git detypify"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!cd detypify && pip install uv && uv --quiet sync && uv run python/train.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!for f in detypify/build/train/*/version_*/ckpts/*.onnx; do model=\$(echo \$f | cut -d/ -f4); cp \$f /kaggle/working/\$model.onnx && echo \"Copied \$f -> /kaggle/working/\$model.onnx\"; done"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
EOM
- name: Push Kernel
shell: bash
run: |
kaggle kernels init -p .
KAGGLE_USERNAME=$(jq -r '.id' kernel-metadata.json | cut -d'/' -f1)
KERNEL_SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')
KERNEL_ID="$KAGGLE_USERNAME/$KERNEL_SLUG"
echo "KERNEL_ID=$KERNEL_ID" >> $GITHUB_ENV
jq --arg id "$KERNEL_ID" \
--arg title "$TITLE" \
--arg code_file "script.ipynb" \
'.id = $id | .title = $title | .code_file = $code_file | .language = "python" | .kernel_type = "notebook" | .enable_gpu = true | .enable_internet = true' \
kernel-metadata.json > kernel-metadata.json.tmp && mv kernel-metadata.json.tmp kernel-metadata.json
cat kernel-metadata.json
# 6. Push the kernel
kaggle kernels push -p . --accelerator 'NvidiaTeslaT4'
- name: Check status
shell: bash
run: |
echo "Checking status for $KERNEL_ID..."
MAX_RETRIES=240
COUNT=0
while [ $COUNT -lt $MAX_RETRIES ]; do
status=$(kaggle kernels status "$KERNEL_ID" 2>&1)
echo "Status: $status"
if [[ "$status" == *"ERROR"* || "$status" == *"CANCEL"* ]]; then
echo "::error::Kernel execution failed."
exit 1
elif [[ "$status" == *"COMPLETE"* ]]; then
echo "Kernel execution completed successfully!"
exit 0
fi
sleep 60
COUNT=$((COUNT+1))
done
echo "::error::Kernel execution timed out after 4 hours."
exit 1
- name: Download artifacts
shell: bash
run: |
mkdir -p artifacts
# Use the exact KERNEL_ID (owner/slug) that Kaggle CLI expects
kaggle kernels output "$KERNEL_ID" -p artifacts
- name: Upload Trained Models to GitHub
uses: actions/upload-artifact@v4
with:
name: trained-onnx-models
path: artifacts/build/train
================================================
FILE: .gitignore
================================================
.venv/
__pycache__/
node_modules/
.wrangler/
.cache/
build/
train/
dist/
*.woff2
/*.zsh
/*.zip
# Ref: https://github.com/astral-sh/uv/issues/6349
uv.lock
================================================
FILE: .prettierignore
================================================
/data
/external
*.md
*.yml
*.yaml
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2024 QuarticCat
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
================================================
<div align="center">
<img src="./assets/logo.svg" alt="logo" width="150"/>
<h1>Detypify</h1>
<p>
Can't find some Typst symbol?
<a href="https://detypify.quarticcat.com/">Draw it!</a>
</p>
</div>
## Features
- **PWA**: installable and works offline
- **Tiny model**: fast to load and run
- **Decent symbol set**: support 400+ symbols
You can also use it in [Tinymist](https://github.com/Myriad-Dreamin/tinymist).
## Development
### File Structure
```text
- python # training scripts
- frontend
- service # inference lib
- ui # web UI
- worker # Cloudflare worker
```
Check corresponding folders for more information.
Before you build frontend projects, make sure you have the `train` folder in [frontend/service](./frontend/service) by either:
- Train your own one, or
- Download from [NPM](https://www.npmjs.com/package/detypify-service?activeTab=code).
### Logo
Source: [assets/manuscript.svg](./assets/manuscript.svg) (requires [*NewComputerModernMath*](https://ctan.org/pkg/newcomputermodern) font)
To compile it for production:
```console
$ cd assets
$ inkscape manuscript.svg --export-text-to-path --export-filename=logo.svg # convert text to path
$ bunx svgo --multipass logo.svg # optimize SVG
```
## License
MIT
================================================
FILE: frontend/service/README.md
================================================
# Detypify Service
Integrate Detypify into your own projects.
## Example
```typescript
import { Detypify, inferSyms } from "detypify-service";
const session = await Detypify.create();
const storkes = [[[0, 0], [1, 1]]];
const scores = await session.infer(strokes);
const candidates = Array.from(scores.keys());
candidates.sort((a, b) => scores[b] - scores[a]);
console.log(inferSyms[candidates[0]]);
```
## API Reference
- `ortEnv`: Re-export of [`onnxruntime-web.env`](https://onnxruntime.ai/docs/tutorials/web/env-flags-and-session-options.html). Used to configure onnxruntime.
Note: Recent `onnxruntime-web` builds ship bundled wasm by default; use the `onnxruntime-web-use-extern-wasm` export condition to opt into external wasm loading (see the official `exports` in https://github.com/microsoft/onnxruntime/blob/main/js/web/package.json).
- `inferSyms`: Model's output symbol data.
- `contribSyms`: Mapping from Typst symbol names to characters.
- `Detypify`: The main type.
- Use `Detypify.create()` to create an instance.
- Use `instance.infer(strokes)` to inference scores of each symbol.
The higher `scores[i]` is, the more likely your strokes is `inferSyms[i]`.
================================================
FILE: frontend/service/package.json
================================================
{
"name": "detypify-service",
"type": "module",
"version": "0.3.0",
"description": "Typst symbol classifier",
"license": "MIT",
"repository": "github:QuarticCat/detypify",
"homepage": "https://detypify.quarticcat.com/",
"author": "QuarticCat <QuarticCat@pm.me> (https://github.com/QuarticCat)",
"keywords": [
"js",
"typst",
"detypify",
"onnxruntime"
],
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"files": [
"dist",
"train/*.json",
"train/*.onnx"
],
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
"prepare": "tsdown"
},
"dependencies": {
"onnxruntime-web": "=1.23.2"
},
"devDependencies": {
"tsdown": "^0.21.4",
"typescript": "^5.9.3"
}
}
================================================
FILE: frontend/service/src/index.ts
================================================
import contribSymsRaw from "../train/contrib.json";
import inferSymsRaw from "../train/infer.json";
import { InferenceSession, Tensor } from "onnxruntime-web/wasm";
export { env as ortEnv } from "onnxruntime-web/wasm";
const modelUrl = new URL("../train/model.onnx", import.meta.url).href;
export interface SymbolInfo {
char: string;
names: string[];
shorthand?: string;
mathShorthand?: string;
markupShorthand?: string;
}
export type Point = [number, number];
export type Stroke = Point[];
export type Strokes = Stroke[];
/**
* Model's output symbol data.
*/
export const inferSyms = inferSymsRaw as SymbolInfo[];
/**
* Mapping from Typst symbol names to characters.
*/
export const contribSyms = contribSymsRaw as Record<string, string>;
/**
* Normalize strokes and draw them to canvas.
*/
export function drawStrokes(strokes: Strokes): HTMLCanvasElement {
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 224;
const ctx = canvas.getContext("2d", { willReadFrequently: true });
if (!ctx) {
throw new Error("Failed to get 2D canvas context.");
}
ctx.fillStyle = "black";
ctx.strokeStyle = "white";
ctx.lineWidth = 8;
// Find bounding rect.
let minX = Infinity;
let maxX = -Infinity;
let minY = Infinity;
let maxY = -Infinity;
for (const stroke of strokes) {
for (const [x, y] of stroke) {
minX = Math.min(minX, x);
maxX = Math.max(maxX, x);
minY = Math.min(minY, y);
maxY = Math.max(maxY, y);
}
}
// Normalize.
const padding = 10;
const targetSize = canvas.width - 2 * padding;
let width = Math.max(maxX - minX, maxY - minY);
const scale = width > 1e-6 ? targetSize / width : 1;
const centerX = (minX + maxX) / 2;
const centerY = (minY + maxY) / 2;
// Draw to canvas.
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (const stroke of strokes) {
ctx.beginPath();
for (const [x, y] of stroke) {
const targetX = (x - centerX) * scale + canvas.width / 2;
const targetY = (y - centerY) * scale + canvas.width / 2;
ctx.lineTo(Math.round(targetX), Math.round(targetY));
}
ctx.stroke();
}
return canvas;
}
/**
* Typst symbol classifier.
*/
export class Detypify {
private sess: InferenceSession;
constructor(sess: InferenceSession) {
this.sess = sess;
}
/**
* Load ONNX runtime and the model.
*/
static async create(): Promise<Detypify> {
return new Detypify(await InferenceSession.create(modelUrl));
}
/**
* Inference scores of each symbol.
*
* The higher `scores[i]` is, the more likely your strokes is `inferSyms[i]`.
*/
async infer(strokes: Strokes): Promise<Float32Array> {
const canvas = drawStrokes(strokes);
const ctx = canvas.getContext("2d", { willReadFrequently: true });
if (!ctx) {
throw new Error("Failed to get 2D canvas context.");
}
// To greyscale.
const rgba = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
const grey = new Float32Array(rgba.length / 4);
for (let i = 0; i < grey.length; ++i) {
grey[i] = rgba[i * 4] / 255;
}
// Infer.
const tensor = new Tensor("float32", grey, [1, 1, canvas.width, canvas.height]);
const outputs = await this.sess.run({ [this.sess.inputNames[0]]: tensor });
return outputs[this.sess.outputNames[0]].data as Float32Array;
}
}
================================================
FILE: frontend/ui/README.md
================================================
# Detypify UI
A frontend for the Detypify web experience.
## Development
```console
$ bun run dev # start Vite dev server
$ bun run build # build for production
$ bun run preview # preview production build locally
$ bun run check # run type checks
```
================================================
FILE: frontend/ui/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Detypify</title>
<meta name="description" content="Typst symbol classifier" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="preload" href="/NewCMMath-Detypify.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.2/dist/ort-wasm-simd-threaded.mjs"
crossorigin
/>
<link
rel="preload"
href="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.2/dist/ort-wasm-simd-threaded.wasm"
as="fetch"
type="application/wasm"
crossorigin
/>
<!-- TODO: The ONNX file is not preloaded. -->
</head>
<body class="bg-white text-gray-900 dark:bg-gray-800 dark:text-gray-100">
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
================================================
FILE: frontend/ui/package.json
================================================
{
"name": "detypify-ui",
"private": true,
"version": "0.3.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
"postinstall": "node scripts/subset-font.ts"
},
"dependencies": {
"detypify-service": "workspace:*"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@tailwindcss/vite": "^4.2.2",
"@tsconfig/svelte": "^5.0.8",
"@types/node": "^25.5.0",
"@vite-pwa/assets-generator": "^1.0.2",
"flowbite": "^4.0.1",
"flowbite-svelte": "^1.31.0",
"flowbite-svelte-icons": "^3.1.0",
"svelte": "^5.54.0",
"svelte-check": "^4.4.5",
"tailwindcss": "^4.2.2",
"typescript": "~5.9.3",
"vite": "^8.0.1",
"vite-plugin-pwa": "^1.2.0"
}
}
================================================
FILE: frontend/ui/public/CNAME
================================================
detypify.quarticcat.com
================================================
FILE: frontend/ui/public/robots.txt
================================================
User-agent: *
Allow: /
================================================
FILE: frontend/ui/scripts/subset-font.ts
================================================
import { contribSyms } from "detypify-service";
import { execSync } from "node:child_process";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const FONT_URL = "https://mirrors.ctan.org/fonts/newcomputermodern/otf/NewCMMath-Regular.otf";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const cacheDir = path.join(root, ".cache");
const fontPath = path.join(cacheDir, "NewCMMath-Regular.otf");
const textPath = path.join(cacheDir, "NewCMMath-Detypify.txt");
const outputDir = path.join(root, "public");
const outputPath = path.join(outputDir, "NewCMMath-Detypify.woff2");
// Download font or read from cache.
await fs.access(fontPath).catch(async () => {
await fs.mkdir(cacheDir, { recursive: true });
const res = await fetch(FONT_URL);
if (!res.ok) throw new Error(`Failed to download font: ${res.status} ${res.statusText}`);
await fs.writeFile(fontPath, Buffer.from(await res.arrayBuffer()));
});
// Generate font subset.
await fs.writeFile(textPath, Object.values(contribSyms).join(""));
execSync(
`uvx --from=fonttools[woff] pyftsubset ${fontPath} --text-file=${textPath} --flavor=woff2 --output-file=${outputPath}`,
{ stdio: "inherit" },
);
================================================
FILE: frontend/ui/src/App.svelte
================================================
<script lang="ts">
import Contrib from "./routes/Contrib.svelte";
import FAQ from "./routes/FAQ.svelte";
import Home from "./routes/Home.svelte";
import { Detypify, ortEnv } from "detypify-service";
import { Navbar, NavBrand, NavLi, NavUl, NavHamburger } from "flowbite-svelte";
import { Spinner, DarkMode, Tooltip, ToolbarButton, Heading } from "flowbite-svelte";
import { GithubSolid } from "flowbite-svelte-icons";
import { onMount } from "svelte";
import { fade } from "svelte/transition";
ortEnv.wasm.numThreads = 1;
ortEnv.wasm.wasmPaths = "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.2/dist/";
let activeHash = $state("#");
onMount(() => {
const updateHash = () => {
activeHash = window.location.hash || "#";
};
updateHash();
window.addEventListener("hashchange", updateHash);
return () => window.removeEventListener("hashchange", updateHash);
});
</script>
<Navbar>
<NavBrand href="/">
<!-- TODO: logo -->
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Detypify</span>
</NavBrand>
<div class="flex">
<NavUl activeUrl={activeHash}>
<NavLi href="#">Home</NavLi>
<NavLi href="#contrib">Contrib</NavLi>
<NavLi href="#faq">FAQ</NavLi>
</NavUl>
<ToolbarButton size="lg" class="my-auto" href="https://github.com/QuarticCat/detypify">
<GithubSolid size="lg" />
</ToolbarButton>
<Tooltip class="dark:bg-gray-900" placement="bottom">View on GitHub</Tooltip>
<DarkMode size="lg" class="my-auto" />
<Tooltip class="dark:bg-gray-900" placement="bottom">Toggle dark mode</Tooltip>
<NavHamburger />
</div>
</Navbar>
{#await Detypify.create()}
<div class="ui-container min-h-80">
<Spinner size="16" class="self-center" />
</div>
{:then session}
{#key activeHash}
<div class="ui-container" in:fade={{ duration: 50, delay: 50 }} out:fade={{ duration: 50 }}>
{#if activeHash === "#"}
<Home {session} />
{:else if activeHash === "#contrib"}
<Contrib />
{:else if activeHash === "#faq"}
<FAQ />
{:else}
<Heading>Not Found</Heading>
{/if}
</div>
{/key}
{/await}
================================================
FILE: frontend/ui/src/app.css
================================================
@import "tailwindcss";
@plugin "flowbite/plugin";
@custom-variant dark (&:where(.dark, .dark *));
@theme {
--color-primary-50: #fff5f2;
--color-primary-100: #fff1ee;
--color-primary-200: #ffe4de;
--color-primary-300: #ffd5cc;
--color-primary-400: #ffbcad;
--color-primary-500: #fe795d;
--color-primary-600: #ef562f;
--color-primary-700: #eb4f27;
--color-primary-800: #cc4522;
--color-primary-900: #a5371b;
--color-secondary-50: #f0f9ff;
--color-secondary-100: #e0f2fe;
--color-secondary-200: #bae6fd;
--color-secondary-300: #7dd3fc;
--color-secondary-400: #38bdf8;
--color-secondary-500: #0ea5e9;
--color-secondary-600: #0284c7;
--color-secondary-700: #0369a1;
--color-secondary-800: #075985;
--color-secondary-900: #0c4a6e;
}
@source "../node_modules/flowbite-svelte/dist";
@source "../node_modules/flowbite-svelte-icons/dist";
@layer base {
@font-face {
font-family: NewCMMath-Detypify;
src:
local(NewComputerModernMath),
url(/NewCMMath-Detypify.woff2) format("woff2");
}
html {
scrollbar-width: none;
}
}
@layer components {
.ui-container {
@apply m-[2vw] flex flex-wrap justify-center gap-x-16 gap-y-4;
}
.ui-sub-container {
@apply flex flex-col gap-4;
}
.ui-hover-btn {
@apply text-gray-600 hover:text-black dark:text-gray-400 dark:hover:text-white;
}
.ui-close-btn {
@apply absolute top-1 right-1 p-2;
}
}
================================================
FILE: frontend/ui/src/lib/Candidate.svelte
================================================
<script lang="ts">
import Card from "./Card.svelte";
import CopyButton from "./CopyButton.svelte";
import type { SymbolInfo } from "detypify-service";
import { Avatar, P } from "flowbite-svelte";
const { info }: { info: SymbolInfo } = $props();
</script>
<Card>
{@const escape = `\\u{${info.char.codePointAt(0)?.toString(16).toUpperCase().padStart(4, "0")}}`}
{@const shorthand = info.shorthand ?? info.markupShorthand ?? info.mathShorthand}
{@const shorthandKind = info.markupShorthand ? "markup" : info.mathShorthand ? "math" : ""}
<CopyButton text={info.char}>
<Avatar cornerStyle="rounded" size="lg" class="font-[NewCMMath-Detypify] text-5xl">
{info.char}
</Avatar>
</CopyButton>
<div class="flex flex-col gap-y-1">
<P>
Name:
{#each info.names as name, i}
{i === 0 ? "" : " | "}
<CopyButton text={name}>
<code class="text-base font-medium">
{name}
</code>
</CopyButton>
{/each}
</P>
<P>
Escape:
<CopyButton text={escape}>
<code class="text-base font-medium">
{escape}
</code>
</CopyButton>
</P>
{#if shorthand}
<P>
Shorthand:
<CopyButton text={shorthand}>
<code class="text-base font-medium">
{shorthand}
</code>
</CopyButton>
{#if shorthandKind}
<span class="text-sm text-gray-500">({shorthandKind})</span>
{/if}
</P>
{/if}
</div>
</Card>
================================================
FILE: frontend/ui/src/lib/Canvas.svelte
================================================
<script lang="ts">
import type { Stroke, Strokes } from "detypify-service";
import { Tooltip } from "flowbite-svelte";
import { CloseOutline } from "flowbite-svelte-icons";
import { onMount } from "svelte";
let { strokes = $bindable() }: { strokes: Strokes } = $props();
let canvas: HTMLCanvasElement | undefined;
let ctx: CanvasRenderingContext2D | null | undefined;
let stroke: Stroke = [];
onMount(() => {
if (!canvas) return;
ctx = canvas.getContext("2d");
if (!ctx) return;
ctx.lineWidth = 5;
ctx.lineJoin = "round";
ctx.lineCap = "round";
});
// Every time stroke clears (e.g. refresh), clear canvas.
$effect(() => {
if (strokes.length > 0 || !ctx) return;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
});
function drawStart(event: PointerEvent) {
if (event.button !== 0 || !ctx) return;
const roundedX = Math.round(event.offsetX);
const roundedY = Math.round(event.offsetY);
stroke = [[roundedX, roundedY]];
ctx.beginPath();
ctx.moveTo(roundedX, roundedY);
ctx.lineTo(roundedX, roundedY);
ctx.stroke();
}
function drawMove(event: PointerEvent) {
if (stroke.length === 0 || !ctx) return;
const roundedX = Math.round(event.offsetX);
const roundedY = Math.round(event.offsetY);
const [lastX, lastY] = stroke[stroke.length - 1];
stroke.push([roundedX, roundedY]);
ctx.beginPath();
ctx.moveTo(lastX, lastY);
ctx.lineTo(roundedX, roundedY);
ctx.stroke();
}
function drawEnd() {
if (stroke.length === 0) return;
strokes = [...strokes, stroke];
stroke = [];
}
function drawClear() {
strokes = [];
}
</script>
<div class="relative w-80">
<canvas
width="320"
height="320"
class="touch-none rounded-lg border border-gray-200 bg-gray-100 shadow-md dark:border-0 dark:bg-gray-600"
bind:this={canvas}
onpointerdown={drawStart}
onpointermove={drawMove}
onpointerup={drawEnd}
onpointerleave={drawEnd}
onpointercancel={drawEnd}
></canvas>
<button type="button" class="ui-hover-btn ui-close-btn" onclick={drawClear}>
<CloseOutline class="size-6" />
<Tooltip class="dark:bg-gray-900">Clear</Tooltip>
</button>
</div>
================================================
FILE: frontend/ui/src/lib/Card.svelte
================================================
<script lang="ts">
import { fly } from "svelte/transition";
let { class: className = "", children, ...restProps } = $props();
</script>
<div
class={`flex flex-row items-center gap-x-4 rounded-lg border border-gray-200 bg-white p-4 text-gray-500 shadow-md dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 ${className}`}
in:fly|local={{ x: 20, duration: 50, delay: 50 }}
out:fly|local={{ x: 20, duration: 50 }}
{...restProps}
>
{@render children?.()}
</div>
================================================
FILE: frontend/ui/src/lib/ContribPanel.svelte
================================================
<script lang="ts">
import { contribSyms } from "detypify-service";
import type { Strokes } from "detypify-service";
import { Button, Input } from "flowbite-svelte";
import { RefreshOutline } from "flowbite-svelte-icons";
export type Sample = {
id: Uint32Array;
name: string;
strokes: Strokes;
};
const symKeys = Object.keys(contribSyms);
const contribUrl = import.meta.env.DEV
? "http://localhost:8787/contrib"
: "https://detypify.quarticcat.workers.dev/contrib";
let {
input = $bindable(),
strokes = $bindable(),
samples = $bindable(),
}: {
input: string;
strokes: Strokes;
samples: Sample[];
} = $props();
let submitting = $state(false);
const isValid = $derived(Boolean(contribSyms[input]));
function refresh() {
const old = input;
while ((input = symKeys[Math.floor(symKeys.length * Math.random())]) === old);
strokes = [];
}
function save() {
const sample = {
id: crypto.getRandomValues(new Uint32Array(4)),
name: input,
strokes,
};
samples = [sample, ...samples];
strokes = [];
}
function getToken(): number {
const existing = localStorage.getItem("token");
if (existing) return Number(existing);
const token = crypto.getRandomValues(new Uint32Array(1))[0].toString();
localStorage.setItem("token", token);
return Number(token);
}
async function submit() {
submitting = true;
try {
const response = await fetch(contribUrl, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
ver: 3,
token: getToken(),
samples: samples.map(({ name, strokes }) => [name, strokes]),
}),
});
samples = []; // clear samples only if success
window.alert(await response.text());
} catch (err) {
window.alert(err instanceof Error ? err.message : String(err));
}
submitting = false;
}
</script>
<Input type="text" placeholder="symbol" color={isValid ? "green" : "red"} bind:value={input}>
{#snippet right()}
<button type="button" class="ui-hover-btn" onclick={refresh}>
<RefreshOutline />
</button>
{/snippet}
</Input>
<div class="flex justify-around gap-4">
<Button class="w-full" disabled={!isValid || strokes.length === 0} onclick={save}>Save</Button>
<Button class="w-full" disabled={samples.length === 0} onclick={submit} loading={submitting}>Submit</Button>
</div>
================================================
FILE: frontend/ui/src/lib/CopyButton.svelte
================================================
<script lang="ts">
import { Tooltip } from "flowbite-svelte";
import type { Snippet } from "svelte";
let { children, text }: { children?: Snippet; text: string } = $props();
let tip = $state("Copy");
async function copy() {
await navigator.clipboard.writeText(text);
tip = "Copied!";
}
function reset() {
tip = "Copy";
}
</script>
<button type="button" class="ui-hover-btn" onclick={copy}>
{@render children?.()}
<Tooltip class="dark:bg-gray-900" onbeforetoggle={reset}>
{tip}
</Tooltip>
</button>
================================================
FILE: frontend/ui/src/lib/Preview.svelte
================================================
<script lang="ts">
import Card from "./Card.svelte";
import { contribSyms } from "detypify-service";
import { Avatar, Hr, Tooltip } from "flowbite-svelte";
import { CloseOutline } from "flowbite-svelte-icons";
const BLANK = "data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
const { name, img = BLANK, ondelete }: { name: string; img?: string; ondelete?: () => void } = $props();
</script>
<Card class="relative flex justify-center">
<Avatar cornerStyle="rounded" size="lg" class="font-[NewCMMath-Detypify] text-5xl">
<!-- Workaround Safari font rendering issues. -->
<span class="-m-5 p-5">{contribSyms[name]}</span>
</Avatar>
<Hr class="h-1 w-12 rounded" />
<Avatar cornerStyle="rounded" size="lg" src={img} />
{#if ondelete}
<button type="button" class="ui-hover-btn ui-close-btn" onclick={ondelete}>
<CloseOutline class="size-6" />
<Tooltip class="dark:bg-gray-900">Delete</Tooltip>
</button>
{/if}
</Card>
================================================
FILE: frontend/ui/src/main.ts
================================================
import App from "./App.svelte";
import "./app.css";
import { mount } from "svelte";
const app = mount(App, {
target: document.getElementById("app")!,
});
export default app;
================================================
FILE: frontend/ui/src/routes/Contrib.svelte
================================================
<script lang="ts">
import Canvas from "../lib/Canvas.svelte";
import ContribPanel from "../lib/ContribPanel.svelte";
import type { Sample } from "../lib/ContribPanel.svelte";
import Preview from "../lib/Preview.svelte";
import type { Strokes } from "detypify-service";
import { drawStrokes } from "detypify-service";
import { Hr, Alert } from "flowbite-svelte";
let input = $state("");
let strokes: Strokes = $state([]);
let samples: Sample[] = $state([]);
function draw(strokes: Strokes): string | undefined {
if (strokes.length === 0) return;
return drawStrokes(strokes)?.toDataURL();
}
</script>
<div class="ui-sub-container w-80">
<Canvas bind:strokes />
<ContribPanel bind:input bind:strokes bind:samples />
<Alert color="blue" border dismissable>
Select a symbol, draw it, submit your contribution and make Detypify better!
</Alert>
</div>
<div class="ui-sub-container w-100">
<Preview name={input} img={draw(strokes)} />
<Hr class="mx-auto h-2 w-60 rounded" />
{#each samples as { id, name, strokes }, idx (id)}
<Preview {name} img={draw(strokes)} ondelete={() => samples.splice(idx, 1)} />
{/each}
</div>
================================================
FILE: frontend/ui/src/routes/FAQ.svelte
================================================
<script lang="ts">
import { inferSyms } from "detypify-service";
import { AccordionItem, Accordion, A, P, Li, List } from "flowbite-svelte";
const supportedSyms = inferSyms.flatMap((info) => info.names);
supportedSyms.sort();
</script>
<div class="ui-sub-container w-180">
<Accordion>
<AccordionItem>
{#snippet header()}Can't find your symbol?{/snippet}
<P>
Supported symbols are listed in section below. To recognize characters out of this scope, consider
giving <A href="https://shapecatcher.com/">shapecatcher</A> a try!
</P>
</AccordionItem>
<AccordionItem>
{#snippet header()}Supported symbols?{/snippet}
<List>
{#each supportedSyms as name}
<Li>{name}</Li>
{/each}
</List>
</AccordionItem>
<AccordionItem>
{#snippet header()}Results are inaccurate?{/snippet}
<P>
Some privacy settings (like <A href="https://brave.com/shields/">Brave Shields</A>) have canvas
anti-fingerprinting, which might confuse the classifier. Make sure they are turned off for this site.
Don't worry! We don't collect any privacy data. This project is fully open-source and works locally on
your machine.
</P>
</AccordionItem>
<AccordionItem>
{#snippet header()}Use it offline?{/snippet}
<P>
Check the <A href="https://support.google.com/chrome/answer/9658361">guide</A>.
</P>
</AccordionItem>
<AccordionItem>
{#snippet header()}Support us{/snippet}
<P>
Star this project on <A href="https://github.com/QuarticCat/detypify">GitHub</A>!
</P>
</AccordionItem>
</Accordion>
</div>
================================================
FILE: frontend/ui/src/routes/Home.svelte
================================================
<script lang="ts">
import Candidate from "../lib/Candidate.svelte";
import Canvas from "../lib/Canvas.svelte";
import type { Strokes } from "detypify-service";
import { Detypify, inferSyms } from "detypify-service";
import { Alert, Button } from "flowbite-svelte";
import { fly } from "svelte/transition";
const { session }: { session: Detypify } = $props();
let strokes: Strokes = $state([]);
let candidates: number[] = $state([]);
let numToShow = $state(5);
// Every time stroke changes, reset numToShow and infer candidates.
$effect(() => {
numToShow = 5;
if (strokes.length === 0) {
candidates = [];
return;
}
session.infer(strokes).then((scores) => {
const keys = Array.from(scores.keys());
keys.sort((a, b) => scores[b] - scores[a]);
candidates = keys;
});
});
</script>
<div class="ui-sub-container w-80">
<Canvas bind:strokes />
{#if "brave" in navigator}
<Alert color="yellow" border dismissable>
If you are using Brave, please turn off Shields for this site, or it won't work properly.
</Alert>
{/if}
</div>
<div class="ui-sub-container w-100">
{#each candidates.slice(0, numToShow) as i (i)}
<Candidate info={inferSyms[i]} />
{/each}
{#if candidates.length > 0}
<div
in:fly|local={{ x: 20, duration: 50, delay: 50 }}
out:fly|local={{ x: 20, duration: 50 }}
class="w-fit self-center"
>
<Button outline size="sm" onclick={() => (numToShow += 5)}>Show More</Button>
</div>
{/if}
</div>
================================================
FILE: frontend/ui/svelte.config.js
================================================
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
export default {
preprocess: vitePreprocess(),
compilerOptions: {
runes: true,
},
};
================================================
FILE: frontend/ui/tsconfig.app.json
================================================
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"types": ["svelte", "vite/client"],
"baseUrl": ".",
"paths": {
"detypify-service": ["../service/dist/index.d.mts"]
},
"resolveJsonModule": true,
"noEmit": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS.
* Note that setting allowJs false does not prevent the use
* of JS in `.svelte` files.
*/
"allowJs": true,
"checkJs": true,
"moduleDetection": "force"
},
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
}
================================================
FILE: frontend/ui/tsconfig.json
================================================
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}
================================================
FILE: frontend/ui/tsconfig.node.json
================================================
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts", "scripts/*"]
}
================================================
FILE: frontend/ui/vite.config.ts
================================================
import { svelte } from "@sveltejs/vite-plugin-svelte";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
resolve: {
conditions: ["module", "browser", "onnxruntime-web-use-extern-wasm"],
},
assetsInclude: ["**/*.onnx"],
plugins: [
tailwindcss(),
svelte(),
VitePWA({
registerType: "autoUpdate",
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,onnx,woff2}"],
runtimeCaching: [
{
urlPattern: ({ url }) => url.pathname.includes("onnxruntime-web"),
handler: "CacheFirst",
options: { cacheName: "ort-cache" },
},
],
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
},
manifest: {
name: "Detypify",
short_name: "Detypify",
description: "Typst symbol classifier",
theme_color: "#ffffff",
},
pwaAssets: {
image: "public/favicon.svg",
},
}),
],
});
================================================
FILE: frontend/worker/README.md
================================================
# Detypify Worker
A Cloudflare Worker that accepts contributions from the web page and stores them in a D1 database.
## Development
```console
$ bun run dev # start local dev server
$ bun run deploy # deploy to Cloudflare
$ bun run cf-typegen # generate Cloudflare bindings/types (worker-configuration.d.ts)
```
================================================
FILE: frontend/worker/package.json
================================================
{
"name": "detypify-worker",
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy --minify",
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
},
"dependencies": {
"hono": "^4.12.8"
},
"devDependencies": {
"wrangler": "^4.75.0"
}
}
================================================
FILE: frontend/worker/schema.sql
================================================
-- $ bunx wrangler d1 execute detypify --remote --file=schema.sql
CREATE TABLE IF NOT EXISTS samples (
id INTEGER PRIMARY KEY,
ver INTEGER,
token INTEGER,
sym TEXT,
strokes TEXT
);
================================================
FILE: frontend/worker/src/index.ts
================================================
import { Hono } from "hono";
import { cors } from "hono/cors";
type Bindings = {
DB: D1Database;
};
type ContribPayload = {
ver: number;
token: number;
samples: [number, number][][];
};
const app = new Hono<{ Bindings: Bindings }>();
app.use("/*", cors());
app.post("/contrib", async (c) => {
const { ver, token, samples } = await c.req.json<ContribPayload>();
const stmt = c.env.DB.prepare("INSERT INTO samples (ver, token, sym, strokes) VALUES (?, ?, ?, ?)");
const inserts = samples.map(([sym, strokes]) => stmt.bind(ver, token, sym, JSON.stringify(strokes)));
await c.env.DB.batch(inserts);
return c.text("Thanks for your contributions!");
});
export default app;
================================================
FILE: frontend/worker/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"skipLibCheck": true,
"lib": ["ESNext"],
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx"
}
}
================================================
FILE: frontend/worker/worker-configuration.d.ts
================================================
/* eslint-disable */
// Generated by Wrangler by running `wrangler types --env-interface CloudflareBindings` (hash: f3858af3f182d14dabf0ceb8f03b1c78)
// Runtime types generated with workerd@1.20260111.0 2026-01-13
declare namespace Cloudflare {
interface GlobalProps {
mainModule: typeof import("./src/index");
}
interface Env {
DB: D1Database;
}
}
interface CloudflareBindings extends Cloudflare.Env {}
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* eslint-disable */
// noinspection JSUnusedGlobalSymbols
declare var onmessage: never;
/**
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
*/
readonly code: number;
static readonly INDEX_SIZE_ERR: number;
static readonly DOMSTRING_SIZE_ERR: number;
static readonly HIERARCHY_REQUEST_ERR: number;
static readonly WRONG_DOCUMENT_ERR: number;
static readonly INVALID_CHARACTER_ERR: number;
static readonly NO_DATA_ALLOWED_ERR: number;
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
static readonly NOT_FOUND_ERR: number;
static readonly NOT_SUPPORTED_ERR: number;
static readonly INUSE_ATTRIBUTE_ERR: number;
static readonly INVALID_STATE_ERR: number;
static readonly SYNTAX_ERR: number;
static readonly INVALID_MODIFICATION_ERR: number;
static readonly NAMESPACE_ERR: number;
static readonly INVALID_ACCESS_ERR: number;
static readonly VALIDATION_ERR: number;
static readonly TYPE_MISMATCH_ERR: number;
static readonly SECURITY_ERR: number;
static readonly NETWORK_ERR: number;
static readonly ABORT_ERR: number;
static readonly URL_MISMATCH_ERR: number;
static readonly QUOTA_EXCEEDED_ERR: number;
static readonly TIMEOUT_ERR: number;
static readonly INVALID_NODE_TYPE_ERR: number;
static readonly DATA_CLONE_ERR: number;
get stack(): any;
set stack(value: any);
}
type WorkerGlobalScopeEventMap = {
fetch: FetchEvent;
scheduled: ScheduledEvent;
queue: QueueEvent;
unhandledrejection: PromiseRejectionEvent;
rejectionhandled: PromiseRejectionEvent;
};
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
EventTarget: typeof EventTarget;
}
/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *
* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
*/
interface Console {
"assert"(condition?: boolean, ...data: any[]): void;
/**
* The **`console.clear()`** static method clears the console if possible.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
*/
clear(): void;
/**
* The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
*/
count(label?: string): void;
/**
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
info(...data: any[]): void;
/**
* The **`console.log()`** static method outputs a message to the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
*/
log(...data: any[]): void;
/**
* The **`console.table()`** static method displays tabular data as a table.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
*/
table(tabularData?: any, properties?: string[]): void;
/**
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
timeStamp(label?: string): void;
/**
* The **`console.trace()`** static method outputs a stack trace to the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
*/
trace(...data: any[]): void;
/**
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
warn(...data: any[]): void;
}
declare const console: Console;
type BufferSource = ArrayBufferView | ArrayBuffer;
type TypedArray =
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array;
declare namespace WebAssembly {
class CompileError extends Error {
constructor(message?: string);
}
class RuntimeError extends Error {
constructor(message?: string);
}
type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";
interface GlobalDescriptor {
value: ValueType;
mutable?: boolean;
}
class Global {
constructor(descriptor: GlobalDescriptor, value?: any);
value: any;
valueOf(): any;
}
type ImportValue = ExportValue | number;
type ModuleImports = Record<string, ImportValue>;
type Imports = Record<string, ModuleImports>;
type ExportValue = Function | Global | Memory | Table;
type Exports = Record<string, ExportValue>;
class Instance {
constructor(module: Module, imports?: Imports);
readonly exports: Exports;
}
interface MemoryDescriptor {
initial: number;
maximum?: number;
shared?: boolean;
}
class Memory {
constructor(descriptor: MemoryDescriptor);
readonly buffer: ArrayBuffer;
grow(delta: number): number;
}
type ImportExportKind = "function" | "global" | "memory" | "table";
interface ModuleExportDescriptor {
kind: ImportExportKind;
name: string;
}
interface ModuleImportDescriptor {
kind: ImportExportKind;
module: string;
name: string;
}
abstract class Module {
static customSections(module: Module, sectionName: string): ArrayBuffer[];
static exports(module: Module): ModuleExportDescriptor[];
static imports(module: Module): ModuleImportDescriptor[];
}
type TableKind = "anyfunc" | "externref";
interface TableDescriptor {
element: TableKind;
initial: number;
maximum?: number;
}
class Table {
constructor(descriptor: TableDescriptor, value?: any);
readonly length: number;
get(index: number): any;
grow(delta: number, value?: any): number;
set(index: number, value?: any): void;
}
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
function validate(bytes: BufferSource): boolean;
}
/**
* The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
*/
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
DOMException: typeof DOMException;
WorkerGlobalScope: typeof WorkerGlobalScope;
btoa(data: string): string;
atob(data: string): string;
setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
clearTimeout(timeoutId: number | null): void;
setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
clearInterval(timeoutId: number | null): void;
queueMicrotask(task: Function): void;
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
reportError(error: any): void;
fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
self: ServiceWorkerGlobalScope;
crypto: Crypto;
caches: CacheStorage;
scheduler: Scheduler;
performance: Performance;
Cloudflare: Cloudflare;
readonly origin: string;
Event: typeof Event;
ExtendableEvent: typeof ExtendableEvent;
CustomEvent: typeof CustomEvent;
PromiseRejectionEvent: typeof PromiseRejectionEvent;
FetchEvent: typeof FetchEvent;
TailEvent: typeof TailEvent;
TraceEvent: typeof TailEvent;
ScheduledEvent: typeof ScheduledEvent;
MessageEvent: typeof MessageEvent;
CloseEvent: typeof CloseEvent;
ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
ReadableStream: typeof ReadableStream;
WritableStream: typeof WritableStream;
WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
TransformStream: typeof TransformStream;
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
CountQueuingStrategy: typeof CountQueuingStrategy;
ErrorEvent: typeof ErrorEvent;
MessageChannel: typeof MessageChannel;
MessagePort: typeof MessagePort;
EventSource: typeof EventSource;
ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
ReadableByteStreamController: typeof ReadableByteStreamController;
WritableStreamDefaultController: typeof WritableStreamDefaultController;
TransformStreamDefaultController: typeof TransformStreamDefaultController;
CompressionStream: typeof CompressionStream;
DecompressionStream: typeof DecompressionStream;
TextEncoderStream: typeof TextEncoderStream;
TextDecoderStream: typeof TextDecoderStream;
Headers: typeof Headers;
Body: typeof Body;
Request: typeof Request;
Response: typeof Response;
WebSocket: typeof WebSocket;
WebSocketPair: typeof WebSocketPair;
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
AbortController: typeof AbortController;
AbortSignal: typeof AbortSignal;
TextDecoder: typeof TextDecoder;
TextEncoder: typeof TextEncoder;
navigator: Navigator;
Navigator: typeof Navigator;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
URLPattern: typeof URLPattern;
Blob: typeof Blob;
File: typeof File;
FormData: typeof FormData;
Crypto: typeof Crypto;
SubtleCrypto: typeof SubtleCrypto;
CryptoKey: typeof CryptoKey;
CacheStorage: typeof CacheStorage;
Cache: typeof Cache;
FixedLengthStream: typeof FixedLengthStream;
IdentityTransformStream: typeof IdentityTransformStream;
HTMLRewriter: typeof HTMLRewriter;
}
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
type: Type,
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
options?: EventTargetAddEventListenerOptions | boolean,
): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
type: Type,
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
options?: EventTargetEventListenerOptions | boolean,
): void;
/**
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
declare function btoa(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
declare function atob(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
declare function setTimeout<Args extends any[]>(
callback: (...args: Args) => void,
msDelay?: number,
...args: Args
): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
declare function clearTimeout(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
declare function setInterval<Args extends any[]>(
callback: (...args: Args) => void,
msDelay?: number,
...args: Args
): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
declare function clearInterval(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
declare function queueMicrotask(task: Function): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
declare function reportError(error: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
declare const self: ServiceWorkerGlobalScope;
/**
* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
* The Workers runtime implements the full surface of this API, but with some differences in
* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
* compared to those implemented in most browsers.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
*/
declare const crypto: Crypto;
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare const caches: CacheStorage;
declare const scheduler: Scheduler;
/**
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
* as well as timing of subrequests and other operations.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
*/
declare const performance: Performance;
declare const Cloudflare: Cloudflare;
declare const origin: string;
declare const navigator: Navigator;
interface TestController {}
interface ExecutionContext<Props = unknown> {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
env: Env,
ctx: ExecutionContext,
) => Response | Promise<Response>;
type ExportedHandlerTailHandler<Env = unknown> = (
events: TraceItem[],
env: Env,
ctx: ExecutionContext,
) => void | Promise<void>;
type ExportedHandlerTraceHandler<Env = unknown> = (
traces: TraceItem[],
env: Env,
ctx: ExecutionContext,
) => void | Promise<void>;
type ExportedHandlerTailStreamHandler<Env = unknown> = (
event: TailStream.TailEvent<TailStream.Onset>,
env: Env,
ctx: ExecutionContext,
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
type ExportedHandlerScheduledHandler<Env = unknown> = (
controller: ScheduledController,
env: Env,
ctx: ExecutionContext,
) => void | Promise<void>;
type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
batch: MessageBatch<Message>,
env: Env,
ctx: ExecutionContext,
) => void | Promise<void>;
type ExportedHandlerTestHandler<Env = unknown> = (
controller: TestController,
env: Env,
ctx: ExecutionContext,
) => void | Promise<void>;
interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown> {
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
tail?: ExportedHandlerTailHandler<Env>;
trace?: ExportedHandlerTraceHandler<Env>;
tailStream?: ExportedHandlerTailStreamHandler<Env>;
scheduled?: ExportedHandlerScheduledHandler<Env>;
test?: ExportedHandlerTestHandler<Env>;
email?: EmailExportedHandler<Env>;
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
}
interface StructuredSerializeOptions {
transfer?: any[];
}
declare abstract class Navigator {
sendBeacon(url: string, body?: BodyInit): boolean;
readonly userAgent: string;
readonly hardwareConcurrency: number;
readonly language: string;
readonly languages: string[];
}
interface AlarmInvocationInfo {
readonly isRetry: boolean;
readonly retryCount: number;
}
interface Cloudflare {
readonly compatibilityFlags: Record<string, boolean>;
}
interface DurableObject {
fetch(request: Request): Response | Promise<Response>;
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
}
type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<
T,
"alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
> & {
readonly id: DurableObjectId;
readonly name?: string;
};
interface DurableObjectId {
toString(): string;
equals(other: DurableObjectId): boolean;
readonly name?: string;
}
declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
idFromName(name: string): DurableObjectId;
idFromString(id: string): DurableObjectId;
get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
type DurableObjectRoutingMode = "primary-only";
interface DurableObjectNamespaceGetDurableObjectOptions {
locationHint?: DurableObjectLocationHint;
routingMode?: DurableObjectRoutingMode;
}
interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {}
interface DurableObjectState<Props = unknown> {
waitUntil(promise: Promise<any>): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
container?: Container;
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
getWebSockets(tag?: string): WebSocket[];
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
rollback(): void;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
}
interface DurableObjectStorage {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
sync(): Promise<void>;
sql: SqlStorage;
kv: SyncKvStorage;
transactionSync<T>(closure: () => T): T;
getCurrentBookmark(): Promise<string>;
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
end?: string;
prefix?: string;
reverse?: boolean;
limit?: number;
allowConcurrency?: boolean;
noCache?: boolean;
}
interface DurableObjectGetOptions {
allowConcurrency?: boolean;
noCache?: boolean;
}
interface DurableObjectGetAlarmOptions {
allowConcurrency?: boolean;
}
interface DurableObjectPutOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
noCache?: boolean;
}
interface DurableObjectSetAlarmOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
}
declare class WebSocketRequestResponsePair {
constructor(request: string, response: string);
get request(): string;
get response(): string;
}
interface AnalyticsEngineDataset {
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
}
interface AnalyticsEngineDataPoint {
indexes?: ((ArrayBuffer | string) | null)[];
doubles?: number[];
blobs?: ((ArrayBuffer | string) | null)[];
}
/**
* The **`Event`** interface represents an event which takes place on an `EventTarget`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
declare class Event {
constructor(type: string, init?: EventInit);
/**
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
get composed(): boolean;
/**
* The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
*/
get bubbles(): boolean;
/**
* The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
*/
get cancelable(): boolean;
/**
* The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
*/
get defaultPrevented(): boolean;
/**
* The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
*/
get returnValue(): boolean;
/**
* The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
get currentTarget(): EventTarget | undefined;
/**
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
*/
get srcElement(): EventTarget | undefined;
/**
* The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
*/
get timeStamp(): number;
/**
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
composedPath(): EventTarget[];
static readonly NONE: number;
static readonly CAPTURING_PHASE: number;
static readonly AT_TARGET: number;
static readonly BUBBLING_PHASE: number;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
type EventListener<EventType extends Event = Event> = (event: EventType) => void;
interface EventListenerObject<EventType extends Event = Event> {
handleEvent(event: EventType): void;
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> =
| EventListener<EventType>
| EventListenerObject<EventType>;
/**
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
constructor();
/**
* The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener<Type extends keyof EventMap>(
type: Type,
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
options?: EventTargetAddEventListenerOptions | boolean,
): void;
/**
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(
type: Type,
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
options?: EventTargetEventListenerOptions | boolean,
): void;
/**
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
}
interface EventTargetEventListenerOptions {
capture?: boolean;
}
interface EventTargetAddEventListenerOptions {
capture?: boolean;
passive?: boolean;
once?: boolean;
signal?: AbortSignal;
}
interface EventTargetHandlerObject {
handleEvent: (event: Event) => any | undefined;
}
/**
* The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
*/
declare class AbortController {
constructor();
/**
* The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
*/
get signal(): AbortSignal;
/**
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
abort(reason?: any): void;
}
/**
* The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
*/
declare abstract class AbortSignal extends EventTarget {
/**
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
static abort(reason?: any): AbortSignal;
/**
* The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
*/
static timeout(delay: number): AbortSignal;
/**
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
*/
get aborted(): boolean;
/**
* The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
*/
get reason(): any;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
get onabort(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
set onabort(value: any | null);
/**
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
interface Scheduler {
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
}
interface SchedulerWaitOptions {
signal?: AbortSignal;
}
/**
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
declare class CustomEvent<T = any> extends Event {
constructor(type: string, init?: CustomEventCustomEventInit);
/**
* The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
*/
get detail(): T;
}
interface CustomEventCustomEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
detail?: any;
}
/**
* The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
*/
declare class Blob {
constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
/**
* The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
*/
get size(): number;
/**
* The **`type`** read-only property of the Blob interface returns the MIME type of the file.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
*/
get type(): string;
/**
* The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)
*/
slice(start?: number, end?: number, type?: string): Blob;
/**
* The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)
*/
bytes(): Promise<Uint8Array>;
/**
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)
*/
stream(): ReadableStream;
}
interface BlobOptions {
type?: string;
}
/**
* The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
*/
declare class File extends Blob {
constructor(
bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
name: string,
options?: FileOptions,
);
/**
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
get lastModified(): number;
}
interface FileOptions {
type?: string;
lastModified?: number;
}
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
open(cacheName: string): Promise<Cache>;
readonly default: Cache;
}
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
*/
declare abstract class Cache {
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
put(request: RequestInfo | URL, response: Response): Promise<void>;
}
interface CacheQueryOptions {
ignoreMethod?: boolean;
}
/**
* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
* The Workers runtime implements the full surface of this API, but with some differences in
* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
* compared to those implemented in most browsers.
*
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
getRandomValues<
T extends
| Int8Array
| Uint8Array
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| BigInt64Array
| BigUint64Array,
>(buffer: T): T;
/**
* The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
*/
randomUUID(): string;
DigestStream: typeof DigestStream;
}
/**
* The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
*/
declare abstract class SubtleCrypto {
/**
* The **`encrypt()`** method of the SubtleCrypto interface encrypts data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)
*/
encrypt(
algorithm: string | SubtleCryptoEncryptAlgorithm,
key: CryptoKey,
plainText: ArrayBuffer | ArrayBufferView,
): Promise<ArrayBuffer>;
/**
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
decrypt(
algorithm: string | SubtleCryptoEncryptAlgorithm,
key: CryptoKey,
cipherText: ArrayBuffer | ArrayBufferView,
): Promise<ArrayBuffer>;
/**
* The **`sign()`** method of the SubtleCrypto interface generates a digital signature.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)
*/
sign(
algorithm: string | SubtleCryptoSignAlgorithm,
key: CryptoKey,
data: ArrayBuffer | ArrayBufferView,
): Promise<ArrayBuffer>;
/**
* The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)
*/
verify(
algorithm: string | SubtleCryptoSignAlgorithm,
key: CryptoKey,
signature: ArrayBuffer | ArrayBufferView,
data: ArrayBuffer | ArrayBufferView,
): Promise<boolean>;
/**
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)
*/
generateKey(
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
extractable: boolean,
keyUsages: string[],
): Promise<CryptoKey | CryptoKeyPair>;
/**
* The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)
*/
deriveKey(
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
baseKey: CryptoKey,
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
extractable: boolean,
keyUsages: string[],
): Promise<CryptoKey>;
/**
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
deriveBits(
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
baseKey: CryptoKey,
length?: number | null,
): Promise<ArrayBuffer>;
/**
* The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)
*/
importKey(
format: string,
keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
algorithm: string | SubtleCryptoImportKeyAlgorithm,
extractable: boolean,
keyUsages: string[],
): Promise<CryptoKey>;
/**
* The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(
format: string,
key: CryptoKey,
wrappingKey: CryptoKey,
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
): Promise<ArrayBuffer>;
/**
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
unwrapKey(
format: string,
wrappedKey: ArrayBuffer | ArrayBufferView,
unwrappingKey: CryptoKey,
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
extractable: boolean,
keyUsages: string[],
): Promise<CryptoKey>;
timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
}
/**
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)
*/
readonly extractable: boolean;
/**
* The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)
*/
readonly algorithm:
| CryptoKeyKeyAlgorithm
| CryptoKeyAesKeyAlgorithm
| CryptoKeyHmacKeyAlgorithm
| CryptoKeyRsaKeyAlgorithm
| CryptoKeyEllipticKeyAlgorithm
| CryptoKeyArbitraryKeyAlgorithm;
/**
* The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)
*/
readonly usages: string[];
}
interface CryptoKeyPair {
publicKey: CryptoKey;
privateKey: CryptoKey;
}
interface JsonWebKey {
kty: string;
use?: string;
key_ops?: string[];
alg?: string;
ext?: boolean;
crv?: string;
x?: string;
y?: string;
d?: string;
n?: string;
e?: string;
p?: string;
q?: string;
dp?: string;
dq?: string;
qi?: string;
oth?: RsaOtherPrimesInfo[];
k?: string;
}
interface RsaOtherPrimesInfo {
r?: string;
d?: string;
t?: string;
}
interface SubtleCryptoDeriveKeyAlgorithm {
name: string;
salt?: ArrayBuffer | ArrayBufferView;
iterations?: number;
hash?: string | SubtleCryptoHashAlgorithm;
$public?: CryptoKey;
info?: ArrayBuffer | ArrayBufferView;
}
interface SubtleCryptoEncryptAlgorithm {
name: string;
iv?: ArrayBuffer | ArrayBufferView;
additionalData?: ArrayBuffer | ArrayBufferView;
tagLength?: number;
counter?: ArrayBuffer | ArrayBufferView;
length?: number;
label?: ArrayBuffer | ArrayBufferView;
}
interface SubtleCryptoGenerateKeyAlgorithm {
name: string;
hash?: string | SubtleCryptoHashAlgorithm;
modulusLength?: number;
publicExponent?: ArrayBuffer | ArrayBufferView;
length?: number;
namedCurve?: string;
}
interface SubtleCryptoHashAlgorithm {
name: string;
}
interface SubtleCryptoImportKeyAlgorithm {
name: string;
hash?: string | SubtleCryptoHashAlgorithm;
length?: number;
namedCurve?: string;
compressed?: boolean;
}
interface SubtleCryptoSignAlgorithm {
name: string;
hash?: string | SubtleCryptoHashAlgorithm;
dataLength?: number;
saltLength?: number;
}
interface CryptoKeyKeyAlgorithm {
name: string;
}
interface CryptoKeyAesKeyAlgorithm {
name: string;
length: number;
}
interface CryptoKeyHmacKeyAlgorithm {
name: string;
hash: CryptoKeyKeyAlgorithm;
length: number;
}
interface CryptoKeyRsaKeyAlgorithm {
name: string;
modulusLength: number;
publicExponent: ArrayBuffer | ArrayBufferView;
hash?: CryptoKeyKeyAlgorithm;
}
interface CryptoKeyEllipticKeyAlgorithm {
name: string;
namedCurve: string;
}
interface CryptoKeyArbitraryKeyAlgorithm {
name: string;
hash?: CryptoKeyKeyAlgorithm;
namedCurve?: string;
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
readonly digest: Promise<ArrayBuffer>;
get bytesWritten(): number | bigint;
}
/**
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
declare class TextDecoder {
constructor(label?: string, options?: TextDecoderConstructorOptions);
/**
* The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
*/
decode(input?: ArrayBuffer | ArrayBufferView, options?: TextDecoderDecodeOptions): string;
get encoding(): string;
get fatal(): boolean;
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
get encoding(): string;
}
interface TextDecoderConstructorOptions {
fatal: boolean;
ignoreBOM: boolean;
}
interface TextDecoderDecodeOptions {
stream: boolean;
}
interface TextEncoderEncodeIntoResult {
read: number;
written: number;
}
/**
* The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
*/
declare class ErrorEvent extends Event {
constructor(type: string, init?: ErrorEventErrorEventInit);
/**
* The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)
*/
get filename(): string;
/**
* The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)
*/
get message(): string;
/**
* The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)
*/
get lineno(): number;
/**
* The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)
*/
get colno(): number;
/**
* The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)
*/
get error(): any;
}
interface ErrorEventErrorEventInit {
message?: string;
filename?: string;
lineno?: number;
colno?: number;
error?: any;
}
/**
* The **`MessageEvent`** interface represents a message received by a target object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
*/
declare class MessageEvent extends Event {
constructor(type: string, initializer: MessageEventInit);
/**
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
data: ArrayBuffer | string;
}
/**
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
*/
append(name: string, value: string): void;
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
*/
append(name: string, value: Blob, filename?: string): void;
/**
* The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)
*/
delete(name: string): void;
/**
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
*/
getAll(name: string): (File | string)[];
/**
* The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)
*/
has(name: string): boolean;
/**
* The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
*/
set(name: string, value: string): void;
/**
* The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
*/
set(name: string, value: Blob, filename?: string): void;
/* Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[key: string, value: File | string]>;
/* Returns a list of keys in the list. */
keys(): IterableIterator<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<File | string>;
forEach<This = unknown>(
callback: (this: This, value: File | string, key: string, parent: FormData) => void,
thisArg?: This,
): void;
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
}
interface ContentOptions {
html?: boolean;
}
declare class HTMLRewriter {
constructor();
on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
transform(response: Response): Response;
}
interface HTMLRewriterElementContentHandlers {
element?(element: Element): void | Promise<void>;
comments?(comment: Comment): void | Promise<void>;
text?(element: Text): void | Promise<void>;
}
interface HTMLRewriterDocumentContentHandlers {
doctype?(doctype: Doctype): void | Promise<void>;
comments?(comment: Comment): void | Promise<void>;
text?(text: Text): void | Promise<void>;
end?(end: DocumentEnd): void | Promise<void>;
}
interface Doctype {
readonly name: string | null;
readonly publicId: string | null;
readonly systemId: string | null;
}
interface Element {
tagName: string;
readonly attributes: IterableIterator<string[]>;
readonly removed: boolean;
readonly namespaceURI: string;
getAttribute(name: string): string | null;
hasAttribute(name: string): boolean;
setAttribute(name: string, value: string): Element;
removeAttribute(name: string): Element;
before(content: string | ReadableStream | Response, options?: ContentOptions): Element;
after(content: string | ReadableStream | Response, options?: ContentOptions): Element;
prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;
append(content: string | ReadableStream | Response, options?: ContentOptions): Element;
replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;
remove(): Element;
removeAndKeepContent(): Element;
setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
}
interface EndTag {
name: string;
before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;
remove(): EndTag;
}
interface Comment {
text: string;
readonly removed: boolean;
before(content: string, options?: ContentOptions): Comment;
after(content: string, options?: ContentOptions): Comment;
replace(content: string, options?: ContentOptions): Comment;
remove(): Comment;
}
interface Text {
readonly text: string;
readonly lastInTextNode: boolean;
readonly removed: boolean;
before(content: string | ReadableStream | Response, options?: ContentOptions): Text;
after(content: string | ReadableStream | Response, options?: ContentOptions): Text;
replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;
remove(): Text;
}
interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
respondWith(promise: Response | Promise<Response>): void;
passThroughOnException(): void;
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)
*/
has(name: string): boolean;
/**
* The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)
*/
set(name: string, value: string): void;
/**
* The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)
*/
append(name: string, value: string): void;
/**
* The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)
*/
delete(name: string): void;
forEach<This = unknown>(
callback: (this: This, value: string, key: string, parent: Headers) => void,
thisArg?: This,
): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
entries(): IterableIterator<[key: string, value: string]>;
/* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
keys(): IterableIterator<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
}
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
get bodyUsed(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
arrayBuffer(): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
bytes(): Promise<Uint8Array>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
text(): Promise<string>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
json<T>(): Promise<T>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
formData(): Promise<FormData>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
blob(): Promise<Blob>;
}
/**
* The **`Response`** interface of the Fetch API represents the response to a request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
*/
declare var Response: {
prototype: Response;
new (body?: BodyInit | null, init?: ResponseInit): Response;
error(): Response;
redirect(url: string, status?: number): Response;
json(any: any, maybeInit?: ResponseInit | Response): Response;
};
/**
* The **`Response`** interface of the Fetch API represents the response to a request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
*/
interface Response extends Body {
/**
* The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)
*/
clone(): Response;
/**
* The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)
*/
status: number;
/**
* The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)
*/
statusText: string;
/**
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
headers: Headers;
/**
* The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)
*/
ok: boolean;
/**
* The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)
*/
redirected: boolean;
/**
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
url: string;
webSocket: WebSocket | null;
cf: any | undefined;
/**
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
type: "default" | "error";
}
interface ResponseInit {
status?: number;
statusText?: string;
headers?: HeadersInit;
cf?: any;
webSocket?: WebSocket | null;
encodeBody?: "automatic" | "manual";
}
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;
/**
* The **`Request`** interface of the Fetch API represents a resource request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
*/
declare var Request: {
prototype: Request;
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
input: RequestInfo<CfProperties> | URL,
init?: RequestInit<Cf>,
): Request<CfHostMetadata, Cf>;
};
/**
* The **`Request`** interface of the Fetch API represents a resource request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {
/**
* The **`clone()`** method of the Request interface creates a copy of the current `Request` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)
*/
clone(): Request<CfHostMetadata, Cf>;
/**
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
method: string;
/**
* The **`url`** read-only property of the Request interface contains the URL of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
*/
url: string;
/**
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
headers: Headers;
/**
* The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
*/
redirect: string;
fetcher: Fetcher | null;
/**
* The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
*/
signal: AbortSignal;
cf: Cf | undefined;
/**
* The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
*/
integrity: string;
/**
* The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
*/
keepalive: boolean;
/**
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
cache?: "no-store" | "no-cache";
}
interface RequestInit<Cf = CfProperties> {
/* A string to set request's method. */
method?: string;
/* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
headers?: HeadersInit;
/* A BodyInit object or null to set request's body. */
body?: BodyInit | null;
/* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
redirect?: string;
fetcher?: Fetcher | null;
cf?: Cf;
/* A string indicating how the request will interact with the browser's cache to set request's cache. */
cache?: "no-store" | "no-cache";
/* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
integrity?: string;
/* An AbortSignal to set request's signal. */
signal?: AbortSignal | null;
encodeResponseBody?: "automatic" | "manual";
}
type Service<
T extends
| (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
| Rpc.WorkerEntrypointBranded
| ExportedHandler<any, any, any>
| undefined = undefined,
> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
? Fetcher<InstanceType<T>>
: T extends Rpc.WorkerEntrypointBranded
? Fetcher<T>
: T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
? never
: Fetcher<undefined>;
type Fetcher<
T extends Rpc.EntrypointBranded | undefined = undefined,
Reserved extends string = never,
> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
};
interface KVNamespaceListKey<Metadata, Key extends string = string> {
name: Key;
expiration?: number;
metadata?: Metadata;
}
type KVNamespaceListResult<Metadata, Key extends string = string> =
| {
list_complete: false;
keys: KVNamespaceListKey<Metadata, Key>[];
cursor: string;
cacheStatus: string | null;
}
| {
list_complete: true;
keys: KVNamespaceListKey<Metadata, Key>[];
cacheStatus: string | null;
};
interface KVNamespace<Key extends string = string> {
get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
get(key: Key, type: "text"): Promise<string | null>;
get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;
get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
get(key: Key, type: "stream"): Promise<ReadableStream | null>;
get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;
get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;
get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;
get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;
get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;
get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;
get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;
get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;
get<ExpectedValue = unknown>(
key: Array<Key>,
options?: KVNamespaceGetOptions<"json">,
): Promise<Map<string, ExpectedValue | null>>;
list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;
put(
key: Key,
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
options?: KVNamespacePutOptions,
): Promise<void>;
getWithMetadata<Metadata = unknown>(
key: Key,
options?: Partial<KVNamespaceGetOptions<undefined>>,
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
type: "text",
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
key: Key,
type: "json",
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
type: "arrayBuffer",
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
type: "stream",
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
options: KVNamespaceGetOptions<"text">,
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
key: Key,
options: KVNamespaceGetOptions<"json">,
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
options: KVNamespaceGetOptions<"arrayBuffer">,
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Key,
options: KVNamespaceGetOptions<"stream">,
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
getWithMetadata<Metadata = unknown>(
key: Array<Key>,
type: "text",
): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
key: Array<Key>,
type: "json",
): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
getWithMetadata<Metadata = unknown>(
key: Array<Key>,
options?: Partial<KVNamespaceGetOptions<undefined>>,
): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
getWithMetadata<Metadata = unknown>(
key: Array<Key>,
options?: KVNamespaceGetOptions<"text">,
): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
key: Array<Key>,
options?: KVNamespaceGetOptions<"json">,
): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;
delete(key: Key): Promise<void>;
}
interface KVNamespaceListOptions {
limit?: number;
prefix?: string | null;
cursor?: string | null;
}
interface KVNamespaceGetOptions<Type> {
type: Type;
cacheTtl?: number;
}
interface KVNamespacePutOptions {
expiration?: number;
expirationTtl?: number;
metadata?: any | null;
}
interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
value: Value | null;
metadata: Metadata | null;
cacheStatus: string | null;
}
type QueueContentType = "text" | "bytes" | "json" | "v8";
interface Queue<Body = unknown> {
send(message: Body, options?: QueueSendOptions): Promise<void>;
sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;
}
interface QueueSendOptions {
contentType?: QueueContentType;
delaySeconds?: number;
}
interface QueueSendBatchOptions {
delaySeconds?: number;
}
interface MessageSendRequest<Body = unknown> {
body: Body;
contentType?: QueueContentType;
delaySeconds?: number;
}
interface QueueRetryOptions {
delaySeconds?: number;
}
interface Message<Body = unknown> {
readonly id: string;
readonly timestamp: Date;
readonly body: Body;
readonly attempts: number;
retry(options?: QueueRetryOptions): void;
ack(): void;
}
interface QueueEvent<Body = unknown> extends ExtendableEvent {
readonly messages: readonly Message<Body>[];
readonly queue: string;
retryAll(options?: QueueRetryOptions): void;
ackAll(): void;
}
interface MessageBatch<Body = unknown> {
readonly messages: readonly Message<Body>[];
readonly queue: string;
retryAll(options?: QueueRetryOptions): void;
ackAll(): void;
}
interface R2Error extends Error {
readonly name: string;
readonly code: number;
readonly message: string;
readonly action: string;
readonly stack: any;
}
interface R2ListOptions {
limit?: number;
prefix?: string;
cursor?: string;
delimiter?: string;
startAfter?: string;
include?: ("httpMetadata" | "customMetadata")[];
}
declare abstract class R2Bucket {
head(key: string): Promise<R2Object | null>;
get(
key: string,
options: R2GetOptions & {
onlyIf: R2Conditional | Headers;
},
): Promise<R2ObjectBody | R2Object | null>;
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
put(
key: string,
value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob,
options?: R2PutOptions & {
onlyIf: R2Conditional | Headers;
},
): Promise<R2Object | null>;
put(
key: string,
value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob,
options?: R2PutOptions,
): Promise<R2Object>;
createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
delete(keys: string | string[]): Promise<void>;
list(options?: R2ListOptions): Promise<R2Objects>;
}
interface R2MultipartUpload {
readonly key: string;
readonly uploadId: string;
uploadPart(
partNumber: number,
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
options?: R2UploadPartOptions,
): Promise<R2UploadedPart>;
abort(): Promise<void>;
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
}
interface R2UploadedPart {
partNumber: number;
etag: string;
}
declare abstract class R2Object {
readonly key: string;
readonly version: string;
readonly size: number;
readonly etag: string;
readonly httpEtag: string;
readonly checksums: R2Checksums;
readonly uploaded: Date;
readonly httpMetadata?: R2HTTPMetadata;
readonly customMetadata?: Record<string, string>;
readonly range?: R2Range;
readonly storageClass: string;
readonly ssecKeyMd5?: string;
writeHttpMetadata(headers: Headers): void;
}
interface R2ObjectBody extends R2Object {
get body(): ReadableStream;
get bodyUsed(): boolean;
arrayBuffer(): Promise<ArrayBuffer>;
bytes(): Promise<Uint8Array>;
text(): Promise<string>;
json<T>(): Promise<T>;
blob(): Promise<Blob>;
}
type R2Range =
| {
offset: number;
length?: number;
}
| {
offset?: number;
length: number;
}
| {
suffix: number;
};
interface R2Conditional {
etagMatches?: string;
etagDoesNotMatch?: string;
uploadedBefore?: Date;
uploadedAfter?: Date;
secondsGranularity?: boolean;
}
interface R2GetOptions {
onlyIf?: R2Conditional | Headers;
range?: R2Range | Headers;
ssecKey?: ArrayBuffer | string;
}
interface R2PutOptions {
onlyIf?: R2Conditional | Headers;
httpMetadata?: R2HTTPMetadata | Headers;
customMetadata?: Record<string, string>;
md5?: (ArrayBuffer | ArrayBufferView) | string;
sha1?: (ArrayBuffer | ArrayBufferView) | string;
sha256?: (ArrayBuffer | ArrayBufferView) | string;
sha384?: (ArrayBuffer | ArrayBufferView) | string;
sha512?: (ArrayBuffer | ArrayBufferView) | string;
storageClass?: string;
ssecKey?: ArrayBuffer | string;
}
interface R2MultipartOptions {
httpMetadata?: R2HTTPMetadata | Headers;
customMetadata?: Record<string, string>;
storageClass?: string;
ssecKey?: ArrayBuffer | string;
}
interface R2Checksums {
readonly md5?: ArrayBuffer;
readonly sha1?: ArrayBuffer;
readonly sha256?: ArrayBuffer;
readonly sha384?: ArrayBuffer;
readonly sha512?: ArrayBuffer;
toJSON(): R2StringChecksums;
}
interface R2StringChecksums {
md5?: string;
sha1?: string;
sha256?: string;
sha384?: string;
sha512?: string;
}
interface R2HTTPMetadata {
contentType?: string;
contentLanguage?: string;
contentDisposition?: string;
contentEncoding?: string;
cacheControl?: string;
cacheExpiry?: Date;
}
type R2Objects = {
objects: R2Object[];
delimitedPrefixes: string[];
} & (
| {
truncated: true;
cursor: string;
}
| {
truncated: false;
}
);
interface R2UploadPartOptions {
ssecKey?: ArrayBuffer | string;
}
declare abstract class ScheduledEvent extends ExtendableEvent {
readonly scheduledTime: number;
readonly cron: string;
noRetry(): void;
}
interface ScheduledController {
readonly scheduledTime: number;
readonly cron: string;
noRetry(): void;
}
interface QueuingStrategy<T = any> {
highWaterMark?: number | bigint;
size?: (chunk: T) => number | bigint;
}
interface UnderlyingSink<W = any> {
type?: string;
start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;
abort?: (reason: any) => void | Promise<void>;
close?: () => void | Promise<void>;
}
interface UnderlyingByteSource {
type: "bytes";
autoAllocateChunkSize?: number;
start?: (controller: ReadableByteStreamController) => void | Promise<void>;
pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
cancel?: (reason: any) => void | Promise<void>;
}
interface UnderlyingSource<R = any> {
type?: "" | undefined;
start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;
cancel?: (reason: any) => void | Promise<void>;
expectedLength?: number | bigint;
}
interface Transformer<I = any, O = any> {
readableType?: string;
writableType?: string;
start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;
flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;
cancel?: (reason: any) => void | Promise<void>;
expectedLength?: number;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*
* Errors and closures of the source and destination streams propagate as follows:
*
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
*
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
*
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
*
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
*
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
signal?: AbortSignal;
}
type ReadableStreamReadResult<R = any> =
| {
done: false;
value: R;
}
| {
done: true;
value?: undefined;
};
/**
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
interface ReadableStream<R = any> {
/**
* The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)
*/
get locked(): boolean;
/**
* The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)
*/
cancel(reason?: any): Promise<void>;
/**
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
/**
* The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)
*/
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
/**
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
tee(): [ReadableStream<R>, ReadableStream<R>];
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
declare const ReadableStream: {
prototype: ReadableStream;
new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};
/**
* The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)
*/
declare class ReadableStreamDefaultReader<R = any> {
constructor(stream: ReadableStream);
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)
*/
read(): Promise<ReadableStreamReadResult<R>>;
/**
* The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)
*/
releaseLock(): void;
}
/**
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
declare class ReadableStreamBYOBReader {
constructor(stream: ReadableStream);
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
releaseLock(): void;
readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;
}
interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
min?: number;
}
interface ReadableStreamGetReaderOptions {
/**
* Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
*
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
*/
mode: "byob";
}
/**
* The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)
*/
declare abstract class ReadableStreamBYOBRequest {
/**
* The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)
*/
get view(): Uint8Array | null;
/**
* The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)
*/
respond(bytesWritten: number): void;
/**
* The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)
*/
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
get atLeast(): number | null;
}
/**
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
get desiredSize(): number | null;
/**
* The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)
*/
close(): void;
/**
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)
*/
get byobRequest(): ReadableStreamBYOBRequest | null;
/**
* The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)
*/
get desiredSize(): number | null;
/**
* The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
/**
* The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)
*/
error(reason: any): void;
}
/**
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
declare abstract class WritableStreamDefaultController {
/**
* The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
error(reason?: any): void;
}
/**
* The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)
*/
declare abstract class TransformStreamDefaultController<O = any> {
/**
* The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)
*/
get desiredSize(): number | null;
/**
* The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)
*/
enqueue(chunk?: O): void;
/**
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
error(reason: any): void;
/**
* The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)
*/
terminate(): void;
}
interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
}
/**
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)
*/
get locked(): boolean;
/**
* The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
*/
declare class WritableStreamDefaultWriter<W = any> {
constructor(stream: WritableStream);
/**
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* The **`releaseLock()`** method of the corresponding stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)
*/
releaseLock(): void;
}
/**
* The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)
*/
declare class TransformStream<I = any, O = any> {
constructor(
transformer?: Transformer<I, O>,
writableStrategy?: QueuingStrategy<I>,
readableStrategy?: QueuingStrategy<O>,
);
/**
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
get writable(): WritableStream<I>;
}
declare class FixedLengthStream extends IdentityTransformStream {
constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);
}
declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
}
interface IdentityTransformStreamQueuingStrategy {
highWaterMark?: number | bigint;
}
interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
constructor();
get encoding(): string;
}
/**
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
get encoding(): string;
get fatal(): boolean;
get ignoreBOM(): boolean;
}
interface TextDecoderStreamTextDecoderStreamInit {
fatal?: boolean;
ignoreBOM?: boolean;
}
/**
* The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
*/
declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
constructor(init: QueuingStrategyInit);
/**
* The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)
*/
get highWaterMark(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
get size(): (chunk?: any) => number;
}
/**
* The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
*/
declare class CountQueuingStrategy implements QueuingStrategy {
constructor(init: QueuingStrategyInit);
/**
* The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)
*/
get highWaterMark(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
get size(): (chunk?: any) => number;
}
interface QueuingStrategyInit {
/**
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
*
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
*/
highWaterMark: number;
}
interface ScriptVersion {
id?: string;
tag?: string;
message?: string;
}
declare abstract class TailEvent extends ExtendableEvent {
readonly events: TraceItem[];
readonly traces: TraceItem[];
}
interface TraceItem {
readonly event:
| (
| TraceItemFetchEventInfo
| TraceItemJsRpcEventInfo
| TraceItemScheduledEventInfo
| TraceItemAlarmEventInfo
| TraceItemQueueEventInfo
| TraceItemEmailEventInfo
| TraceItemTailEventInfo
| TraceItemCustomEventInfo
| TraceItemHibernatableWebSocketEventInfo
)
| null;
readonly eventTimestamp: number | null;
readonly logs: TraceLog[];
readonly exceptions: TraceException[];
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
readonly scriptName: string | null;
readonly entrypoint?: string;
readonly scriptVersion?: ScriptVersion;
readonly dispatchNamespace?: string;
readonly scriptTags?: string[];
readonly durableObjectId?: string;
readonly outcome: string;
readonly executionModel: string;
readonly truncated: boolean;
readonly cpuTime: number;
readonly wallTime: number;
}
interface TraceItemAlarmEventInfo {
readonly scheduledTime: Date;
}
interface TraceItemCustomEventInfo {}
interface TraceItemScheduledEventInfo {
readonly scheduledTime: number;
readonly cron: string;
}
interface TraceItemQueueEventInfo {
readonly queue: string;
readonly batchSize: number;
}
interface TraceItemEmailEventInfo {
readonly mailFrom: string;
readonly rcptTo: string;
readonly rawSize: number;
}
interface TraceItemTailEventInfo {
readonly consumedEvents: TraceItemTailEventInfoTailItem[];
}
interface TraceItemTailEventInfoTailItem {
readonly scriptName: string | null;
}
interface TraceItemFetchEventInfo {
readonly response?: TraceItemFetchEventInfoResponse;
readonly request: TraceItemFetchEventInfoRequest;
}
interface TraceItemFetchEventInfoRequest {
readonly cf?: any;
readonly headers: Record<string, string>;
readonly method: string;
readonly url: string;
getUnredacted(): TraceItemFetchEventInfoRequest;
}
interface TraceItemFetchEventInfoResponse {
readonly status: number;
}
interface TraceItemJsRpcEventInfo {
readonly rpcMethod: string;
}
interface TraceItemHibernatableWebSocketEventInfo {
readonly getWebSocketEvent:
| TraceItemHibernatableWebSocketEventInfoMessage
| TraceItemHibernatableWebSocketEventInfoClose
| TraceItemHibernatableWebSocketEventInfoError;
}
interface TraceItemHibernatableWebSocketEventInfoMessage {
readonly webSocketEventType: string;
}
interface TraceItemHibernatableWebSocketEventInfoClose {
readonly webSocketEventType: string;
readonly code: number;
readonly wasClean: boolean;
}
interface TraceItemHibernatableWebSocketEventInfoError {
readonly webSocketEventType: string;
}
interface TraceLog {
readonly timestamp: number;
readonly level: string;
readonly message: any;
}
interface TraceException {
readonly timestamp: number;
readonly message: string;
readonly name: string;
readonly stack?: string;
}
interface TraceDiagnosticChannelEvent {
readonly timestamp: number;
readonly channel: string;
readonly message: any;
}
interface TraceMetrics {
readonly cpuTime: number;
readonly wallTime: number;
}
interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
declare class URL {
constructor(url: string | URL, base?: string | URL);
/**
* The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
*/
get origin(): string;
/**
* The **`href`** property of the URL interface is a string containing the whole URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
*/
get href(): string;
/**
* The **`href`** property of the URL interface is a string containing the whole URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
*/
set href(value: string);
/**
* The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
*/
get protocol(): string;
/**
* The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
*/
set protocol(value: string);
/**
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
toJSON(): string;
/*function toString() { [native code] }*/
toString(): string;
/**
* The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
*/
static canParse(url: string, base?: string): boolean;
/**
* The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
*/
static parse(url: string, base?: string): URL | null;
/**
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
static revokeObjectURL(object_url: string): void;
}
/**
* The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
*/
declare class URLSearchParams {
constructor(init?: Iterable<Iterable<string>> | Record<string, string> | string);
/**
* The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
*/
get size(): number;
/**
* The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
*/
append(name: string, value: string): void;
/**
* The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
*/
delete(name: string, value?: string): void;
/**
* The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
*/
get(name: string): string | null;
/**
* The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
*/
getAll(name: string): string[];
/**
* The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
*/
has(name: string, value?: string): boolean;
/**
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[key: string, value: string]>;
/* Returns a list of keys in the search params. */
keys(): IterableIterator<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(
callback: (this: This, value: string, key: string, parent: URLSearchParams) => void,
thisArg?: This,
): void;
/*function toString() { [native code] }*/
toString(): string;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
}
declare class URLPattern {
constructor(
input?: string | URLPatternInit,
baseURL?: string | URLPatternOptions,
patternOptions?: URLPatternOptions,
);
get protocol(): string;
get username(): string;
get password(): string;
get hostname(): string;
get port(): string;
get pathname(): string;
get search(): string;
get hash(): string;
get hasRegExpGroups(): boolean;
test(input?: string | URLPatternInit, baseURL?: string): boolean;
exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
}
interface URLPatternInit {
protocol?: string;
username?: string;
password?: string;
hostname?: string;
port?: string;
pathname?: string;
search?: string;
hash?: string;
baseURL?: string;
}
interface URLPatternComponentResult {
input: string;
groups: Record<string, string>;
}
interface URLPatternResult {
inputs: (string | URLPatternInit)[];
protocol: URLPatternComponentResult;
username: URLPatternComponentResult;
password: URLPatternComponentResult;
hostname: URLPatternComponentResult;
port: URLPatternComponentResult;
pathname: URLPatternComponentResult;
search: URLPatternComponentResult;
hash: URLPatternComponentResult;
}
interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
declare class CloseEvent extends Event {
constructor(type: string, initializer?: CloseEventInit);
/**
* The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
*/
readonly code: number;
/**
* The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
*/
readonly reason: string;
/**
* The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
*/
readonly wasClean: boolean;
}
interface CloseEventInit {
code?: number;
reason?: string;
wasClean?: boolean;
}
type WebSocketEventMap = {
close: CloseEvent;
message: MessageEvent;
open: Event;
error: ErrorEvent;
};
/**
* The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
declare var WebSocket: {
prototype: WebSocket;
new (url: string, protocols?: string[] | string): WebSocket;
readonly READY_STATE_CONNECTING: number;
readonly CONNECTING: number;
readonly READY_STATE_OPEN: number;
readonly OPEN: number;
readonly READY_STATE_CLOSING: number;
readonly CLOSING: number;
readonly READY_STATE_CLOSED: number;
readonly CLOSED: number;
};
/**
* The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
interface WebSocket extends EventTarget<WebSocketEventMap> {
accept(): void;
/**
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
close(code?: number, reason?: string): void;
serializeAttachment(attachment: any): void;
deserializeAttachment(): any | null;
/**
* The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
*/
readyState: number;
/**
* The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
*/
url: string | null;
/**
* The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
*/
protocol: string | null;
/**
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
extensions: string | null;
}
declare const WebSocketPair: {
new (): {
0: WebSocket;
1: WebSocket;
};
};
interface SqlStorage {
exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;
get databaseSize(): number;
Cursor: typeof SqlStorageCursor;
Statement: typeof SqlStorageStatement;
}
declare abstract class SqlStorageStatement {}
type SqlStorageValue = ArrayBuffer | string | number | null;
declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {
next():
| {
done?: false;
value: T;
}
| {
done: true;
value?: never;
};
toArray(): T[];
one(): T;
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
columnNames: string[];
get rowsRead(): number;
get rowsWritten(): number;
[Symbol.iterator](): IterableIterator<T>;
}
interface Socket {
get readable(): ReadableStream;
get writable(): WritableStream;
get closed(): Promise<void>;
get opened(): Promise<SocketInfo>;
get upgraded(): boolean;
get secureTransport(): "on" | "off" | "starttls";
close(): Promise<void>;
startTls(options?: TlsOptions): Socket;
}
interface SocketOptions {
secureTransport?: string;
allowHalfOpen: boolean;
highWaterMark?: number | bigint;
}
interface SocketAddress {
hostname: string;
port: number;
}
interface TlsOptions {
expectedServerHostname?: string;
}
interface SocketInfo {
remoteAddress?: string;
localAddress?: string;
}
/**
* The **`EventSource`** interface is web content's interface to server-sent events.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
*/
declare class EventSource extends EventTarget {
constructor(url: string, init?: EventSourceEventSourceInit);
/**
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
get readyState(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
get onopen(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
set onopen(value: any | null);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
get onmessage(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
set onmessage(value: any | null);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
get onerror(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
set onerror(value: any | null);
static readonly CONNECTING: number;
static readonly OPEN: number;
static readonly CLOSED: number;
static from(stream: ReadableStream): EventSource;
}
interface EventSourceEventSourceInit {
withCredentials?: boolean;
fetcher?: Fetcher;
}
interface Container {
get running(): boolean;
start(options?: ContainerStartupOptions): void;
monitor(): Promise<void>;
destroy(error?: any): Promise<void>;
signal(signo: number): void;
getTcpPort(port: number): Fetcher;
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
}
interface ContainerStartupOptions {
entrypoint?: string[];
enableInternet: boolean;
env?: Record<string, string>;
hardTimeout?: number | bigint;
}
/**
* The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: any[] | MessagePortPostMessageOptions): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
start(): void;
get onmessage(): any | null;
set onmessage(value: any | null);
}
/**
* The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
*/
declare class MessageChannel {
constructor();
/**
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
readonly port2: MessagePort;
}
interface MessagePortPostMessageOptions {
transfer?: any[];
}
type LoopbackForExport<
T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined,
> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
? LoopbackServiceStub<InstanceType<T>>
: T extends new (...args: any[]) => Rpc.DurableObjectBranded
? LoopbackDurableObjectClass<InstanceType<T>>
: T extends ExportedHandler<any, any, any>
? LoopbackServiceStub<undefined>
: undefined;
type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> &
(T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
? (opts: { props?: Props }) => Fetcher<T>
: (opts: { props?: any }) => Fetcher<T>);
type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> &
(T extends CloudflareWorkersModule.DurableObject<any, infer Props>
? (opts: { props?: Props }) => DurableObjectClass<T>
: (opts: { props?: any }) => DurableObjectClass<T>);
interface SyncKvStorage {
get<T = unknown>(key: string): T | undefined;
list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
put<T>(key: string, value: T): void;
delete(key: string): boolean;
}
interface SyncKvListOptions {
start?: string;
startAfter?: string;
end?: string;
prefix?: string;
reverse?: boolean;
limit?: number;
}
interface WorkerStub {
getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(
name?: string,
options?: WorkerStubEntrypointOptions,
): Fetcher<T>;
}
interface WorkerStubEntrypointOptions {
props?: any;
}
interface WorkerLoader {
get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;
}
interface WorkerLoaderModule {
js?: string;
cjs?: string;
text?: string;
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilit
gitextract_b8obspm7/
├── .gitattributes
├── .github/
│ └── workflows/
│ ├── frontend.yml
│ ├── prek.yml
│ ├── py-code-check.yml
│ └── py-weekly-update.yml
├── .gitignore
├── .prettierignore
├── LICENSE
├── README.md
├── frontend/
│ ├── service/
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── index.ts
│ ├── ui/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── public/
│ │ │ ├── CNAME
│ │ │ └── robots.txt
│ │ ├── scripts/
│ │ │ └── subset-font.ts
│ │ ├── src/
│ │ │ ├── App.svelte
│ │ │ ├── app.css
│ │ │ ├── lib/
│ │ │ │ ├── Candidate.svelte
│ │ │ │ ├── Canvas.svelte
│ │ │ │ ├── Card.svelte
│ │ │ │ ├── ContribPanel.svelte
│ │ │ │ ├── CopyButton.svelte
│ │ │ │ └── Preview.svelte
│ │ │ ├── main.ts
│ │ │ └── routes/
│ │ │ ├── Contrib.svelte
│ │ │ ├── FAQ.svelte
│ │ │ └── Home.svelte
│ │ ├── svelte.config.js
│ │ ├── tsconfig.app.json
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ └── worker/
│ ├── README.md
│ ├── package.json
│ ├── schema.sql
│ ├── src/
│ │ └── index.ts
│ ├── tsconfig.json
│ ├── worker-configuration.d.ts
│ └── wrangler.toml
├── package.json
├── pnpm-workspace.yaml
├── prek.toml
├── pyproject.toml
└── python/
├── README.md
├── __init__.py
├── callbacks.py
├── dataset.py
├── model.py
├── proc_data.py
├── review_contrib.py
├── tex_to_typ.yaml
└── train.py
SYMBOL INDEX (735 symbols across 11 files)
FILE: frontend/service/src/index.ts
type SymbolInfo (line 9) | interface SymbolInfo {
type Point (line 17) | type Point = [number, number];
type Stroke (line 18) | type Stroke = Point[];
type Strokes (line 19) | type Strokes = Stroke[];
function drawStrokes (line 34) | function drawStrokes(strokes: Strokes): HTMLCanvasElement {
class Detypify (line 86) | class Detypify {
method constructor (line 89) | constructor(sess: InferenceSession) {
method create (line 96) | static async create(): Promise<Detypify> {
method infer (line 105) | async infer(strokes: Strokes): Promise<Float32Array> {
FILE: frontend/ui/scripts/subset-font.ts
constant FONT_URL (line 7) | const FONT_URL = "https://mirrors.ctan.org/fonts/newcomputermodern/otf/N...
FILE: frontend/worker/schema.sql
type samples (line 3) | CREATE TABLE IF NOT EXISTS samples (
FILE: frontend/worker/src/index.ts
type Bindings (line 4) | type Bindings = {
type ContribPayload (line 8) | type ContribPayload = {
FILE: frontend/worker/worker-configuration.d.ts
type GlobalProps (line 5) | interface GlobalProps {
type Env (line 8) | interface Env {
type CloudflareBindings (line 12) | interface CloudflareBindings extends Cloudflare.Env {}
class DOMException (line 37) | class DOMException extends Error {
type WorkerGlobalScopeEventMap (line 86) | type WorkerGlobalScopeEventMap = {
type Console (line 101) | interface Console {
type BufferSource (line 214) | type BufferSource = ArrayBufferView | ArrayBuffer;
type TypedArray (line 215) | type TypedArray =
class CompileError (line 228) | class CompileError extends Error {
class RuntimeError (line 231) | class RuntimeError extends Error {
type ValueType (line 234) | type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64"...
type GlobalDescriptor (line 235) | interface GlobalDescriptor {
class Global (line 239) | class Global {
type ImportValue (line 244) | type ImportValue = ExportValue | number;
type ModuleImports (line 245) | type ModuleImports = Record<string, ImportValue>;
type Imports (line 246) | type Imports = Record<string, ModuleImports>;
type ExportValue (line 247) | type ExportValue = Function | Global | Memory | Table;
type Exports (line 248) | type Exports = Record<string, ExportValue>;
class Instance (line 249) | class Instance {
type MemoryDescriptor (line 253) | interface MemoryDescriptor {
class Memory (line 258) | class Memory {
type ImportExportKind (line 263) | type ImportExportKind = "function" | "global" | "memory" | "table";
type ModuleExportDescriptor (line 264) | interface ModuleExportDescriptor {
type ModuleImportDescriptor (line 268) | interface ModuleImportDescriptor {
type TableKind (line 278) | type TableKind = "anyfunc" | "externref";
type TableDescriptor (line 279) | interface TableDescriptor {
class Table (line 284) | class Table {
type ServiceWorkerGlobalScope (line 300) | interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
type TestController (line 456) | interface TestController {}
type ExecutionContext (line 457) | interface ExecutionContext<Props = unknown> {
type ExportedHandlerFetchHandler (line 463) | type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown...
type ExportedHandlerTailHandler (line 468) | type ExportedHandlerTailHandler<Env = unknown> = (
type ExportedHandlerTraceHandler (line 473) | type ExportedHandlerTraceHandler<Env = unknown> = (
type ExportedHandlerTailStreamHandler (line 478) | type ExportedHandlerTailStreamHandler<Env = unknown> = (
type ExportedHandlerScheduledHandler (line 483) | type ExportedHandlerScheduledHandler<Env = unknown> = (
type ExportedHandlerQueueHandler (line 488) | type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
type ExportedHandlerTestHandler (line 493) | type ExportedHandlerTestHandler<Env = unknown> = (
type ExportedHandler (line 498) | interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, ...
type StructuredSerializeOptions (line 508) | interface StructuredSerializeOptions {
type AlarmInvocationInfo (line 518) | interface AlarmInvocationInfo {
type Cloudflare (line 522) | interface Cloudflare {
type DurableObject (line 525) | interface DurableObject {
type DurableObjectStub (line 532) | type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = ...
type DurableObjectId (line 539) | interface DurableObjectId {
type DurableObjectJurisdiction (line 552) | type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectNamespaceNewUniqueIdOptions (line 553) | interface DurableObjectNamespaceNewUniqueIdOptions {
type DurableObjectLocationHint (line 556) | type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeu...
type DurableObjectRoutingMode (line 557) | type DurableObjectRoutingMode = "primary-only";
type DurableObjectNamespaceGetDurableObjectOptions (line 558) | interface DurableObjectNamespaceGetDurableObjectOptions {
type DurableObjectClass (line 562) | interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undef...
type DurableObjectState (line 563) | interface DurableObjectState<Props = unknown> {
type DurableObjectTransaction (line 581) | interface DurableObjectTransaction {
type DurableObjectStorage (line 594) | interface DurableObjectStorage {
type DurableObjectListOptions (line 615) | interface DurableObjectListOptions {
type DurableObjectGetOptions (line 625) | interface DurableObjectGetOptions {
type DurableObjectGetAlarmOptions (line 629) | interface DurableObjectGetAlarmOptions {
type DurableObjectPutOptions (line 632) | interface DurableObjectPutOptions {
type DurableObjectSetAlarmOptions (line 637) | interface DurableObjectSetAlarmOptions {
class WebSocketRequestResponsePair (line 641) | class WebSocketRequestResponsePair {
type AnalyticsEngineDataset (line 646) | interface AnalyticsEngineDataset {
type AnalyticsEngineDataPoint (line 649) | interface AnalyticsEngineDataPoint {
class Event (line 659) | class Event {
type EventInit (line 778) | interface EventInit {
type EventListener (line 783) | type EventListener<EventType extends Event = Event> = (event: EventType)...
type EventListenerObject (line 784) | interface EventListenerObject<EventType extends Event = Event> {
type EventListenerOrEventListenerObject (line 787) | type EventListenerOrEventListenerObject<EventType extends Event = Event> =
class EventTarget (line 795) | class EventTarget<EventMap extends Record<string, Event> = Record<string...
type EventTargetEventListenerOptions (line 824) | interface EventTargetEventListenerOptions {
type EventTargetAddEventListenerOptions (line 827) | interface EventTargetAddEventListenerOptions {
type EventTargetHandlerObject (line 833) | interface EventTargetHandlerObject {
class AbortController (line 841) | class AbortController {
type Scheduler (line 903) | interface Scheduler {
type SchedulerWaitOptions (line 906) | interface SchedulerWaitOptions {
class CustomEvent (line 927) | class CustomEvent<T = any> extends Event {
type CustomEventCustomEventInit (line 936) | interface CustomEventCustomEventInit {
class Blob (line 947) | class Blob {
type BlobOptions (line 992) | interface BlobOptions {
class File (line 1000) | class File extends Blob {
type FileOptions (line 1019) | interface FileOptions {
type CacheQueryOptions (line 1050) | interface CacheQueryOptions {
type CryptoKeyPair (line 1263) | interface CryptoKeyPair {
type JsonWebKey (line 1267) | interface JsonWebKey {
type RsaOtherPrimesInfo (line 1287) | interface RsaOtherPrimesInfo {
type SubtleCryptoDeriveKeyAlgorithm (line 1292) | interface SubtleCryptoDeriveKeyAlgorithm {
type SubtleCryptoEncryptAlgorithm (line 1300) | interface SubtleCryptoEncryptAlgorithm {
type SubtleCryptoGenerateKeyAlgorithm (line 1309) | interface SubtleCryptoGenerateKeyAlgorithm {
type SubtleCryptoHashAlgorithm (line 1317) | interface SubtleCryptoHashAlgorithm {
type SubtleCryptoImportKeyAlgorithm (line 1320) | interface SubtleCryptoImportKeyAlgorithm {
type SubtleCryptoSignAlgorithm (line 1327) | interface SubtleCryptoSignAlgorithm {
type CryptoKeyKeyAlgorithm (line 1333) | interface CryptoKeyKeyAlgorithm {
type CryptoKeyAesKeyAlgorithm (line 1336) | interface CryptoKeyAesKeyAlgorithm {
type CryptoKeyHmacKeyAlgorithm (line 1340) | interface CryptoKeyHmacKeyAlgorithm {
type CryptoKeyRsaKeyAlgorithm (line 1345) | interface CryptoKeyRsaKeyAlgorithm {
type CryptoKeyEllipticKeyAlgorithm (line 1351) | interface CryptoKeyEllipticKeyAlgorithm {
type CryptoKeyArbitraryKeyAlgorithm (line 1355) | interface CryptoKeyArbitraryKeyAlgorithm {
class DigestStream (line 1361) | class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
class TextDecoder (line 1371) | class TextDecoder {
class TextEncoder (line 1388) | class TextEncoder {
type TextDecoderConstructorOptions (line 1404) | interface TextDecoderConstructorOptions {
type TextDecoderDecodeOptions (line 1408) | interface TextDecoderDecodeOptions {
type TextEncoderEncodeIntoResult (line 1411) | interface TextEncoderEncodeIntoResult {
class ErrorEvent (line 1420) | class ErrorEvent extends Event {
type ErrorEventErrorEventInit (line 1453) | interface ErrorEventErrorEventInit {
class MessageEvent (line 1465) | class MessageEvent extends Event {
type MessageEventInit (line 1498) | interface MessageEventInit {
class FormData (line 1525) | class FormData {
type ContentOptions (line 1587) | interface ContentOptions {
class HTMLRewriter (line 1590) | class HTMLRewriter {
type HTMLRewriterElementContentHandlers (line 1596) | interface HTMLRewriterElementContentHandlers {
type HTMLRewriterDocumentContentHandlers (line 1601) | interface HTMLRewriterDocumentContentHandlers {
type Doctype (line 1607) | interface Doctype {
type Element (line 1612) | interface Element {
type EndTag (line 1631) | interface EndTag {
type Comment (line 1637) | interface Comment {
type Text (line 1645) | interface Text {
type DocumentEnd (line 1654) | interface DocumentEnd {
type HeadersInit (line 1677) | type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string,...
class Headers (line 1683) | class Headers {
type BodyInit (line 1734) | type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | Arra...
type Response (line 1770) | interface Response extends Body {
type ResponseInit (line 1822) | interface ResponseInit {
type RequestInfo (line 1830) | type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetad...
type Request (line 1848) | interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMeta...
type RequestInit (line 1906) | interface RequestInit<Cf = CfProperties> {
type Service (line 1925) | type Service<
type Fetcher (line 1938) | type Fetcher<
type KVNamespaceListKey (line 1945) | interface KVNamespaceListKey<Metadata, Key extends string = string> {
type KVNamespaceListResult (line 1950) | type KVNamespaceListResult<Metadata, Key extends string = string> =
type KVNamespace (line 1962) | interface KVNamespace<Key extends string = string> {
type KVNamespaceListOptions (line 2044) | interface KVNamespaceListOptions {
type KVNamespaceGetOptions (line 2049) | interface KVNamespaceGetOptions<Type> {
type KVNamespacePutOptions (line 2053) | interface KVNamespacePutOptions {
type KVNamespaceGetWithMetadataResult (line 2058) | interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
type QueueContentType (line 2063) | type QueueContentType = "text" | "bytes" | "json" | "v8";
type Queue (line 2064) | interface Queue<Body = unknown> {
type QueueSendOptions (line 2068) | interface QueueSendOptions {
type QueueSendBatchOptions (line 2072) | interface QueueSendBatchOptions {
type MessageSendRequest (line 2075) | interface MessageSendRequest<Body = unknown> {
type QueueRetryOptions (line 2080) | interface QueueRetryOptions {
type Message (line 2083) | interface Message<Body = unknown> {
type QueueEvent (line 2091) | interface QueueEvent<Body = unknown> extends ExtendableEvent {
type MessageBatch (line 2097) | interface MessageBatch<Body = unknown> {
type R2Error (line 2103) | interface R2Error extends Error {
type R2ListOptions (line 2110) | interface R2ListOptions {
type R2MultipartUpload (line 2144) | interface R2MultipartUpload {
type R2UploadedPart (line 2155) | interface R2UploadedPart {
type R2ObjectBody (line 2174) | interface R2ObjectBody extends R2Object {
type R2Range (line 2183) | type R2Range =
type R2Conditional (line 2195) | interface R2Conditional {
type R2GetOptions (line 2202) | interface R2GetOptions {
type R2PutOptions (line 2207) | interface R2PutOptions {
type R2MultipartOptions (line 2219) | interface R2MultipartOptions {
type R2Checksums (line 2225) | interface R2Checksums {
type R2StringChecksums (line 2233) | interface R2StringChecksums {
type R2HTTPMetadata (line 2240) | interface R2HTTPMetadata {
type R2Objects (line 2248) | type R2Objects = {
type R2UploadPartOptions (line 2260) | interface R2UploadPartOptions {
type ScheduledController (line 2268) | interface ScheduledController {
type QueuingStrategy (line 2273) | interface QueuingStrategy<T = any> {
type UnderlyingSink (line 2277) | interface UnderlyingSink<W = any> {
type UnderlyingByteSource (line 2284) | interface UnderlyingByteSource {
type UnderlyingSource (line 2291) | interface UnderlyingSource<R = any> {
type Transformer (line 2298) | interface Transformer<I = any, O = any> {
type StreamPipeOptions (line 2307) | interface StreamPipeOptions {
type ReadableStreamReadResult (line 2330) | type ReadableStreamReadResult<R = any> =
type ReadableStream (line 2344) | interface ReadableStream<R = any> {
class ReadableStreamDefaultReader (line 2405) | class ReadableStreamDefaultReader<R = any> {
class ReadableStreamBYOBReader (line 2427) | class ReadableStreamBYOBReader {
type ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions (line 2445) | interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
type ReadableStreamGetReaderOptions (line 2448) | interface ReadableStreamGetReaderOptions {
type ReadableWritablePair (line 2600) | interface ReadableWritablePair<R = any, W = any> {
class WritableStream (line 2614) | class WritableStream<W = any> {
class WritableStreamDefaultWriter (line 2646) | class WritableStreamDefaultWriter<W = any> {
class TransformStream (line 2696) | class TransformStream<I = any, O = any> {
class FixedLengthStream (line 2715) | class FixedLengthStream extends IdentityTransformStream {
class IdentityTransformStream (line 2718) | class IdentityTransformStream extends TransformStream<ArrayBuffer | Arra...
type IdentityTransformStreamQueuingStrategy (line 2721) | interface IdentityTransformStreamQueuingStrategy {
type ReadableStreamValuesOptions (line 2724) | interface ReadableStreamValuesOptions {
class CompressionStream (line 2732) | class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe...
class DecompressionStream (line 2740) | class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf...
class TextEncoderStream (line 2748) | class TextEncoderStream extends TransformStream<string, Uint8Array> {
class TextDecoderStream (line 2757) | class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBuffe...
type TextDecoderStreamTextDecoderStreamInit (line 2763) | interface TextDecoderStreamTextDecoderStreamInit {
class ByteLengthQueuingStrategy (line 2772) | class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferVi...
class CountQueuingStrategy (line 2788) | class CountQueuingStrategy implements QueuingStrategy {
type QueuingStrategyInit (line 2799) | interface QueuingStrategyInit {
type ScriptVersion (line 2807) | interface ScriptVersion {
type TraceItem (line 2816) | interface TraceItem {
type TraceItemAlarmEventInfo (line 2846) | interface TraceItemAlarmEventInfo {
type TraceItemCustomEventInfo (line 2849) | interface TraceItemCustomEventInfo {}
type TraceItemScheduledEventInfo (line 2850) | interface TraceItemScheduledEventInfo {
type TraceItemQueueEventInfo (line 2854) | interface TraceItemQueueEventInfo {
type TraceItemEmailEventInfo (line 2858) | interface TraceItemEmailEventInfo {
type TraceItemTailEventInfo (line 2863) | interface TraceItemTailEventInfo {
type TraceItemTailEventInfoTailItem (line 2866) | interface TraceItemTailEventInfoTailItem {
type TraceItemFetchEventInfo (line 2869) | interface TraceItemFetchEventInfo {
type TraceItemFetchEventInfoRequest (line 2873) | interface TraceItemFetchEventInfoRequest {
type TraceItemFetchEventInfoResponse (line 2880) | interface TraceItemFetchEventInfoResponse {
type TraceItemJsRpcEventInfo (line 2883) | interface TraceItemJsRpcEventInfo {
type TraceItemHibernatableWebSocketEventInfo (line 2886) | interface TraceItemHibernatableWebSocketEventInfo {
type TraceItemHibernatableWebSocketEventInfoMessage (line 2892) | interface TraceItemHibernatableWebSocketEventInfoMessage {
type TraceItemHibernatableWebSocketEventInfoClose (line 2895) | interface TraceItemHibernatableWebSocketEventInfoClose {
type TraceItemHibernatableWebSocketEventInfoError (line 2900) | interface TraceItemHibernatableWebSocketEventInfoError {
type TraceLog (line 2903) | interface TraceLog {
type TraceException (line 2908) | interface TraceException {
type TraceDiagnosticChannelEvent (line 2914) | interface TraceDiagnosticChannelEvent {
type TraceMetrics (line 2919) | interface TraceMetrics {
type UnsafeTraceMetrics (line 2923) | interface UnsafeTraceMetrics {
class URL (line 2931) | class URL {
class URLSearchParams (line 3103) | class URLSearchParams {
class URLPattern (line 3167) | class URLPattern {
type URLPatternInit (line 3185) | interface URLPatternInit {
type URLPatternComponentResult (line 3196) | interface URLPatternComponentResult {
type URLPatternResult (line 3200) | interface URLPatternResult {
type URLPatternOptions (line 3211) | interface URLPatternOptions {
class CloseEvent (line 3219) | class CloseEvent extends Event {
type CloseEventInit (line 3240) | interface CloseEventInit {
type WebSocketEventMap (line 3245) | type WebSocketEventMap = {
type WebSocket (line 3273) | interface WebSocket extends EventTarget<WebSocketEventMap> {
type SqlStorage (line 3320) | interface SqlStorage {
type SqlStorageValue (line 3327) | type SqlStorageValue = ArrayBuffer | string | number | null;
type Socket (line 3346) | interface Socket {
type SocketOptions (line 3356) | interface SocketOptions {
type SocketAddress (line 3361) | interface SocketAddress {
type TlsOptions (line 3365) | interface TlsOptions {
type SocketInfo (line 3368) | interface SocketInfo {
class EventSource (line 3377) | class EventSource extends EventTarget {
type EventSourceEventSourceInit (line 3420) | interface EventSourceEventSourceInit {
type Container (line 3424) | interface Container {
type ContainerStartupOptions (line 3433) | interface ContainerStartupOptions {
class MessageChannel (line 3471) | class MessageChannel {
type MessagePortPostMessageOptions (line 3486) | interface MessagePortPostMessageOptions {
type LoopbackForExport (line 3489) | type LoopbackForExport<
type LoopbackServiceStub (line 3498) | type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefin...
type LoopbackDurableObjectClass (line 3502) | type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | und...
type SyncKvStorage (line 3506) | interface SyncKvStorage {
type SyncKvListOptions (line 3512) | interface SyncKvListOptions {
type WorkerStub (line 3520) | interface WorkerStub {
type WorkerStubEntrypointOptions (line 3526) | interface WorkerStubEntrypointOptions {
type WorkerLoader (line 3529) | interface WorkerLoader {
type WorkerLoaderModule (line 3532) | interface WorkerLoaderModule {
type WorkerLoaderWorkerCode (line 3541) | interface WorkerLoaderWorkerCode {
type AiImageClassificationInput (line 3564) | type AiImageClassificationInput = {
type AiImageClassificationOutput (line 3567) | type AiImageClassificationOutput = {
type AiImageToTextInput (line 3575) | type AiImageToTextInput = {
type AiImageToTextOutput (line 3589) | type AiImageToTextOutput = {
type AiImageTextToTextInput (line 3596) | type AiImageTextToTextInput = {
type AiImageTextToTextOutput (line 3611) | type AiImageTextToTextOutput = {
type AiMultimodalEmbeddingsInput (line 3618) | type AiMultimodalEmbeddingsInput = {
type AiIMultimodalEmbeddingsOutput (line 3622) | type AiIMultimodalEmbeddingsOutput = {
type AiObjectDetectionInput (line 3630) | type AiObjectDetectionInput = {
type AiObjectDetectionOutput (line 3633) | type AiObjectDetectionOutput = {
type AiSentenceSimilarityInput (line 3641) | type AiSentenceSimilarityInput = {
type AiSentenceSimilarityOutput (line 3645) | type AiSentenceSimilarityOutput = number[];
type AiAutomaticSpeechRecognitionInput (line 3650) | type AiAutomaticSpeechRecognitionInput = {
type AiAutomaticSpeechRecognitionOutput (line 3653) | type AiAutomaticSpeechRecognitionOutput = {
type AiSummarizationInput (line 3666) | type AiSummarizationInput = {
type AiSummarizationOutput (line 3670) | type AiSummarizationOutput = {
type AiTextClassificationInput (line 3677) | type AiTextClassificationInput = {
type AiTextClassificationOutput (line 3680) | type AiTextClassificationOutput = {
type AiTextEmbeddingsInput (line 3688) | type AiTextEmbeddingsInput = {
type AiTextEmbeddingsOutput (line 3691) | type AiTextEmbeddingsOutput = {
type RoleScopedChatInput (line 3699) | type RoleScopedChatInput = {
type AiTextGenerationToolLegacyInput (line 3704) | type AiTextGenerationToolLegacyInput = {
type AiTextGenerationToolInput (line 3718) | type AiTextGenerationToolInput = {
type AiTextGenerationFunctionsInput (line 3735) | type AiTextGenerationFunctionsInput = {
type AiTextGenerationResponseFormat (line 3739) | type AiTextGenerationResponseFormat = {
type AiTextGenerationInput (line 3743) | type AiTextGenerationInput = {
type AiTextGenerationToolLegacyOutput (line 3760) | type AiTextGenerationToolLegacyOutput = {
type AiTextGenerationToolOutput (line 3764) | type AiTextGenerationToolOutput = {
type UsageTags (line 3772) | type UsageTags = {
type AiTextGenerationOutput (line 3777) | type AiTextGenerationOutput = {
type AiTextToSpeechInput (line 3786) | type AiTextToSpeechInput = {
type AiTextToSpeechOutput (line 3790) | type AiTextToSpeechOutput =
type AiTextToImageInput (line 3799) | type AiTextToImageInput = {
type AiTextToImageOutput (line 3812) | type AiTextToImageOutput = ReadableStream<Uint8Array>;
type AiTranslationInput (line 3817) | type AiTranslationInput = {
type AiTranslationOutput (line 3822) | type AiTranslationOutput = {
type ResponsesInput (line 3839) | type ResponsesInput = {
type ResponsesOutput (line 3861) | type ResponsesOutput = {
type EasyInputMessage (line 3886) | type EasyInputMessage = {
type ResponsesFunctionTool (line 3891) | type ResponsesFunctionTool = {
type ResponseIncompleteDetails (line 3900) | type ResponseIncompleteDetails = {
type ResponsePrompt (line 3903) | type ResponsePrompt = {
type Reasoning (line 3910) | type Reasoning = {
type ResponseContent (line 3915) | type ResponseContent =
type ResponseContentReasoningText (line 3921) | type ResponseContentReasoningText = {
type ResponseConversationParam (line 3925) | type ResponseConversationParam = {
type ResponseCreatedEvent (line 3928) | type ResponseCreatedEvent = {
type ResponseCustomToolCallOutput (line 3933) | type ResponseCustomToolCallOutput = {
type ResponseError (line 3939) | type ResponseError = {
type ResponseErrorEvent (line 3961) | type ResponseErrorEvent = {
type ResponseFailedEvent (line 3968) | type ResponseFailedEvent = {
type ResponseFormatText (line 3973) | type ResponseFormatText = {
type ResponseFormatJSONObject (line 3976) | type ResponseFormatJSONObject = {
type ResponseFormatTextConfig (line 3979) | type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJ...
type ResponseFormatTextJSONSchemaConfig (line 3980) | type ResponseFormatTextJSONSchemaConfig = {
type ResponseFunctionCallArgumentsDeltaEvent (line 3989) | type ResponseFunctionCallArgumentsDeltaEvent = {
type ResponseFunctionCallArgumentsDoneEvent (line 3996) | type ResponseFunctionCallArgumentsDoneEvent = {
type ResponseFunctionCallOutputItem (line 4004) | type ResponseFunctionCallOutputItem = ResponseInputTextContent | Respons...
type ResponseFunctionCallOutputItemList (line 4005) | type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutp...
type ResponseFunctionToolCall (line 4006) | type ResponseFunctionToolCall = {
type ResponseFunctionToolCallItem (line 4014) | interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
type ResponseFunctionToolCallOutputItem (line 4017) | type ResponseFunctionToolCallOutputItem = {
type ResponseIncludable (line 4024) | type ResponseIncludable = "message.input_image.image_url" | "message.out...
type ResponseIncompleteEvent (line 4025) | type ResponseIncompleteEvent = {
type ResponseInput (line 4030) | type ResponseInput = Array<ResponseInputItem>;
type ResponseInputContent (line 4031) | type ResponseInputContent = ResponseInputText | ResponseInputImage;
type ResponseInputImage (line 4032) | type ResponseInputImage = {
type ResponseInputImageContent (line 4040) | type ResponseInputImageContent = {
type ResponseInputItem (line 4048) | type ResponseInputItem =
type ResponseInputItemFunctionCallOutput (line 4055) | type ResponseInputItemFunctionCallOutput = {
type ResponseInputItemMessage (line 4062) | type ResponseInputItemMessage = {
type ResponseInputMessageContentList (line 4068) | type ResponseInputMessageContentList = Array<ResponseInputContent>;
type ResponseInputMessageItem (line 4069) | type ResponseInputMessageItem = {
type ResponseInputText (line 4076) | type ResponseInputText = {
type ResponseInputTextContent (line 4080) | type ResponseInputTextContent = {
type ResponseItem (line 4084) | type ResponseItem =
type ResponseOutputItem (line 4089) | type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCa...
type ResponseOutputItemAddedEvent (line 4090) | type ResponseOutputItemAddedEvent = {
type ResponseOutputItemDoneEvent (line 4096) | type ResponseOutputItemDoneEvent = {
type ResponseOutputMessage (line 4102) | type ResponseOutputMessage = {
type ResponseOutputRefusal (line 4109) | type ResponseOutputRefusal = {
type ResponseOutputText (line 4113) | type ResponseOutputText = {
type ResponseReasoningItem (line 4118) | type ResponseReasoningItem = {
type ResponseReasoningSummaryItem (line 4126) | type ResponseReasoningSummaryItem = {
type ResponseReasoningContentItem (line 4130) | type ResponseReasoningContentItem = {
type ResponseReasoningTextDeltaEvent (line 4134) | type ResponseReasoningTextDeltaEvent = {
type ResponseReasoningTextDoneEvent (line 4142) | type ResponseReasoningTextDoneEvent = {
type ResponseRefusalDeltaEvent (line 4150) | type ResponseRefusalDeltaEvent = {
type ResponseRefusalDoneEvent (line 4158) | type ResponseRefusalDoneEvent = {
type ResponseStatus (line 4166) | type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelle...
type ResponseStreamEvent (line 4167) | type ResponseStreamEvent =
type ResponseCompletedEvent (line 4183) | type ResponseCompletedEvent = {
type ResponseTextConfig (line 4188) | type ResponseTextConfig = {
type ResponseTextDeltaEvent (line 4192) | type ResponseTextDeltaEvent = {
type ResponseTextDoneEvent (line 4201) | type ResponseTextDoneEvent = {
type Logprob (line 4210) | type Logprob = {
type TopLogprob (line 4215) | type TopLogprob = {
type ResponseUsage (line 4219) | type ResponseUsage = {
type Tool (line 4224) | type Tool = ResponsesFunctionTool;
type ToolChoiceFunction (line 4225) | type ToolChoiceFunction = {
type ToolChoiceOptions (line 4229) | type ToolChoiceOptions = "none";
type ReasoningEffort (line 4230) | type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
type StreamOptions (line 4231) | type StreamOptions = {
type Ai_Cf_Baai_Bge_Base_En_V1_5_Input (line 4234) | type Ai_Cf_Baai_Bge_Base_En_V1_5_Input =
type Ai_Cf_Baai_Bge_Base_En_V1_5_Output (line 4254) | type Ai_Cf_Baai_Bge_Base_En_V1_5_Output =
type Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse (line 4267) | interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {
type Ai_Cf_Openai_Whisper_Input (line 4277) | type Ai_Cf_Openai_Whisper_Input =
type Ai_Cf_Openai_Whisper_Output (line 4285) | interface Ai_Cf_Openai_Whisper_Output {
type Ai_Cf_Meta_M2M100_1_2B_Input (line 4308) | type Ai_Cf_Meta_M2M100_1_2B_Input =
type Ai_Cf_Meta_M2M100_1_2B_Output (line 4342) | type Ai_Cf_Meta_M2M100_1_2B_Output =
type Ai_Cf_Meta_M2M100_1_2B_AsyncResponse (line 4350) | interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {
type Ai_Cf_Baai_Bge_Small_En_V1_5_Input (line 4360) | type Ai_Cf_Baai_Bge_Small_En_V1_5_Input =
type Ai_Cf_Baai_Bge_Small_En_V1_5_Output (line 4380) | type Ai_Cf_Baai_Bge_Small_En_V1_5_Output =
type Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse (line 4393) | interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {
type Ai_Cf_Baai_Bge_Large_En_V1_5_Input (line 4403) | type Ai_Cf_Baai_Bge_Large_En_V1_5_Input =
type Ai_Cf_Baai_Bge_Large_En_V1_5_Output (line 4423) | type Ai_Cf_Baai_Bge_Large_En_V1_5_Output =
type Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse (line 4436) | interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {
type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input (line 4446) | type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input =
type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output (line 4487) | interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {
type Ai_Cf_Openai_Whisper_Tiny_En_Input (line 4494) | type Ai_Cf_Openai_Whisper_Tiny_En_Input =
type Ai_Cf_Openai_Whisper_Tiny_En_Output (line 4502) | interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
type Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input (line 4525) | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
type Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output (line 4551) | interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
type Ai_Cf_Baai_Bge_M3_Input (line 4631) | type Ai_Cf_Baai_Bge_M3_Input =
type Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts (line 4640) | interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {
type Ai_Cf_Baai_Bge_M3_Input_Embedding (line 4659) | interface Ai_Cf_Baai_Bge_M3_Input_Embedding {
type Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 (line 4666) | interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {
type Ai_Cf_Baai_Bge_M3_Input_Embedding_1 (line 4685) | interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
type Ai_Cf_Baai_Bge_M3_Output (line 4692) | type Ai_Cf_Baai_Bge_M3_Output =
type Ai_Cf_Baai_Bge_M3_Ouput_Query (line 4697) | interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
type Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts (line 4709) | interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
type Ai_Cf_Baai_Bge_M3_Ouput_Embedding (line 4717) | interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
type Ai_Cf_Baai_Bge_M3_AsyncResponse (line 4728) | interface Ai_Cf_Baai_Bge_M3_AsyncResponse {
type Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input (line 4738) | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
type Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output (line 4748) | interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input (line 4758) | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input =
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt (line 4761) | interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages (line 4812) | interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output (line 4986) | type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input (line 5009) | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input =
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt (line 5013) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode (line 5064) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages (line 5068) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 (line 5218) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch (line 5222) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 (line 5267) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output (line 5271) | type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output =
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse (line 5310) | interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {
type Ai_Cf_Meta_Llama_Guard_3_8B_Input (line 5320) | interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
type Ai_Cf_Meta_Llama_Guard_3_8B_Output (line 5352) | interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {
type Ai_Cf_Baai_Bge_Reranker_Base_Input (line 5387) | interface Ai_Cf_Baai_Bge_Reranker_Base_Input {
type Ai_Cf_Baai_Bge_Reranker_Base_Output (line 5405) | interface Ai_Cf_Baai_Bge_Reranker_Base_Output {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input (line 5421) | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input =
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt (line 5424) | interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode (line 5475) | interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages (line 5479) | interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 (line 5629) | interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output (line 5633) | type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {
type Ai_Cf_Qwen_Qwq_32B_Input (line 5673) | type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Q...
type Ai_Cf_Qwen_Qwq_32B_Prompt (line 5674) | interface Ai_Cf_Qwen_Qwq_32B_Prompt {
type Ai_Cf_Qwen_Qwq_32B_Messages (line 5724) | interface Ai_Cf_Qwen_Qwq_32B_Messages {
type Ai_Cf_Qwen_Qwq_32B_Output (line 5905) | type Ai_Cf_Qwen_Qwq_32B_Output = {
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input (line 5945) | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input =
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt (line 5948) | interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages (line 5998) | interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output (line 6179) | type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {
type Ai_Cf_Google_Gemma_3_12B_It_Input (line 6219) | type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Pro...
type Ai_Cf_Google_Gemma_3_12B_It_Prompt (line 6220) | interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
type Ai_Cf_Google_Gemma_3_12B_It_Messages (line 6270) | interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
type Ai_Cf_Google_Gemma_3_12B_It_Output (line 6434) | type Ai_Cf_Google_Gemma_3_12B_It_Output = {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input (line 6474) | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input =
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt (line 6478) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode (line 6529) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages (line 6533) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch (line 6715) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner (line 6721) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner (line 6772) | interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output (line 6954) | type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input (line 7007) | type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input =
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt (line 7011) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode (line 7062) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages (line 7066) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 (line 7216) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch (line 7220) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 (line 7223) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 (line 7274) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 (line 7278) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 (line 7428) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output (line 7432) | type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output =
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response (line 7437) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response (line 7537) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse (line 7601) | interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {
type Ai_Cf_Deepgram_Nova_3_Input (line 7611) | interface Ai_Cf_Deepgram_Nova_3_Input {
type Ai_Cf_Deepgram_Nova_3_Output (line 7757) | interface Ai_Cf_Deepgram_Nova_3_Output {
type Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input (line 7794) | interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {
type Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output (line 7803) | interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {
type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input (line 7811) | type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input =
type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output (line 7835) | interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
type Ai_Cf_Leonardo_Phoenix_1_0_Input (line 7857) | interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
type Ai_Cf_Leonardo_Phoenix_1_0_Output (line 7890) | type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
type Ai_Cf_Leonardo_Lucid_Origin_Input (line 7895) | interface Ai_Cf_Leonardo_Lucid_Origin_Input {
type Ai_Cf_Leonardo_Lucid_Origin_Output (line 7925) | interface Ai_Cf_Leonardo_Lucid_Origin_Output {
type Ai_Cf_Deepgram_Aura_1_Input (line 7935) | interface Ai_Cf_Deepgram_Aura_1_Input {
type Ai_Cf_Deepgram_Aura_1_Output (line 7976) | type Ai_Cf_Deepgram_Aura_1_Output = string;
type Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input (line 7981) | interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
type Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output (line 8025) | interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input (line 8035) | type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input =
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt (line 8039) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode (line 8090) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages (line 8094) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 (line 8244) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch (line 8248) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 (line 8254) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 (line 8305) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 (line 8309) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 (line 8459) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output (line 8463) | type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output =
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response (line 8468) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Res...
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response (line 8568) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Res...
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse (line 8632) | interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {
type Ai_Cf_Pfnet_Plamo_Embedding_1B_Input (line 8642) | interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {
type Ai_Cf_Pfnet_Plamo_Embedding_1B_Output (line 8648) | interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {
type Ai_Cf_Deepgram_Flux_Input (line 8665) | interface Ai_Cf_Deepgram_Flux_Input {
type Ai_Cf_Deepgram_Flux_Output (line 8702) | interface Ai_Cf_Deepgram_Flux_Output {
type Ai_Cf_Deepgram_Aura_2_En_Input (line 8753) | interface Ai_Cf_Deepgram_Aura_2_En_Input {
type Ai_Cf_Deepgram_Aura_2_En_Output (line 8822) | type Ai_Cf_Deepgram_Aura_2_En_Output = string;
type Ai_Cf_Deepgram_Aura_2_Es_Input (line 8827) | interface Ai_Cf_Deepgram_Aura_2_Es_Input {
type Ai_Cf_Deepgram_Aura_2_Es_Output (line 8866) | type Ai_Cf_Deepgram_Aura_2_Es_Output = string;
type AiModels (line 8871) | interface AiModels {
type AiOptions (line 8957) | type AiOptions = {
type AiModelsSearchParams (line 8982) | type AiModelsSearchParams = {
type AiModelsSearchObject (line 8991) | type AiModelsSearchObject = {
type InferenceUpstreamError (line 9007) | interface InferenceUpstreamError extends Error {}
type AiInternalError (line 9008) | interface AiInternalError extends Error {}
type AiModelListType (line 9009) | type AiModelListType = Record<string, any>;
type GatewayRetries (line 9038) | type GatewayRetries = {
type GatewayOptions (line 9043) | type GatewayOptions = {
type UniversalGatewayOptions (line 9054) | type UniversalGatewayOptions = Exclude<GatewayOptions, "id"> & {
type AiGatewayPatchLog (line 9060) | type AiGatewayPatchLog = {
type AiGatewayLog (line 9065) | type AiGatewayLog = {
type AIGatewayProviders (line 9092) | type AIGatewayProviders =
type AIGatewayHeaders (line 9113) | type AIGatewayHeaders = {
type AIGatewayUniversalRequest (line 9137) | type AIGatewayUniversalRequest = {
type AiGatewayInternalError (line 9143) | interface AiGatewayInternalError extends Error {}
type AiGatewayLogNotFound (line 9144) | interface AiGatewayLogNotFound extends Error {}
type AutoRAGInternalError (line 9157) | interface AutoRAGInternalError extends Error {}
type AutoRAGNotFoundError (line 9158) | interface AutoRAGNotFoundError extends Error {}
type AutoRAGUnauthorizedError (line 9159) | interface AutoRAGUnauthorizedError extends Error {}
type AutoRAGNameNotSetError (line 9160) | interface AutoRAGNameNotSetError extends Error {}
type ComparisonFilter (line 9161) | type ComparisonFilter = {
type CompoundFilter (line 9166) | type CompoundFilter = {
type AutoRagSearchRequest (line 9170) | type AutoRagSearchRequest = {
type AutoRagAiSearchRequest (line 9184) | type AutoRagAiSearchRequest = AutoRagSearchRequest & {
type AutoRagAiSearchRequestStreaming (line 9188) | type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, "str...
type AutoRagSearchResponse (line 9191) | type AutoRagSearchResponse = {
type AutoRagListResponse (line 9207) | type AutoRagListResponse = {
type AutoRagAiSearchResponse (line 9216) | type AutoRagAiSearchResponse = AutoRagSearchResponse & {
type BasicImageTransformations (line 9226) | interface BasicImageTransformations {
type BasicImageTransformationsGravityCoordinates (line 9302) | interface BasicImageTransformationsGravityCoordinates {
type RequestInitCfProperties (line 9316) | interface RequestInitCfProperties extends Record<string, unknown> {
type RequestInitCfPropertiesImageDraw (line 9367) | interface RequestInitCfPropertiesImageDraw extends BasicImageTransformat...
type RequestInitCfPropertiesImage (line 9404) | interface RequestInitCfPropertiesImage extends BasicImageTransformations {
type RequestInitCfPropertiesImageMinify (line 9561) | interface RequestInitCfPropertiesImageMinify {
type RequestInitCfPropertiesR2 (line 9566) | interface RequestInitCfPropertiesR2 {
type IncomingRequestCfProperties (line 9575) | type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingReque...
type IncomingRequestCfPropertiesBase (line 9580) | interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
type IncomingRequestCfPropertiesBotManagementBase (line 9658) | interface IncomingRequestCfPropertiesBotManagementBase {
type IncomingRequestCfPropertiesBotManagement (line 9685) | interface IncomingRequestCfPropertiesBotManagement {
type IncomingRequestCfPropertiesBotManagementEnterprise (line 9697) | interface IncomingRequestCfPropertiesBotManagementEnterprise extends Inc...
type IncomingRequestCfPropertiesCloudflareForSaaSEnterprise (line 9709) | interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMet...
type IncomingRequestCfPropertiesCloudflareAccessOrApiShield (line 9718) | interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
type IncomingRequestCfPropertiesExportedAuthenticatorMetadata (line 9738) | interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
type IncomingRequestCfPropertiesGeographicInformation (line 9767) | interface IncomingRequestCfPropertiesGeographicInformation {
type IncomingRequestCfPropertiesTLSClientAuth (line 9844) | interface IncomingRequestCfPropertiesTLSClientAuth {
type IncomingRequestCfPropertiesTLSClientAuthPlaceholder (line 9937) | interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
type CertVerificationStatus (line 9957) | type CertVerificationStatus =
type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus (line 9975) | type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
type Iso3166Alpha2Code (line 9983) | type Iso3166Alpha2Code =
type ContinentCode (line 10234) | type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
type CfProperties (line 10235) | type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<...
type D1Meta (line 10236) | interface D1Meta {
type D1Response (line 10264) | interface D1Response {
type D1Result (line 10269) | type D1Result<T = unknown> = D1Response & {
type D1ExecResult (line 10272) | interface D1ExecResult {
type D1SessionConstraint (line 10276) | type D1SessionConstraint =
type D1SessionBookmark (line 10285) | type D1SessionBookmark = string;
type Disposable (line 10327) | interface Disposable {}
type EmailMessage (line 10331) | interface EmailMessage {
type ForwardableEmailMessage (line 10344) | interface ForwardableEmailMessage extends EmailMessage {
type SendEmail (line 10380) | interface SendEmail {
type EmailExportedHandler (line 10386) | type EmailExportedHandler<Env = unknown> = (
type HelloWorldBinding (line 10401) | interface HelloWorldBinding {
type Hyperdrive (line 10414) | interface Hyperdrive {
type ImageInfoResponse (line 10464) | type ImageInfoResponse =
type ImageTransform (line 10474) | type ImageTransform = {
type ImageDrawOptions (line 10531) | type ImageDrawOptions = {
type ImageInputOptions (line 10539) | type ImageInputOptions = {
type ImageOutputOptions (line 10542) | type ImageOutputOptions = {
type ImagesBinding (line 10548) | interface ImagesBinding {
type ImageTransformer (line 10562) | interface ImageTransformer {
type ImageTransformationOutputOptions (line 10583) | type ImageTransformationOutputOptions = {
type ImageTransformationResult (line 10586) | interface ImageTransformationResult {
type ImagesError (line 10600) | interface ImagesError extends Error {
type MediaBinding (line 10609) | interface MediaBinding {
type MediaTransformer (line 10621) | interface MediaTransformer {
type MediaTransformationGenerator (line 10633) | interface MediaTransformationGenerator {
type MediaTransformationResult (line 10645) | interface MediaTransformationResult {
type MediaTransformationInputOptions (line 10666) | type MediaTransformationInputOptions = {
type MediaTransformationOutputOptions (line 10678) | type MediaTransformationOutputOptions = {
type MediaError (line 10706) | interface MediaError extends Error {
type NodeStyleServer (line 10712) | interface NodeStyleServer {
type Params (line 10722) | type Params<P extends string = any> = Record<P, string | string[]>;
type EventContext (line 10723) | type EventContext<Env, P extends string, Data> = {
type PagesFunction (line 10737) | type PagesFunction<
type EventPluginContext (line 10742) | type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
type PagesPluginFunction (line 10757) | type PagesPluginFunction<
type PipelineRecord (line 10787) | type PipelineRecord = Record<string, unknown>;
type PipelineBatchMetadata (line 10788) | type PipelineBatchMetadata = {
type Pipeline (line 10792) | interface Pipeline<T extends PipelineRecord = PipelineRecord> {
type PubSubMessage (line 10805) | interface PubSubMessage {
type JsonWebKeyWithKid (line 10831) | interface JsonWebKeyWithKid extends JsonWebKey {
type RateLimitOptions (line 10835) | interface RateLimitOptions {
type RateLimitOutcome (line 10838) | interface RateLimitOutcome {
type RateLimit (line 10841) | interface RateLimit {
type RpcTargetBranded (line 10862) | interface RpcTargetBranded {
type WorkerEntrypointBranded (line 10865) | interface WorkerEntrypointBranded {
type DurableObjectBranded (line 10868) | interface DurableObjectBranded {
type WorkflowEntrypointBranded (line 10871) | interface WorkflowEntrypointBranded {
type EntrypointBranded (line 10874) | type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded ...
type Stubable (line 10876) | type Stubable = RpcTargetBranded | ((...args: any[]) => any);
type Serializable (line 10881) | type Serializable<T> =
type StubBase (line 10900) | interface StubBase<T extends Stubable> extends Disposable {
type Stub (line 10904) | type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
type BaseType (line 10906) | type BaseType =
type Stubify (line 10927) | type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, ...
type Unstubify (line 10936) | type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infe...
type UnstubifyAll (line 10941) | type UnstubifyAll<A extends any[]> = {
type MaybeProvider (line 10946) | type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
type MaybeDisposable (line 10947) | type MaybeDisposable<T> = T extends object ? Disposable : unknown;
type Result (line 10956) | type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R...
type MethodOrProperty (line 10962) | type MethodOrProperty<V> = V extends (...args: infer P) => infer R
type MaybeCallableProvider (line 10967) | type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? Meth...
type Provider (line 10971) | type Provider<T extends object, Reserved extends string = never> = Maybe...
type Env (line 10986) | interface Env {}
type GlobalProps (line 11005) | interface GlobalProps {}
type GlobalProp (line 11008) | type GlobalProp<K extends string, Default> = K extends keyof GlobalProps...
type MainModule (line 11011) | type MainModule = GlobalProp<"mainModule", {}>;
type Exports (line 11013) | type Exports = {
type RpcStub (line 11027) | type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
type WorkflowDurationLabel (line 11062) | type WorkflowDurationLabel = "second" | "minute" | "hour" | "day" | "wee...
type WorkflowSleepDuration (line 11063) | type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${"s" | ...
type WorkflowDelayDuration (line 11064) | type WorkflowDelayDuration = WorkflowSleepDuration;
type WorkflowTimeoutDuration (line 11065) | type WorkflowTimeoutDuration = WorkflowSleepDuration;
type WorkflowRetentionDuration (line 11066) | type WorkflowRetentionDuration = WorkflowSleepDuration;
type WorkflowBackoff (line 11067) | type WorkflowBackoff = "constant" | "linear" | "exponential";
type WorkflowStepConfig (line 11068) | type WorkflowStepConfig = {
type WorkflowEvent (line 11076) | type WorkflowEvent<T> = {
type WorkflowStepEvent (line 11081) | type WorkflowStepEvent<T> = {
type SecretsStoreSecret (line 11122) | interface SecretsStoreSecret {
type MarkdownDocument (line 11133) | type MarkdownDocument = {
type ConversionResponse (line 11137) | type ConversionResponse =
type ImageConversionOptions (line 11151) | type ImageConversionOptions = {
type EmbeddedImageConversionOptions (line 11154) | type EmbeddedImageConversionOptions = ImageConversionOptions & {
type ConversionOptions (line 11158) | type ConversionOptions = {
type ConversionRequestOptions (line 11173) | type ConversionRequestOptions = {
type SupportedFileFormat (line 11178) | type SupportedFileFormat = {
type Header (line 11188) | interface Header {
type FetchEventInfo (line 11192) | interface FetchEventInfo {
type JsRpcEventInfo (line 11199) | interface JsRpcEventInfo {
type ScheduledEventInfo (line 11202) | interface ScheduledEventInfo {
type AlarmEventInfo (line 11207) | interface AlarmEventInfo {
type QueueEventInfo (line 11211) | interface QueueEventInfo {
type EmailEventInfo (line 11216) | interface EmailEventInfo {
type TraceEventInfo (line 11222) | interface TraceEventInfo {
type HibernatableWebSocketEventInfoMessage (line 11226) | interface HibernatableWebSocketEventInfoMessage {
type HibernatableWebSocketEventInfoError (line 11229) | interface HibernatableWebSocketEventInfoError {
type HibernatableWebSocketEventInfoClose (line 11232) | interface HibernatableWebSocketEventInfoClose {
type HibernatableWebSocketEventInfo (line 11237) | interface HibernatableWebSocketEventInfo {
type CustomEventInfo (line 11244) | interface CustomEventInfo {
type FetchResponseInfo (line 11247) | interface FetchResponseInfo {
type EventOutcome (line 11251) | type EventOutcome =
type ScriptVersion (line 11263) | interface ScriptVersion {
type Onset (line 11268) | interface Onset {
type Outcome (line 11290) | interface Outcome {
type SpanOpen (line 11296) | interface SpanOpen {
type SpanClose (line 11303) | interface SpanClose {
type DiagnosticChannelEvent (line 11307) | interface DiagnosticChannelEvent {
type Exception (line 11312) | interface Exception {
type Log (line 11318) | interface Log {
type Return (line 11327) | interface Return {
type Attribute (line 11331) | interface Attribute {
type Attributes (line 11335) | interface Attributes {
type EventType (line 11339) | type EventType =
type SpanContext (line 11350) | interface SpanContext {
type TailEvent (line 11365) | interface TailEvent<Event extends EventType> {
type TailEventHandler (line 11375) | type TailEventHandler<Event extends EventType = EventType> = (event: Tai...
type TailEventHandlerObject (line 11376) | type TailEventHandlerObject = {
type TailEventHandlerType (line 11386) | type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
type VectorizeVectorMetadataValue (line 11394) | type VectorizeVectorMetadataValue = string | number | boolean | string[];
type VectorizeVectorMetadata (line 11398) | type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<str...
type VectorFloatArray (line 11399) | type VectorFloatArray = Float32Array | Float64Array;
type VectorizeError (line 11400) | interface VectorizeError {
type VectorizeVectorMetadataFilterOp (line 11409) | type VectorizeVectorMetadataFilterOp = "$eq" | "$ne" | "$lt" | "$lte" | ...
type VectorizeVectorMetadataFilterCollectionOp (line 11410) | type VectorizeVectorMetadataFilterCollectionOp = "$in" | "$nin";
type VectorizeVectorMetadataFilter (line 11414) | type VectorizeVectorMetadataFilter = {
type VectorizeDistanceMetric (line 11429) | type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
type VectorizeMetadataRetrievalLevel (line 11439) | type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
type VectorizeQueryOptions (line 11440) | interface VectorizeQueryOptions {
type VectorizeIndexConfig (line 11450) | type VectorizeIndexConfig =
type VectorizeIndexDetails (line 11464) | interface VectorizeIndexDetails {
type VectorizeIndexInfo (line 11479) | interface VectorizeIndexInfo {
type VectorizeVector (line 11492) | interface VectorizeVector {
type VectorizeMatch (line 11505) | type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
type VectorizeMatches (line 11513) | interface VectorizeMatches {
type VectorizeVectorMutation (line 11524) | interface VectorizeVectorMutation {
type VectorizeAsyncMutation (line 11534) | interface VectorizeAsyncMutation {
type WorkerVersionMetadata (line 11636) | type WorkerVersionMetadata = {
type DynamicDispatchLimits (line 11644) | interface DynamicDispatchLimits {
type DynamicDispatchOptions (line 11654) | interface DynamicDispatchOptions {
type DispatchNamespace (line 11666) | interface DispatchNamespace {
class NonRetryableError (line 11687) | class NonRetryableError extends Error {
type WorkflowDurationLabel (line 11712) | type WorkflowDurationLabel = "second" | "minute" | "hour" | "day" | "wee...
type WorkflowSleepDuration (line 11713) | type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${"s" | ...
type WorkflowRetentionDuration (line 11714) | type WorkflowRetentionDuration = WorkflowSleepDuration;
type WorkflowInstanceCreateOptions (line 11715) | interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
type InstanceStatus (line 11733) | type InstanceStatus = {
type WorkflowError (line 11750) | interface WorkflowError {
FILE: python/callbacks.py
class LogPredictCallback (line 19) | class LogPredictCallback(Callback):
method __init__ (line 20) | def __init__(
method on_test_batch_end (line 33) | def on_test_batch_end(
function get_ema_multi_avg_fn (line 150) | def get_ema_multi_avg_fn(
class EMAWeightAveraging (line 213) | class EMAWeightAveraging(WeightAveraging):
method __init__ (line 252) | def __init__(
method should_update (line 279) | def should_update(self, step_idx: int | None = None, epoch_idx: int | ...
class ExportBestModelToONNX (line 307) | class ExportBestModelToONNX(Callback):
method __init__ (line 322) | def __init__(
method on_fit_end (line 339) | def on_fit_end(self, trainer: Trainer, pl_module: LightningModule) -> ...
FILE: python/dataset.py
class MathSymbolDataModule (line 9) | class MathSymbolDataModule(LightningDataModule):
method __init__ (line 10) | def __init__(
method prepare_data (line 41) | def prepare_data(self):
method setup (line 45) | def setup(self, stage: str | None = None):
method train_dataloader (line 77) | def train_dataloader(self):
method val_dataloader (line 88) | def val_dataloader(self):
method test_dataloader (line 99) | def test_dataloader(self):
method on_after_batch_transfer (line 110) | def on_after_batch_transfer(self, batch, dataloader_idx):
FILE: python/model.py
class BaseModel (line 17) | class BaseModel(LightningModule):
method __init__ (line 20) | def __init__(
method forward (line 41) | def forward(self, x: Tensor) -> Tensor:
method training_step (line 45) | def training_step(self, batch, batch_idx=0):
method validation_step (line 54) | def validation_step(self, batch, batch_idx=0):
method test_step (line 63) | def test_step(self, batch, batch_idx=0): # noqa: ARG002
method configure_optimizers (line 70) | def configure_optimizers(self):
class TimmModel (line 112) | class TimmModel(BaseModel):
method __init__ (line 113) | def __init__(
method forward (line 163) | def forward(self, x):
FILE: python/proc_data.py
class TypstSymInfo (line 35) | class TypstSymInfo(Struct, kw_only=True, omit_defaults=True):
class UnmappedSymbols (line 45) | class UnmappedSymbols(Struct, kw_only=True, omit_defaults=True):
class DetexifySymInfo (line 50) | class DetexifySymInfo(Struct, kw_only=True, omit_defaults=True):
class MathSymbolSample (line 59) | class MathSymbolSample(Struct):
class DataSetName (line 64) | class DataSetName(StrEnum):
function is_invisible (line 72) | def is_invisible(c: str) -> bool:
function get_logger (line 79) | def get_logger():
function get_typst_symbol_info (line 89) | def get_typst_symbol_info() -> list[TypstSymInfo]:
function rasterize_strokes (line 145) | def rasterize_strokes(strokes: Strokes, output_size: int):
function get_dataset_classes (line 203) | def get_dataset_classes(dataset_name: str) -> list[str]:
function get_tex_typ_map (line 214) | def get_tex_typ_map() -> dict[str, TypstSymInfo]:
function get_xml_parser (line 239) | def get_xml_parser():
function parse_mathwriting_symbol (line 246) | def parse_mathwriting_symbol(
function collect_mathwriting_raw (line 291) | def collect_mathwriting_raw():
function collect_detexify_raw (line 330) | def collect_detexify_raw():
function collect_contrib_raw (line 390) | def collect_contrib_raw():
function create_raw_dataset (line 439) | def create_raw_dataset(
function load_raw_dataset (line 526) | def load_raw_dataset(dataset_names: list[DataSetName]) -> pl.DataFrame:
function remap_from_raw (line 547) | def remap_from_raw(
function generate_data_info (line 596) | def generate_data_info(classes: list[str]) -> None:
function create_dataset (line 638) | def create_dataset(
function main (line 749) | def main(
FILE: python/review_contrib.py
function bold (line 16) | def bold(s: str) -> str:
FILE: python/train.py
class ModelName (line 11) | class ModelName(StrEnum):
function main (line 26) | def main(
Condensed preview — 55 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (574K chars).
[
{
"path": ".gitattributes",
"chars": 34,
"preview": "pnpm-lock.yaml linguist-generated\n"
},
{
"path": ".github/workflows/frontend.yml",
"chars": 1264,
"preview": "name: Frontend code quality check\n\non:\n push:\n branches: [main, \"*dev\"]\n pull_request:\n branches: [main, \"*dev\"]"
},
{
"path": ".github/workflows/prek.yml",
"chars": 326,
"preview": "name: Prek check\n\non:\n push:\n branches: [main, \"*dev\"]\n pull_request:\n branches: [main, \"*dev\"]\n types: [open"
},
{
"path": ".github/workflows/py-code-check.yml",
"chars": 437,
"preview": "name: Python code quality check\n\non:\n push:\n branches: [main, \"*dev\"]\n pull_request:\n branches: [main, \"*dev\"]\n "
},
{
"path": ".github/workflows/py-weekly-update.yml",
"chars": 7104,
"preview": "name: Weekly updates for symbols\n\non:\n workflow_dispatch:\n schedule:\n # weekly, Monday\n - cron: \"0 0 * * 1\"\n pu"
},
{
"path": ".gitignore",
"chars": 157,
"preview": ".venv/\n__pycache__/\n\nnode_modules/\n.wrangler/\n.cache/\n\nbuild/\ntrain/\ndist/\n*.woff2\n/*.zsh\n/*.zip\n\n# Ref: https://github."
},
{
"path": ".prettierignore",
"chars": 35,
"preview": "/data\n/external\n\n*.md\n*.yml\n*.yaml\n"
},
{
"path": "LICENSE",
"chars": 1067,
"preview": "MIT License\n\nCopyright (c) 2024 QuarticCat\n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
},
{
"path": "README.md",
"chars": 1288,
"preview": "<div align=\"center\">\n <img src=\"./assets/logo.svg\" alt=\"logo\" width=\"150\"/>\n <h1>Detypify</h1>\n <p>\n Can"
},
{
"path": "frontend/service/README.md",
"chars": 1196,
"preview": "# Detypify Service\n\nIntegrate Detypify into your own projects.\n\n## Example\n\n```typescript\nimport { Detypify, inferSyms }"
},
{
"path": "frontend/service/package.json",
"chars": 982,
"preview": "{\n \"name\": \"detypify-service\",\n \"type\": \"module\",\n \"version\": \"0.3.0\",\n \"description\": \"Typst symbol classif"
},
{
"path": "frontend/service/src/index.ts",
"chars": 3623,
"preview": "import contribSymsRaw from \"../train/contrib.json\";\nimport inferSymsRaw from \"../train/infer.json\";\nimport { InferenceSe"
},
{
"path": "frontend/ui/README.md",
"chars": 267,
"preview": "# Detypify UI\n\nA frontend for the Detypify web experience.\n\n## Development\n\n```console\n$ bun run dev # start Vite d"
},
{
"path": "frontend/ui/index.html",
"chars": 1200,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <title>Detypify</title>\n <me"
},
{
"path": "frontend/ui/package.json",
"chars": 969,
"preview": "{\n \"name\": \"detypify-ui\",\n \"private\": true,\n \"version\": \"0.3.0\",\n \"type\": \"module\",\n \"scripts\": {\n "
},
{
"path": "frontend/ui/public/CNAME",
"chars": 24,
"preview": "detypify.quarticcat.com\n"
},
{
"path": "frontend/ui/public/robots.txt",
"chars": 23,
"preview": "User-agent: *\nAllow: /\n"
},
{
"path": "frontend/ui/scripts/subset-font.ts",
"chars": 1263,
"preview": "import { contribSyms } from \"detypify-service\";\nimport { execSync } from \"node:child_process\";\nimport fs from \"node:fs/p"
},
{
"path": "frontend/ui/src/App.svelte",
"chars": 2416,
"preview": "<script lang=\"ts\">\n import Contrib from \"./routes/Contrib.svelte\";\n import FAQ from \"./routes/FAQ.svelte\";\n imp"
},
{
"path": "frontend/ui/src/app.css",
"chars": 1531,
"preview": "@import \"tailwindcss\";\n\n@plugin \"flowbite/plugin\";\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n@theme {\n --colo"
},
{
"path": "frontend/ui/src/lib/Candidate.svelte",
"chars": 1794,
"preview": "<script lang=\"ts\">\n import Card from \"./Card.svelte\";\n import CopyButton from \"./CopyButton.svelte\";\n import ty"
},
{
"path": "frontend/ui/src/lib/Canvas.svelte",
"chars": 2451,
"preview": "<script lang=\"ts\">\n import type { Stroke, Strokes } from \"detypify-service\";\n import { Tooltip } from \"flowbite-sv"
},
{
"path": "frontend/ui/src/lib/Card.svelte",
"chars": 494,
"preview": "<script lang=\"ts\">\n import { fly } from \"svelte/transition\";\n\n let { class: className = \"\", children, ...restProps"
},
{
"path": "frontend/ui/src/lib/ContribPanel.svelte",
"chars": 2858,
"preview": "<script lang=\"ts\">\n import { contribSyms } from \"detypify-service\";\n import type { Strokes } from \"detypify-servic"
},
{
"path": "frontend/ui/src/lib/CopyButton.svelte",
"chars": 578,
"preview": "<script lang=\"ts\">\n import { Tooltip } from \"flowbite-svelte\";\n import type { Snippet } from \"svelte\";\n\n let { "
},
{
"path": "frontend/ui/src/lib/Preview.svelte",
"chars": 1053,
"preview": "<script lang=\"ts\">\n import Card from \"./Card.svelte\";\n import { contribSyms } from \"detypify-service\";\n import "
},
{
"path": "frontend/ui/src/main.ts",
"chars": 180,
"preview": "import App from \"./App.svelte\";\nimport \"./app.css\";\nimport { mount } from \"svelte\";\n\nconst app = mount(App, {\n target"
},
{
"path": "frontend/ui/src/routes/Contrib.svelte",
"chars": 1229,
"preview": "<script lang=\"ts\">\n import Canvas from \"../lib/Canvas.svelte\";\n import ContribPanel from \"../lib/ContribPanel.svel"
},
{
"path": "frontend/ui/src/routes/FAQ.svelte",
"chars": 1923,
"preview": "<script lang=\"ts\">\n import { inferSyms } from \"detypify-service\";\n import { AccordionItem, Accordion, A, P, Li, Li"
},
{
"path": "frontend/ui/src/routes/Home.svelte",
"chars": 1689,
"preview": "<script lang=\"ts\">\n import Candidate from \"../lib/Candidate.svelte\";\n import Canvas from \"../lib/Canvas.svelte\";\n "
},
{
"path": "frontend/ui/svelte.config.js",
"chars": 236,
"preview": "import { vitePreprocess } from \"@sveltejs/vite-plugin-svelte\";\n\n/** @type {import(\"@sveltejs/vite-plugin-svelte\").Svelte"
},
{
"path": "frontend/ui/tsconfig.app.json",
"chars": 891,
"preview": "{\n \"extends\": \"@tsconfig/svelte/tsconfig.json\",\n \"compilerOptions\": {\n \"tsBuildInfoFile\": \"./node_modules/."
},
{
"path": "frontend/ui/tsconfig.json",
"chars": 173,
"preview": "{\n \"files\": [],\n \"references\": [\n {\n \"path\": \"./tsconfig.app.json\"\n },\n {\n "
},
{
"path": "frontend/ui/tsconfig.node.json",
"chars": 748,
"preview": "{\n \"compilerOptions\": {\n \"tsBuildInfoFile\": \"./node_modules/.tmp/tsconfig.node.tsbuildinfo\",\n \"target\":"
},
{
"path": "frontend/ui/vite.config.ts",
"chars": 1253,
"preview": "import { svelte } from \"@sveltejs/vite-plugin-svelte\";\nimport tailwindcss from \"@tailwindcss/vite\";\nimport { defineConfi"
},
{
"path": "frontend/worker/README.md",
"chars": 329,
"preview": "# Detypify Worker\n\nA Cloudflare Worker that accepts contributions from the web page and stores them in a D1 database.\n\n#"
},
{
"path": "frontend/worker/package.json",
"chars": 371,
"preview": "{\n \"name\": \"detypify-worker\",\n \"version\": \"0.3.0\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"wrangler "
},
{
"path": "frontend/worker/schema.sql",
"chars": 217,
"preview": "-- $ bunx wrangler d1 execute detypify --remote --file=schema.sql\n\nCREATE TABLE IF NOT EXISTS samples (\n id INTE"
},
{
"path": "frontend/worker/src/index.ts",
"chars": 710,
"preview": "import { Hono } from \"hono\";\nimport { cors } from \"hono/cors\";\n\ntype Bindings = {\n DB: D1Database;\n};\n\ntype ContribPa"
},
{
"path": "frontend/worker/tsconfig.json",
"chars": 277,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"Bundler\""
},
{
"path": "frontend/worker/worker-configuration.d.ts",
"chars": 426493,
"preview": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types --env-interface CloudflareBindings` (hash: f385"
},
{
"path": "frontend/worker/wrangler.toml",
"chars": 187,
"preview": "name = \"detypify\"\nmain = \"src/index.ts\"\ncompatibility_date = \"2026-01-13\"\n\n[[d1_databases]]\nbinding = \"DB\"\ndatabase_name"
},
{
"path": "package.json",
"chars": 934,
"preview": "{\n \"name\": \"detypify-frontend\",\n \"scripts\": {\n \"format\": \"prettier --write .\"\n },\n \"devDependencies\":"
},
{
"path": "pnpm-workspace.yaml",
"chars": 27,
"preview": "packages:\n - 'frontend/*'\n"
},
{
"path": "prek.toml",
"chars": 174,
"preview": "[[repos]]\nrepo = \"builtin\"\nhooks = [\n { id = \"trailing-whitespace\" },\n { id = \"end-of-file-fixer\" },\n { id = \"m"
},
{
"path": "pyproject.toml",
"chars": 9007,
"preview": "[project]\nname = \"detypify-model\"\nversion = \"0.3.0\"\nrequires-python = \">=3.13, <3.14\"\nauthors = [\n { name = \"QuarticCat"
},
{
"path": "python/README.md",
"chars": 4165,
"preview": "# Detypify Model\n\nThis directory contains scripts for data preprocessing, model training, and asset generation for Detyp"
},
{
"path": "python/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "python/callbacks.py",
"chars": 13868,
"preview": "\"\"\"Self Write Training Callbacks\"\"\"\n\nfrom __future__ import annotations\n\nimport logging\nfrom pathlib import Path\nfrom ty"
},
{
"path": "python/dataset.py",
"chars": 3976,
"preview": "from os import process_cpu_count\nfrom typing import override\n\nfrom datasets import load_dataset\nfrom lightning import Li"
},
{
"path": "python/model.py",
"chars": 5260,
"preview": "from abc import abstractmethod\nfrom typing import override\n\nimport torch\nfrom lightning import LightningModule\nfrom timm"
},
{
"path": "python/proc_data.py",
"chars": 24586,
"preview": "\"\"\"Preprocess training datasets, helping functions and related constants/types.\"\"\"\n\nfrom __future__ import annotations\n\n"
},
{
"path": "python/review_contrib.py",
"chars": 2519,
"preview": "\"\"\"Preprocess contribution from the webpage.\"\"\"\n\nimport logging\nimport shutil\nfrom pathlib import Path\n\nimport cv2\nfrom "
},
{
"path": "python/tex_to_typ.yaml",
"chars": 3899,
"preview": "# Alphabet\n# Double Struck Capital Letters\n\\mathds{A}: AA\n\\mathds{B}: BB\n\\mathds{C}: CC\n\\mathds{D}: DD\n\\mathds{E}: EE\n\\m"
},
{
"path": "python/train.py",
"chars": 9387,
"preview": "\"\"\"Train the model.\"\"\"\n\nimport logging\nfrom enum import StrEnum\n\nimport typer\n\nCUDA_AMPERE_VERSION = 8\n\n\nclass ModelName"
}
]
About this extraction
This page contains the full source code of the QuarticCat/detypify GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 55 files (536.3 KB), approximately 129.3k tokens, and a symbol index with 735 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.